@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{isRGB as e}from"../../core/colorUtils.js";import{getFontFamily as r}from"../../core/fontUtils.js";import{clone as t}from"../../core/lang.js";import i from"../../core/Logger.js";import{pt2px as o,px2pt as a}from"../../core/screenUtils.js";import{numericHash as s}from"../../core/string.js";import{CIMSymbolHelper as l}from"./CIMSymbolHelper.js";import{defaultCIMValues as n}from"./defaultCIMValues.js";import{Alignment as p}from"./enums.js";import{OverrideHelper as c}from"./OverrideHelper.js";import{getExtent as m,getSDFMetrics as y}from"./SDFHelper.js";import{colorToArray as f,normalizeAlpha as h,getSize as d,isCIMMarkerStrokePlacement as u,getTintColor as v,getValue as O,getDefaultCIMValue as _,getEnum as g,getFillColor as S,getStrokeColor as k,getStrokeWidth as M,fromCIMFontDecoration as P,fromCIMFontStyle as b,fromCIMHorizontalAlignment as C,fromCIMVerticalAlignment as z,isValidCIMValue as x,uncapitalize as L}from"./utils.js";import{CIMEffectHelper as E}from"./effects/CIMEffectHelper.js";import{randomInsidePolygonTextureSize as I}from"../../views/2d/engine/webgl/definitions.js";const V=()=>i.getLogger("esri.symbols.cim.cimAnalyzer");function N(e){const r=e.markerPlacement;return r&&r.angleToLine?p.MAP:p.SCREEN}class w{constructor(e){this._cimLayers=[],this._poMap={},this._primitiveOverrides=[],e&&(this._resourceManager=e)}analyzeSymbolReference(r,t,i){if(this._cimLayers=i??[],!r)return this._cimLayers;if(this._reset(),r.primitiveOverrides){this._primitiveOverrides=r.primitiveOverrides;for(const r of this._primitiveOverrides){const t=r.valueExpressionInfo;if(t)this._setPoMap(r.primitiveName,r.propertyName,t);else if(null!=r.value){let t=r.value;r.propertyName.includes("Color")&&(e(t)&&(t=f(t)),t=h(t)),this._setPoMap(r.primitiveName,r.propertyName,t)}}}return this._analyzeSymbol(r.symbol,t),this._cimLayers}_reset(){this._cimLayers=[],this._poMap={},this._primitiveOverrides=[]}_analyzeSymbol(e,r){switch(e?.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":this._analyzeMultiLayerSymbol(e,r)}}_analyzeMultiLayerSymbol(e,r){const t=e?.symbolLayers;if(!t)return;const i=e.effects;let o=p.SCREEN;const a=d(e)??0;"CIMPointSymbol"===e.type&&"Map"===e.angleAlignment&&(o=p.MAP);const s="CIMPolygonSymbol"===e.type;let l=t.length;for(;l--;){const n=t[l];if(!n||!1===n.enable)continue;let p;i?.length&&(p=[...i]);const m=n.effects;m?.length&&(i?p.push(...m):p=[...m]);let y=null;if(p){y=[];for(const e of p){const r=c.findEffectOverrides(e,this._primitiveOverrides);r&&y.push(r)}}const f=[];switch(c.findApplicableOverrides(n,this._primitiveOverrides,f),n.type){case"CIMSolidFill":this._analyzeSolidFill(n,y);break;case"CIMPictureFill":this._analyzePictureFill(n,y);break;case"CIMHatchFill":this._analyzeHatchFill(n,y);break;case"CIMGradientFill":this._analyzeGradientFill(n,y);break;case"CIMSolidStroke":this._analyzeSolidStroke(n,y,s,a);break;case"CIMPictureStroke":this._analyzePictureStroke(n,y,s,a);break;case"CIMGradientStroke":this._analyzeGradientStroke(n,y,s,a);break;case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":{"CIMLineSymbol"!==e.type&&"CIMPolygonSymbol"!==e.type||(o=N(n));const t=[],i=n.primitiveName;i&&t.push(i);const l=s&&u(n.markerPlacement);this._analyzeMarker(n,y,null,t,o,a,r,[],!1,l);break}default:V().error("Cannot analyze CIM layer",n.type)}}}_analyzeSolidFill(e,r){const{primitiveName:t,type:i}=e,o=h(e.color);this._cimLayers.push({type:"fill",spriteRasterizationParam:null,colorLocked:!!e.colorLocked,color:this._getValueOrOverrideExpression(i,t,"Color",o),height:0,angle:0,offsetX:0,offsetY:0,scaleX:1,effects:r,applyRandomOffset:!1,sampleAlphaOnly:!0,hasUnresolvedReplacementColor:!1})}_analyzePictureFill(e,r){const{primitiveName:t,type:i}=e,o=v(e),a=O(e.height,n.CIMPictureFill.height);let s=O(e.scaleX,1);if("width"in e&&"number"==typeof e.width){const r=e.width;let t=1;const i=this._resourceManager.getResource(e.url);null!=i&&(t=i.width/i.height),s/=t*(a/r)}const l={type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(t,i)};this._cimLayers.push({type:"fill",spriteRasterizationParam:l,colorLocked:!!e.colorLocked,effects:r,color:this._getValueOrOverrideExpression(i,t,"TintColor",o),height:this._getValueOrOverrideExpression(i,t,"Height",a),scaleX:this._getValueOrOverrideExpression(i,t,"ScaleX",s),angle:this._getValueOrOverrideExpression(i,t,"Rotation",O(e.rotation)),offsetX:this._getValueOrOverrideExpression(i,t,"OffsetX",O(e.offsetX)),offsetY:this._getValueOrOverrideExpression(i,t,"OffsetY",O(e.offsetY)),applyRandomOffset:!1,sampleAlphaOnly:!1,hasUnresolvedReplacementColor:!1})}_analyzeHatchFill(e,r){const{primitiveName:t,type:i}=e,o=this._analyzeMaterialOverrides(t,["Rotation","OffsetX","OffsetY"]),a=this._normalizePrimitiveOverrideProps(o);let s=[255,255,255,1],l=!1;if(e.lineSymbol?.symbolLayers)for(const n of e.lineSymbol.symbolLayers){if("CIMSolidStroke"!==n.type)continue;const e=n.primitiveName??t;l||!e||n.colorLocked||null==this._poMap[e]?.Color&&null==this._poMap[e]?.StrokeColor||(s=h(n.color),s=this._maybeGetValueOrOverrideExpression(e,"StrokeColor")??this._getValueOrOverrideExpression(i,e,"Color",s),l=!0);const r=this._maybeGetValueOrOverrideExpression(e,"StrokeWidth");if(r){let t=null,o=null;"number"==typeof r?t=r:o=r.valueExpressionInfo;let s=a.find((e=>"strokeWidth"===e.propertyName));s?s.propertyName="width":(s={type:"CIMPrimitiveOverride",primitiveName:e,propertyName:"width",valueExpressionInfo:o,value:t,defaultValue:_(i,"width")},a.push(s))}}const p={type:"sprite-rasterization-param",resource:e,overrides:a};this._cimLayers.push({type:"fill",spriteRasterizationParam:p,colorLocked:!!e.colorLocked,effects:r,color:s,height:this._getValueOrOverrideExpression(i,t,"Separation",O(e.separation,n.CIMHatchFill.separation)),scaleX:1,angle:this._getValueOrOverrideExpression(i,t,"Rotation",O(e.rotation)),offsetX:this._getValueOrOverrideExpression(i,t,"OffsetX",O(e.offsetX)),offsetY:this._getValueOrOverrideExpression(i,t,"OffsetY",O(e.offsetY)),applyRandomOffset:!1,sampleAlphaOnly:!0,hasUnresolvedReplacementColor:!l})}_analyzeGradientFill(e,r){this._cimLayers.push({type:"fill",spriteRasterizationParam:null,colorLocked:!!e.colorLocked,effects:r,color:[128,128,128,1],height:0,angle:0,offsetX:0,offsetY:0,scaleX:1,applyRandomOffset:!1,sampleAlphaOnly:!1,hasUnresolvedReplacementColor:!1})}_analyzeSolidStroke(e,r,t,i){const{primitiveName:o,type:a}=e,s=h(e.color),l=O(e.width,n.CIMSolidStroke.width),p=g(e.capStyle,n.CIMSolidStroke.capstyle),c=g(e.joinStyle,n.CIMSolidStroke.joinstyle),m=e.miterLimit;let y,f,d=[];if(this._analyzePrimitiveOverrides(o,r,null,null)&&(d=this._getPrimitiveMaterialOverrides(o,a)),r&&r instanceof Array&&r.length>0){const e=r[r.length-1].effect;e&&"CIMGeometricEffectDashes"===e.type&&"NoConstraint"===e.lineDashEnding&&null===e.offsetAlongLine&&(y=e.dashTemplate,f=e.scaleDash,(r=[...r]).pop())}const u=void 0!==y?{type:"sprite-rasterization-param",resource:{type:"dash",dashTemplate:y,capStyle:p},overrides:d}:null;this._cimLayers.push({type:"line",spriteRasterizationParam:u,isOutline:t,colorLocked:!!e.colorLocked,effects:r,color:this._getValueOrOverrideExpression(a,o,"Color",s),width:this._getValueOrOverrideExpression(a,o,"Width",l),cap:this._getValueOrOverrideExpression(a,o,"CapStyle",p),join:this._getValueOrOverrideExpression(a,o,"JoinStyle",c),miterLimit:m&&this._getValueOrOverrideExpression(a,o,"MiterLimit",m),referenceWidth:i,zOrder:R(e.name),dashTemplate:y,scaleDash:f,sampleAlphaOnly:!0})}_analyzePictureStroke(e,r,t,i){const{primitiveName:o,type:a}=e,s=v(e),l=O(e.width,n.CIMPictureStroke.width),p=g(e.capStyle,n.CIMPictureStroke.capstyle),c=g(e.joinStyle,n.CIMPictureStroke.joinstyle),m=e.miterLimit,y={type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(o,a)};this._cimLayers.push({type:"line",spriteRasterizationParam:y,isOutline:t,colorLocked:!!e.colorLocked,effects:r,color:this._getValueOrOverrideExpression(a,o,"TintColor",s),width:this._getValueOrOverrideExpression(a,o,"Width",l),cap:this._getValueOrOverrideExpression(a,o,"CapStyle",p),join:this._getValueOrOverrideExpression(a,o,"JoinStyle",c),miterLimit:m&&this._getValueOrOverrideExpression(a,o,"MiterLimit",m),referenceWidth:i,zOrder:R(e.name),dashTemplate:null,scaleDash:!1,sampleAlphaOnly:!1})}_analyzeGradientStroke(e,r,t,i){const{primitiveName:o,type:a}=e,s=O(e.width,n.CIMSolidStroke.width),l=g(e.capStyle,n.CIMGradientStroke.capstyle),p=g(e.joinStyle,n.CIMGradientStroke.joinstyle),c=e.miterLimit;this._cimLayers.push({type:"line",spriteRasterizationParam:null,isOutline:t,colorLocked:!!e.colorLocked,effects:r,color:[128,128,128,1],width:this._getValueOrOverrideExpression(a,o,"Width",s),cap:this._getValueOrOverrideExpression(a,o,"CapStyle",l),join:this._getValueOrOverrideExpression(a,o,"JoinStyle",p),miterLimit:c&&this._getValueOrOverrideExpression(a,o,"MiterLimit",c),referenceWidth:i,zOrder:R(e.name),dashTemplate:null,scaleDash:!1,sampleAlphaOnly:!1})}_analyzeMarker(e,r,t,i,o,a,s,l,p=!1,c=!1){if(p||=!!e.colorLocked,this._analyzeMarkerInsidePolygon(e,r,p))return;const m=O(e.size,n.CIMVectorMarker.size),y=O(e.rotation),f=O(e.offsetX),h=O(e.offsetY),{primitiveName:d,type:u}=e,v=this._getValueOrOverrideExpression(u,d,"Size",m),_=this._getValueOrOverrideExpression(u,d,"Rotation",y),g=this._getValueOrOverrideExpression(u,d,"OffsetX",f),S=this._getValueOrOverrideExpression(u,d,"OffsetY",h);switch(e.type){case"CIMPictureMarker":this._analyzePictureMarker(e,r,t,i,o,a,v,_,g,S,l,p,c);break;case"CIMVectorMarker":this._analyzeVectorMarker(e,r,t,i,o,a,v,_,g,S,l,s,p,c)}}_analyzeMarkerInsidePolygon(e,r,t){const{markerPlacement:i,type:o}=e;if(!i||"CIMMarkerPlacementInsidePolygon"!==i.type)return!1;if("CIMVectorMarker"===o||"CIMPictureMarker"===o){const t=e.primitiveName;if(t&&this._analyzePrimitiveOverrides([t],r,null,null))return!1;const a=i.primitiveName;if(a&&this._analyzePrimitiveOverrides([a],r,null,null))return!1;if("CIMVectorMarker"===o){const{markerGraphics:r}=e;if(r)for(const e of r){const{symbol:r}=e;if("CIMPolygonSymbol"===r?.type&&r.symbolLayers){const{symbolLayers:e}=r;for(const r of e)if("CIMSolidStroke"===r.type)return!1}}}else{const{animatedSymbolProperties:r}=e;if(r)return!1}}const s=Math.abs(i.stepX),l=Math.abs(i.stepY);if(0===s||0===l)return!0;let n,p;if("Random"===i.gridType){const e=a(I),r=Math.max(Math.floor(e/s),1);n=l*Math.max(Math.floor(e/l),1);p=r*s/n}else i.shiftOddRows?(n=2*l,p=s/l*.5):(n=l,p=s/l);const c=v(e),m="CIMCharacterMarker"===e.type?null:{type:"sprite-rasterization-param",resource:e,overrides:[]};return this._cimLayers.push({type:"fill",spriteRasterizationParam:m,colorLocked:t,effects:r,color:c,height:n,scaleX:p,angle:i.gridAngle,offsetX:O(i.offsetX),offsetY:O(i.offsetY),applyRandomOffset:"Random"===i.gridType,sampleAlphaOnly:"CIMPictureMarker"!==e.type,hasUnresolvedReplacementColor:!0}),!0}_analyzePictureMarker(e,r,i,o,a,l,n,p,c,m,y,f,h){const{primitiveName:d,type:u}=e;let _=O(e.scaleX,1);const g=v(e);i||(i=this._createMarkerPlacementOverrideExpression(e.markerPlacement));const S=this._createAnimatedSymbolPropertiesOverrideExpression(e.animatedSymbolProperties),k=e.anchorPoint??{x:0,y:0};if("width"in e&&"number"==typeof e.width){const r=e.width;let t=1;const i=this._resourceManager.getResource(e.url);null!=i&&(t=i.width/i.height);_/=t*(O(e.size)/r)}const M=[...o];let P;e.primitiveName&&M.push(e.primitiveName),e.animatedSymbolProperties||S?P={type:"animated",url:e.url,urlHash:"H"+s(e.url),playAnimation:e.animatedSymbolProperties?.playAnimation,reverseAnimation:e.animatedSymbolProperties?.reverseAnimation,randomizeStartTime:e.animatedSymbolProperties?.randomizeStartTime,randomizeStartSeed:e.animatedSymbolProperties?.randomizeStartSeed,startTimeOffset:e.animatedSymbolProperties?.startTimeOffset,duration:e.animatedSymbolProperties?.duration,repeatType:e.animatedSymbolProperties?.repeatType,repeatDelay:e.animatedSymbolProperties?.repeatDelay}:(P=t(e),P.markerPlacement=null);const b={type:"sprite-rasterization-param",resource:P,overrides:this._getMaterialOverrides(M,u)};S&&b.overrides.push(...S.overrides),this._cimLayers.push({type:"marker",spriteRasterizationParam:b,colorLocked:f,effects:r,scaleSymbolsProportionally:!1,alignment:a,size:n,scaleX:this._getValueOrOverrideExpression(u,d,"ScaleX",_),rotation:p,offsetX:c,offsetY:m,transform:{type:"cim-marker-transform-param",params:y},color:this._getValueOrOverrideExpression(u,d,"TintColor",g),anchorPoint:{x:k.x,y:k.y},isAbsoluteAnchorPoint:"Relative"!==e.anchorPointUnits,outlineColor:[0,0,0,0],outlineWidth:0,frameHeight:0,widthRatio:1,rotateClockwise:!!e.rotateClockwise,referenceSize:l,sizeRatio:1,isOutline:h,markerPlacement:i,animatedSymbolProperties:S})}_analyzeVectorMarker(e,r,t,i,o,a,s,l,n,p,c,m,y,f){const h=e.markerGraphics;if(!h)return;const d=e.frame;let u=0;if(u=d?d.ymax-d.ymin:a,u){const r={offsetX:n,offsetY:p,rotation:l,size:s,frameHeight:u,rotateClockWise:!!e.rotateClockwise};c=[...c,r]}t||(t=this._createMarkerPlacementOverrideExpression(e.markerPlacement));for(const v of h)if(v){const s=v.symbol;if(!s)continue;const l=v.primitiveName;let n;if(l&&i.push(l),("CIMPointSymbol"===s.type||"CIMTextSymbol"===s.type)&&d){let r=0,t=0;const i=v.geometry;"x"in i&&"y"in i&&(r+=i.x-.5*(d.xmin+d.xmax),t+=i.y-.5*(d.ymin+d.ymax));const o=e.anchorPoint;o&&("Absolute"===e.anchorPointUnits?(r-=o.x,t-=o.y):d&&(r-=(d.xmax-d.xmin)*o.x,t-=(d.ymax-d.ymin)*o.y));const a={offsetX:r,offsetY:t,rotation:0,size:0,frameHeight:0,rotateClockWise:!1};n=[...c,a]}switch(s.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":m||X(s)?this._analyzeMultiLayerGraphicNonSDF(e,r,t,null,v,i,o,a,n??c,u,y,f):this._analyzeMultiLayerGraphic(e,r,t,null,v,i,o,a,n??c,u,y,f);break;case"CIMTextSymbol":this._analyzeTextGraphic(r,t,v,i,o,a,n??c,y)}l&&i.pop()}}_analyzeMultiLayerGraphic(e,r,t,i,o,a,s,l,n,p,c,f){const d=o.symbol,u=d.symbolLayers;if(!u)return;let v=u.length;if(G(u))return void this._analyzeCompositeMarkerGraphic(e,r,t,i,o,u,s,l,n,p,c,f);const O=this._resourceManager.geometryEngine,_=E.applyEffects(d.effects,o.geometry,O);if(_)for(;v--;){const d=u[v];if(!d||!1===d.enable)continue;const g=d.primitiveName;switch(g&&a.push(g),d.type){case"CIMSolidFill":case"CIMSolidStroke":{const a=E.applyEffects(d.effects,_,O),u=m(a);if(!u)continue;const v="Relative"!==e.anchorPointUnits,[P,b,C,z]=y(u,e.frame,e.size,e.anchorPoint,v),x="CIMSolidFill"===d.type,L={type:"sdf",geom:a,asFill:x},{path:I}=d,V=x?h(S(d)):null==I?h(k(d)):[0,0,0,0],N=x?[0,0,0,0]:h(k(d)),w=M(d)??0;if(!x&&!w)break;const R=o.primitiveName;let A=null;x&&!d.colorLocked&&(A=this._maybeGetValueOrOverrideExpression(R,"FillColor"));let G=null;x||d.colorLocked||(G=this._maybeGetValueOrOverrideExpression(R,"StrokeColor"));const X=A??this._getValueOrOverrideExpression(d.type,g,"Color",V),F=G??this._getValueOrOverrideExpression(d.type,g,"Color",N),T=this._maybeGetValueOrOverrideExpression(R,"StrokeWidth")??this._getValueOrOverrideExpression(d.type,g,"Width",w),Y=I?{type:"sprite-rasterization-param",resource:{type:"path",path:I,asFill:x},overrides:[]}:{type:"sprite-rasterization-param",resource:L,overrides:[]};this._cimLayers.push({type:"marker",spriteRasterizationParam:Y,colorLocked:!!d.colorLocked||!!c,effects:r,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:s,anchorPoint:{x:b,y:C},isAbsoluteAnchorPoint:v,size:p,rotation:0,offsetX:0,offsetY:0,scaleX:1,transform:{type:"cim-marker-transform-param",params:n},frameHeight:p,widthRatio:z,rotateClockwise:!1,referenceSize:l,sizeRatio:P,color:X,outlineColor:F,outlineWidth:T,isOutline:f,markerPlacement:t,animatedSymbolProperties:i});break}case"CIMPictureMarker":case"CIMVectorMarker":d.markerPlacement?this._analyzeMultiLayerGraphicNonSDF(e,r,t,i,o,a,s,l,n,p,!!d.colorLocked||!!c,f):this._analyzeMarker(d,r,t,a,s,l,!1,n,c,f);break;default:this._analyzeMultiLayerGraphicNonSDF(e,r,t,i,o,a,s,l,n,p,!!d.colorLocked||!!c,f)}g&&a.pop()}}_analyzeTextGraphic(e,t,i,o,a,s,l,p){const m=[];c.findApplicableOverrides(i,this._primitiveOverrides,m);const y=i.geometry;if(!("x"in y)||!("y"in y))return;const f=i.symbol,d=P(f),u=b(f.fontStyleName),v=r(f.fontFamilyName);f.font={family:v,decoration:d,...u};const _=O(f.height,n.CIMTextSymbol.height),g=O(f.angle),x=O(f.offsetX),L=O(f.offsetY),E=h(S(f));let I=h(k(f)),V=M(f)??0;V||(I=h(S(f.haloSymbol)),V=O(f.haloSize));let N=!1;if(f.symbol?.symbolLayers)for(const r of f.symbol.symbolLayers){null!=h(S(r))&&(N=!!r.colorLocked)}const w=i.primitiveName;let R=null;N||(R=this._maybeGetValueOrOverrideExpression(w,"FillColor"));const A=this._maybeGetValueOrOverrideExpression(w,"TextSize"),G=this._maybeGetValueOrOverrideExpression(w,"TextAngle"),X=this._maybeGetValueOrOverrideExpression(w,"TextOffsetX"),F=this._maybeGetValueOrOverrideExpression(w,"TextOffsetY");let T=null,Y=null,j=0;if(f.callout&&"CIMBackgroundCallout"===f.callout.type){const e=f.callout;if(e.backgroundSymbol){const r=e.backgroundSymbol.symbolLayers;if(r)for(const e of r)"CIMSolidFill"===e.type?T=h(e.color):"CIMSolidStroke"===e.type&&(Y=h(e.color),j=O(e.width,n.CIMSolidStroke.width))}}const W=this._getValueOrOverrideExpression(f.type,i.primitiveName,"TextString",i.textString??"");if(null==W)return;const{fontStyleName:D}=f,H=v+(D?"-"+D.toLowerCase():"-regular"),U=this._getMaterialOverrides(o,f.type);U.push(...this._getPrimitiveMaterialOverrides(i.primitiveName,f.type));const J={type:"text-rasterization-param",resource:{type:"text",textString:i.textString??"",font:f.font,symbol:f,primitiveName:i.primitiveName},overrides:U};this._cimLayers.push({type:"text",lineWidth:null,textRasterizationParam:J,colorLocked:!!p||!!N,effects:e,alignment:a,anchorPoint:{x:0,y:0},isAbsoluteAnchorPoint:!1,fontName:H,decoration:d,weight:u.weight,style:u.style,size:A??_,angle:G??g,offsetX:X??x,offsetY:F??L,transform:{type:"cim-marker-transform-param",params:l},horizontalAlignment:C(f.horizontalAlignment),verticalAlignment:z(f.verticalAlignment),text:W,color:R??this._getValueOrOverrideExpression(f.type,i.primitiveName,"Color",E),outlineColor:I,outlineSize:V,backgroundColor:T,borderLineColor:Y,borderLineWidth:j,referenceSize:s,sizeRatio:1,markerPlacement:t})}_analyzeMultiLayerGraphicNonSDF(e,r,t,i,a,s,n,p,c,m,y,f){const h=this._buildSimpleMarker(e,a),d=e.primitiveName,u=this._analyzeMaterialOverrides(d,["Rotation","OffsetX","OffsetY"]),v=this._normalizePrimitiveOverrideProps(u),[O,_,g]=l.getTextureAnchor(h,this._resourceManager),S=this._getMaterialOverrides(s,e.type);S.push(...v);const k={type:"sprite-rasterization-param",resource:{...h,avoidSDFRasterization:!0},overrides:S};this._cimLayers.push({type:"marker",spriteRasterizationParam:k,colorLocked:y,effects:r,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:n,anchorPoint:{x:O,y:_},isAbsoluteAnchorPoint:!1,size:m,rotation:0,offsetX:0,offsetY:0,transform:{type:"cim-marker-transform-param",params:c},color:[255,255,255,1],outlineColor:[0,0,0,0],outlineWidth:0,scaleX:1,frameHeight:m,widthRatio:1,rotateClockwise:!!e.rotateClockwise,referenceSize:p,sizeRatio:g/o(e.size),isOutline:f,markerPlacement:t,animatedSymbolProperties:i})}_createMarkerPlacementOverrideExpression(e){if(!e)return null;const r=[];return c.findApplicableOverrides(e,this._primitiveOverrides,r),{type:"cim-marker-placement-info",placement:e,overrides:F(r)}}_createAnimatedSymbolPropertiesOverrideExpression(e){if(!e)return null;const r=[];return c.findApplicableOverrides(e,this._primitiveOverrides,r),{type:"cim-animation-info",animation:e,overrides:F(r)}}_buildSimpleMarker(e,r){return{type:e.type,enable:!0,name:e.name,colorLocked:e.colorLocked,primitiveName:e.primitiveName,anchorPoint:e.anchorPoint,anchorPointUnits:e.anchorPointUnits,offsetX:0,offsetY:0,rotateClockwise:e.rotateClockwise,rotation:0,size:e.size,billboardMode3D:e.billboardMode3D,depth3D:e.depth3D,frame:e.frame,markerGraphics:[r],scaleSymbolsProportionally:e.scaleSymbolsProportionally,respectFrame:e.respectFrame,clippingPath:e.clippingPath}}_analyzeCompositeMarkerGraphic(e,r,t,i,o,a,s,l,p,c,f,d){const u=o.geometry,v=a[0],_=a[1],g=m(u);if(!g)return;const S="Relative"!==e.anchorPointUnits,[k,M,P,b]=y(g,e.frame,e.size,e.anchorPoint,S),{path:C}=_,z=_.primitiveName,x=v.primitiveName,L=o.primitiveName;let E=null;_.colorLocked||f||(E=this._maybeGetValueOrOverrideExpression(L,"FillColor"));const I=E??this._getValueOrOverrideExpression(_.type,z,"Color",h(_.color));let V=null;v.colorLocked||f||(V=this._maybeGetValueOrOverrideExpression(L,"StrokeColor"));const N=V??this._getValueOrOverrideExpression(v.type,x,"Color",h(v.color)),w=this._maybeGetValueOrOverrideExpression(L,"StrokeWidth")??this._getValueOrOverrideExpression(v.type,x,"Width",O(v.width,n.CIMSolidStroke.width)),R={type:"sprite-rasterization-param",resource:C?{type:"path",path:C,asFill:!0}:{type:"sdf",geom:u,asFill:!0},overrides:[]};this._cimLayers.push({type:"marker",spriteRasterizationParam:R,colorLocked:f,effects:r,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:s,anchorPoint:{x:M,y:P},isAbsoluteAnchorPoint:S,size:c,rotation:0,offsetX:0,offsetY:0,scaleX:1,transform:{type:"cim-marker-transform-param",params:p},frameHeight:c,widthRatio:b,rotateClockwise:!1,referenceSize:l,sizeRatio:k,color:I,outlineColor:N,outlineWidth:w,isOutline:d,markerPlacement:t,animatedSymbolProperties:i})}_setPoMap(e,r,t){let i;this._poMap[e]?i=this._poMap[e]:(i={},this._poMap[e]=i),i[r]=t}_maybeGetValueOrOverrideExpression(e,r,t){return this._getValueOrOverrideExpression("",e,r,t,!1)}_getValueOrOverrideExpression(e,r,t,i,o=!0){if(o&&!x(i)&&(i=_(e,t.toLowerCase())),null==r)return i;const a=this._poMap[r];if(null==a)return i;const s=a[t];return"string"==typeof s||"number"==typeof s||Array.isArray(s)?s:s?{valueExpressionInfo:s,defaultValue:i}:i}_analyzePrimitiveOverrides(e,r,t,i){if(null==e)return!1;"string"==typeof e&&(e=[e]);for(const o of this._primitiveOverrides)if(e.includes(o.primitiveName)&&o.valueExpressionInfo)return!0;if(null!=r)for(const o of r)if(o?.overrides.length>0)return!0;if(null!=t)for(const o of t)if(o?.overrides.length>0)return!0;if(null!=i)for(const o of i)if(o?.overrides.length>0)return!0;return!1}_getMaterialOverrides(e,r){if(!e)return[];const t=[];for(const i of e)t.push(...this._getPrimitiveMaterialOverrides(i,r));return t}_getPrimitiveMaterialOverrides(e,r){if(!e)return[];const t=this._normalizePrimitiveOverrideProps(this._primitiveOverrides.filter((r=>r.primitiveName===e)));return t.forEach((e=>e.defaultValue=_(r,e.propertyName.toLowerCase()))),t}_analyzeMaterialOverrides(e,r){return this._primitiveOverrides.filter((t=>t.primitiveName!==e||!r.includes(t.propertyName)))}_normalizePrimitiveOverrideProps(e){return e.map((e=>({...e,propertyName:L(e.propertyName)})))}}function R(e){if(e&&0===e.indexOf("Level_")){const r=parseInt(e.substr(6),10);if(!isNaN(r))return r}return 0}function A(e,r){if(!r||0===r.length)return e;const i=t(e);return c.applyOverrides(i,r),i}const G=e=>e&&2===e.length&&e[0].enable&&e[1].enable&&"CIMSolidStroke"===e[0].type&&"CIMSolidFill"===e[1].type&&null==e[0].path&&null==e[1].path&&!e[0].effects&&!e[1].effects;function X(e){const r=e.symbolLayers;if(!r||2!==r.length)return!1;const t=r.find((e=>e.effects?.find((e=>"CIMGeometricEffectDashes"===e.type)))),i=r.find((e=>e.effects?.find((e=>"CIMGeometricEffectAddControlPoints"===e.type))));return!!t||!!i}function F(e){return t(e).map((e=>({...e,propertyName:L(e.propertyName)})))}export{w as CIMAnalyzer,A as analyzeCIMResource};
|
|
5
|
+
import{isRGB as e}from"../../core/colorUtils.js";import{getFontFamily as r}from"../../core/fontUtils.js";import{clone as t}from"../../core/lang.js";import i from"../../core/Logger.js";import{pt2px as o,px2pt as a}from"../../core/screenUtils.js";import{numericHash as s}from"../../core/string.js";import{CIMSymbolHelper as l}from"./CIMSymbolHelper.js";import{defaultCIMValues as n}from"./defaultCIMValues.js";import{Alignment as p}from"./enums.js";import{OverrideHelper as c}from"./OverrideHelper.js";import{getExtent as m,getSDFMetrics as y}from"./SDFHelper.js";import{colorToArray as f,normalizeAlpha as h,getSize as d,isCIMMarkerStrokePlacement as u,getTintColor as v,getValue as O,getDefaultCIMValue as _,getEnum as g,getFillColor as S,getStrokeColor as k,getStrokeWidth as M,fromCIMFontDecoration as P,fromCIMFontStyle as b,fromCIMHorizontalAlignment as C,fromCIMVerticalAlignment as z,isValidCIMValue as x,uncapitalize as L}from"./utils.js";import{CIMEffectHelper as E}from"./effects/CIMEffectHelper.js";import{randomInsidePolygonTextureSize as I}from"../../views/2d/engine/webgl/definitions.js";const V=()=>i.getLogger("esri.symbols.cim.cimAnalyzer");function N(e){const r=e.markerPlacement;return r&&r.angleToLine?p.MAP:p.SCREEN}class w{constructor(e){this._cimLayers=[],this._poMap={},this._primitiveOverrides=[],e&&(this._resourceManager=e)}analyzeSymbolReference(r,t,i){if(this._cimLayers=i??[],!r)return this._cimLayers;if(this._reset(),r.primitiveOverrides){this._primitiveOverrides=r.primitiveOverrides;for(const r of this._primitiveOverrides){const t=r.valueExpressionInfo;if(t)this._setPoMap(r.primitiveName,r.propertyName,t);else if(null!=r.value){let t=r.value;r.propertyName.includes("Color")&&(e(t)&&(t=f(t)),t=h(t)),this._setPoMap(r.primitiveName,r.propertyName,t)}}}return this._analyzeSymbol(r.symbol,t),this._cimLayers}_reset(){this._cimLayers=[],this._poMap={},this._primitiveOverrides=[]}_analyzeSymbol(e,r){switch(e?.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":this._analyzeMultiLayerSymbol(e,r)}}_analyzeMultiLayerSymbol(e,r){const t=e?.symbolLayers;if(!t)return;const i=e.effects;let o=p.SCREEN;const a=d(e)??0;"CIMPointSymbol"===e.type&&"Map"===e.angleAlignment&&(o=p.MAP);const s="CIMPolygonSymbol"===e.type;let l=t.length;for(;l--;){const n=t[l];if(!n||!1===n.enable)continue;let p;i?.length&&(p=[...i]);const m=n.effects;m?.length&&(i?p.push(...m):p=[...m]);let y=null;if(p){y=[];for(const e of p){const r=c.findEffectOverrides(e,this._primitiveOverrides);r&&y.push(r)}}const f=[];switch(c.findApplicableOverrides(n,this._primitiveOverrides,f),n.type){case"CIMSolidFill":this._analyzeSolidFill(n,y);break;case"CIMPictureFill":this._analyzePictureFill(n,y);break;case"CIMHatchFill":this._analyzeHatchFill(n,y);break;case"CIMGradientFill":this._analyzeGradientFill(n,y);break;case"CIMSolidStroke":this._analyzeSolidStroke(n,y,s,a);break;case"CIMPictureStroke":this._analyzePictureStroke(n,y,s,a);break;case"CIMGradientStroke":this._analyzeGradientStroke(n,y,s,a);break;case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":{"CIMLineSymbol"!==e.type&&"CIMPolygonSymbol"!==e.type||(o=N(n));const t=[],i=n.primitiveName;i&&t.push(i);const l=s&&u(n.markerPlacement);this._analyzeMarker(n,y,null,t,o,a,r,[],!1,l);break}default:V().error("Cannot analyze CIM layer",n.type)}}}_analyzeSolidFill(e,r){const{primitiveName:t,type:i}=e,o=h(e.color);this._cimLayers.push({type:"fill",spriteRasterizationParam:null,colorLocked:!!e.colorLocked,color:this._getValueOrOverrideExpression(i,t,"Color",o),height:0,angle:0,offsetX:0,offsetY:0,scaleX:1,effects:r,applyRandomOffset:!1,sampleAlphaOnly:!0,hasUnresolvedReplacementColor:!1})}_analyzePictureFill(e,r){const{primitiveName:t,type:i}=e,o=v(e),a=O(e.height,n.CIMPictureFill.height);let s=O(e.scaleX,1);if("width"in e&&"number"==typeof e.width){const r=e.width;let t=1;const i=this._resourceManager.getResource(e.url);null!=i&&(t=i.width/i.height),s/=t*(a/r)}const l={type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(t,i)};this._cimLayers.push({type:"fill",spriteRasterizationParam:l,colorLocked:!!e.colorLocked,effects:r,color:this._getValueOrOverrideExpression(i,t,"TintColor",o),height:this._getValueOrOverrideExpression(i,t,"Height",a),scaleX:this._getValueOrOverrideExpression(i,t,"ScaleX",s),angle:this._getValueOrOverrideExpression(i,t,"Rotation",O(e.rotation)),offsetX:this._getValueOrOverrideExpression(i,t,"OffsetX",O(e.offsetX)),offsetY:this._getValueOrOverrideExpression(i,t,"OffsetY",O(e.offsetY)),applyRandomOffset:!1,sampleAlphaOnly:!1,hasUnresolvedReplacementColor:!1})}_analyzeHatchFill(e,r){const{primitiveName:t,type:i}=e,o=this._analyzeMaterialOverrides(t,["Rotation","OffsetX","OffsetY"]),a=this._normalizePrimitiveOverrideProps(o);let s=[255,255,255,1],l=!1;if(e.lineSymbol?.symbolLayers)for(const n of e.lineSymbol.symbolLayers){if("CIMSolidStroke"!==n.type)continue;const e=n.primitiveName??t;l||!e||n.colorLocked||null==this._poMap[e]?.Color&&null==this._poMap[e]?.StrokeColor||(s=h(n.color),s=this._maybeGetValueOrOverrideExpression(e,"StrokeColor")??this._getValueOrOverrideExpression(i,e,"Color",s),l=!0);const r=this._maybeGetValueOrOverrideExpression(e,"StrokeWidth");if(r){let t=null,o=null;"number"==typeof r?t=r:o=r.valueExpressionInfo;let s=a.find((e=>"strokeWidth"===e.propertyName));s?s.propertyName="width":(s={type:"CIMPrimitiveOverride",primitiveName:e,propertyName:"width",valueExpressionInfo:o,value:t,defaultValue:_(i,"width")},a.push(s))}}const p={type:"sprite-rasterization-param",resource:e,overrides:a};this._cimLayers.push({type:"fill",spriteRasterizationParam:p,colorLocked:!!e.colorLocked,effects:r,color:s,height:this._getValueOrOverrideExpression(i,t,"Separation",O(e.separation,n.CIMHatchFill.separation)),scaleX:1,angle:this._getValueOrOverrideExpression(i,t,"Rotation",O(e.rotation)),offsetX:this._getValueOrOverrideExpression(i,t,"OffsetX",O(e.offsetX)),offsetY:this._getValueOrOverrideExpression(i,t,"OffsetY",O(e.offsetY)),applyRandomOffset:!1,sampleAlphaOnly:!0,hasUnresolvedReplacementColor:!l})}_analyzeGradientFill(e,r){this._cimLayers.push({type:"fill",spriteRasterizationParam:null,colorLocked:!!e.colorLocked,effects:r,color:[128,128,128,1],height:0,angle:0,offsetX:0,offsetY:0,scaleX:1,applyRandomOffset:!1,sampleAlphaOnly:!1,hasUnresolvedReplacementColor:!1})}_analyzeSolidStroke(e,r,t,i){const{primitiveName:o,type:a}=e,s=h(e.color),l=O(e.width,n.CIMSolidStroke.width),p=g(e.capStyle,n.CIMSolidStroke.capstyle),c=g(e.joinStyle,n.CIMSolidStroke.joinstyle),m=e.miterLimit;let y,f,d=[];if(this._analyzePrimitiveOverrides(o,r,null,null)&&(d=this._getPrimitiveMaterialOverrides(o,a)),r&&r instanceof Array&&r.length>0){const e=r[r.length-1].effect;e&&"CIMGeometricEffectDashes"===e.type&&"NoConstraint"===e.lineDashEnding&&null===e.offsetAlongLine&&(y=e.dashTemplate,f=e.scaleDash,(r=[...r]).pop())}const u=void 0!==y?{type:"sprite-rasterization-param",resource:{type:"dash",dashTemplate:y,capStyle:p},overrides:d}:null;this._cimLayers.push({type:"line",spriteRasterizationParam:u,isOutline:t,colorLocked:!!e.colorLocked,effects:r,color:this._getValueOrOverrideExpression(a,o,"Color",s),width:this._getValueOrOverrideExpression(a,o,"Width",l),cap:this._getValueOrOverrideExpression(a,o,"CapStyle",p),join:this._getValueOrOverrideExpression(a,o,"JoinStyle",c),miterLimit:m&&this._getValueOrOverrideExpression(a,o,"MiterLimit",m),referenceWidth:i,zOrder:R(e.name),dashTemplate:y,scaleDash:f,sampleAlphaOnly:!0})}_analyzePictureStroke(e,r,t,i){const{primitiveName:o,type:a}=e,s=v(e),l=O(e.width,n.CIMPictureStroke.width),p=g(e.capStyle,n.CIMPictureStroke.capstyle),c=g(e.joinStyle,n.CIMPictureStroke.joinstyle),m=e.miterLimit,y={type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(o,a)};this._cimLayers.push({type:"line",spriteRasterizationParam:y,isOutline:t,colorLocked:!!e.colorLocked,effects:r,color:this._getValueOrOverrideExpression(a,o,"TintColor",s),width:this._getValueOrOverrideExpression(a,o,"Width",l),cap:this._getValueOrOverrideExpression(a,o,"CapStyle",p),join:this._getValueOrOverrideExpression(a,o,"JoinStyle",c),miterLimit:m&&this._getValueOrOverrideExpression(a,o,"MiterLimit",m),referenceWidth:i,zOrder:R(e.name),dashTemplate:null,scaleDash:!1,sampleAlphaOnly:!1})}_analyzeGradientStroke(e,r,t,i){const{primitiveName:o,type:a}=e,s=O(e.width,n.CIMSolidStroke.width),l=g(e.capStyle,n.CIMGradientStroke.capstyle),p=g(e.joinStyle,n.CIMGradientStroke.joinstyle),c=e.miterLimit;this._cimLayers.push({type:"line",spriteRasterizationParam:null,isOutline:t,colorLocked:!!e.colorLocked,effects:r,color:[128,128,128,1],width:this._getValueOrOverrideExpression(a,o,"Width",s),cap:this._getValueOrOverrideExpression(a,o,"CapStyle",l),join:this._getValueOrOverrideExpression(a,o,"JoinStyle",p),miterLimit:c&&this._getValueOrOverrideExpression(a,o,"MiterLimit",c),referenceWidth:i,zOrder:R(e.name),dashTemplate:null,scaleDash:!1,sampleAlphaOnly:!1})}_analyzeMarker(e,r,t,i,o,a,s,l,p=!1,c=!1){if(p||=!!e.colorLocked,this._analyzeMarkerInsidePolygon(e,r,p))return;const m=O(e.size,n.CIMVectorMarker.size),y=O(e.rotation),f=O(e.offsetX),h=O(e.offsetY),{primitiveName:d,type:u}=e,v=this._getValueOrOverrideExpression(u,d,"Size",m),_=this._getValueOrOverrideExpression(u,d,"Rotation",y),g=this._getValueOrOverrideExpression(u,d,"OffsetX",f),S=this._getValueOrOverrideExpression(u,d,"OffsetY",h);switch(e.type){case"CIMPictureMarker":this._analyzePictureMarker(e,r,t,i,o,a,v,_,g,S,l,p,c);break;case"CIMVectorMarker":this._analyzeVectorMarker(e,r,t,i,o,a,v,_,g,S,l,s,p,c)}}_analyzeMarkerInsidePolygon(e,r,t){const{markerPlacement:i,type:o}=e;if(!i||"CIMMarkerPlacementInsidePolygon"!==i.type)return!1;if("CIMVectorMarker"===o||"CIMPictureMarker"===o){const t=e.primitiveName;if(t&&this._analyzePrimitiveOverrides([t],r,null,null))return!1;const a=i.primitiveName;if(a&&this._analyzePrimitiveOverrides([a],r,null,null))return!1;if("CIMVectorMarker"===o){const{markerGraphics:r}=e;if(r)for(const e of r){const{symbol:r}=e;if("CIMPolygonSymbol"===r?.type&&r.symbolLayers){const{symbolLayers:e}=r;for(const r of e)if("CIMSolidStroke"===r.type)return!1}}}else{const{animatedSymbolProperties:r}=e;if(r)return!1}}const s=Math.abs(i.stepX),l=Math.abs(i.stepY);if(0===s||0===l)return!0;let n,p;if("Random"===i.gridType){const e=a(I),r=Math.max(Math.floor(e/s),1);n=l*Math.max(Math.floor(e/l),1);p=r*s/n}else i.shiftOddRows?(n=2*l,p=s/l*.5):(n=l,p=s/l);const c=v(e),m="CIMCharacterMarker"===e.type?null:{type:"sprite-rasterization-param",resource:e,overrides:[]};return this._cimLayers.push({type:"fill",spriteRasterizationParam:m,colorLocked:t,effects:r,color:c,height:n,scaleX:p,angle:i.gridAngle,offsetX:O(i.offsetX),offsetY:O(i.offsetY),applyRandomOffset:"Random"===i.gridType,sampleAlphaOnly:"CIMPictureMarker"!==e.type,hasUnresolvedReplacementColor:!0}),!0}_analyzePictureMarker(e,r,i,o,a,l,n,p,c,m,y,f,h){const{primitiveName:d,type:u}=e;let _=O(e.scaleX,1);const g=v(e);i||(i=this._createMarkerPlacementOverrideExpression(e.markerPlacement));const S=this._createAnimatedSymbolPropertiesOverrideExpression(e.animatedSymbolProperties),k=e.anchorPoint??{x:0,y:0};if("width"in e&&"number"==typeof e.width){const r=e.width;let t=1;const i=this._resourceManager.getResource(e.url);null!=i&&(t=i.width/i.height);_/=t*(O(e.size)/r)}const M=[...o];let P;e.primitiveName&&M.push(e.primitiveName),e.animatedSymbolProperties||S?P={type:"animated",url:e.url,urlHash:"H"+s(e.url),playAnimation:e.animatedSymbolProperties?.playAnimation,reverseAnimation:e.animatedSymbolProperties?.reverseAnimation,randomizeStartTime:e.animatedSymbolProperties?.randomizeStartTime,randomizeStartSeed:e.animatedSymbolProperties?.randomizeStartSeed,startTimeOffset:e.animatedSymbolProperties?.startTimeOffset,duration:e.animatedSymbolProperties?.duration,repeatType:e.animatedSymbolProperties?.repeatType,repeatDelay:e.animatedSymbolProperties?.repeatDelay}:(P=t(e),P.markerPlacement=null);const b={type:"sprite-rasterization-param",resource:P,overrides:this._getMaterialOverrides(M,u)};S&&b.overrides.push(...S.overrides),this._cimLayers.push({type:"marker",spriteRasterizationParam:b,colorLocked:f,effects:r,scaleSymbolsProportionally:!1,alignment:a,size:n,scaleX:this._getValueOrOverrideExpression(u,d,"ScaleX",_),rotation:p,offsetX:c,offsetY:m,transform:{type:"cim-marker-transform-param",params:y},color:this._getValueOrOverrideExpression(u,d,"TintColor",g),anchorPoint:{x:k.x,y:k.y},isAbsoluteAnchorPoint:"Relative"!==e.anchorPointUnits,outlineColor:[0,0,0,0],outlineWidth:0,frameHeight:0,widthRatio:1,rotateClockwise:!!e.rotateClockwise,referenceSize:l,sizeRatio:1,isOutline:h,markerPlacement:i,animatedSymbolProperties:S})}_analyzeVectorMarker(e,r,t,i,o,a,s,l,n,p,c,m,y,f){const h=e.markerGraphics;if(!h)return;const d=e.frame;let u=0;if(u=d?d.ymax-d.ymin:a,u){const r={offsetX:n,offsetY:p,rotation:l,size:s,frameHeight:u,rotateClockWise:!!e.rotateClockwise};c=[...c,r]}t||(t=this._createMarkerPlacementOverrideExpression(e.markerPlacement));for(const v of h)if(v){const s=v.symbol;if(!s)continue;const l=v.primitiveName;let n;if(l&&i.push(l),("CIMPointSymbol"===s.type||"CIMTextSymbol"===s.type)&&d){let r=0,t=0;const i=v.geometry;"x"in i&&"y"in i&&(r+=i.x-.5*(d.xmin+d.xmax),t+=i.y-.5*(d.ymin+d.ymax));const o=e.anchorPoint;o&&("Absolute"===e.anchorPointUnits?(r-=o.x,t-=o.y):d&&(r-=(d.xmax-d.xmin)*o.x,t-=(d.ymax-d.ymin)*o.y));const a={offsetX:r,offsetY:t,rotation:0,size:0,frameHeight:0,rotateClockWise:!1};n=[...c,a]}switch(s.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":m||X(s)?this._analyzeMultiLayerGraphicNonSDF(e,r,t,null,v,i,o,a,n??c,u,y,f):this._analyzeMultiLayerGraphic(e,r,t,null,v,i,o,a,n??c,u,y,f);break;case"CIMTextSymbol":this._analyzeTextGraphic(r,t,v,i,o,a,n??c,y)}l&&i.pop()}}_analyzeMultiLayerGraphic(e,r,t,i,o,a,s,l,n,p,c,f){const d=o.symbol,u=d.symbolLayers;if(!u)return;let v=u.length;if(G(u))return void this._analyzeCompositeMarkerGraphic(e,r,t,i,o,u,s,l,n,p,c,f);const O=this._resourceManager.geometryEngine,_=E.applyEffects(d.effects,o.geometry,O);if(_)for(;v--;){const d=u[v];if(!d||!1===d.enable)continue;const g=d.primitiveName;switch(g&&a.push(g),d.type){case"CIMSolidFill":case"CIMSolidStroke":{const a=E.applyEffects(d.effects,_,O),u=m(a);if(!u)continue;const v="Relative"!==e.anchorPointUnits,[P,b,C,z]=y(u,e.frame,e.size,e.anchorPoint,v),x="CIMSolidFill"===d.type,L={type:"sdf",geom:a,asFill:x},{path:I}=d,V=x?h(S(d)):null==I?h(k(d)):[0,0,0,0],N=x?[0,0,0,0]:h(k(d)),w=M(d)??0;if(!x&&!w)break;const R=o.primitiveName;let A=null;x&&!d.colorLocked&&(A=this._maybeGetValueOrOverrideExpression(R,"FillColor"));let G=null;x||d.colorLocked||(G=this._maybeGetValueOrOverrideExpression(R,"StrokeColor"));const X=A??this._getValueOrOverrideExpression(d.type,g,"Color",V),F=G??this._getValueOrOverrideExpression(d.type,g,"Color",N),T=this._maybeGetValueOrOverrideExpression(R,"StrokeWidth")??this._getValueOrOverrideExpression(d.type,g,"Width",w),Y=I?{type:"sprite-rasterization-param",resource:{type:"path",path:I,asFill:x},overrides:[]}:{type:"sprite-rasterization-param",resource:L,overrides:[]};this._cimLayers.push({type:"marker",spriteRasterizationParam:Y,colorLocked:!!d.colorLocked||!!c,effects:r,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:s,anchorPoint:{x:b,y:C},isAbsoluteAnchorPoint:v,size:p,rotation:0,offsetX:0,offsetY:0,scaleX:1,transform:{type:"cim-marker-transform-param",params:n},frameHeight:p,widthRatio:z,rotateClockwise:!1,referenceSize:l,sizeRatio:P,color:X,outlineColor:F,outlineWidth:T,isOutline:f,markerPlacement:t,animatedSymbolProperties:i});break}case"CIMPictureMarker":case"CIMVectorMarker":d.markerPlacement?this._analyzeMultiLayerGraphicNonSDF(e,r,t,i,o,a,s,l,n,p,!!d.colorLocked||!!c,f):this._analyzeMarker(d,r,t,a,s,l,!1,n,c,f);break;default:this._analyzeMultiLayerGraphicNonSDF(e,r,t,i,o,a,s,l,n,p,!!d.colorLocked||!!c,f)}g&&a.pop()}}_analyzeTextGraphic(e,t,i,o,a,s,l,p){const m=[];c.findApplicableOverrides(i,this._primitiveOverrides,m);const y=i.geometry;if(!("x"in y)||!("y"in y))return;const f=i.symbol,d=P(f),u=b(f.fontStyleName),v=r(f.fontFamilyName);f.font={family:v,decoration:d,...u};const _=O(f.height,n.CIMTextSymbol.height),g=O(f.angle),x=O(f.offsetX),L=O(f.offsetY),E=h(S(f));let I=h(k(f)),V=M(f)??0;V||(I=h(S(f.haloSymbol)),V=O(f.haloSize));let N=!1;if(f.symbol?.symbolLayers)for(const r of f.symbol.symbolLayers){null!=h(S(r))&&(N=!!r.colorLocked)}const w=i.primitiveName;let R=null;N||(R=this._maybeGetValueOrOverrideExpression(w,"FillColor"));const A=this._maybeGetValueOrOverrideExpression(w,"TextSize"),G=this._maybeGetValueOrOverrideExpression(w,"TextAngle"),X=this._maybeGetValueOrOverrideExpression(w,"TextOffsetX"),F=this._maybeGetValueOrOverrideExpression(w,"TextOffsetY");let T=null,Y=null,j=0;if(f.callout&&"CIMBackgroundCallout"===f.callout.type){const e=f.callout;if(e.backgroundSymbol){const r=e.backgroundSymbol.symbolLayers;if(r)for(const e of r)"CIMSolidFill"===e.type?T=h(e.color):"CIMSolidStroke"===e.type&&(Y=h(e.color),j=O(e.width,n.CIMSolidStroke.width))}}const W=this._getValueOrOverrideExpression(f.type,i.primitiveName,"TextString",i.textString??"");if(null==W)return;const{fontStyleName:D}=f,H=v+(D?"-"+D.toLowerCase():"-regular"),U=this._getMaterialOverrides(o,f.type);U.push(...this._getPrimitiveMaterialOverrides(i.primitiveName,f.type));const J={type:"text-rasterization-param",resource:{type:"text",textString:i.textString??"",font:f.font,symbol:f,primitiveName:i.primitiveName},overrides:U};this._cimLayers.push({type:"text",lineWidth:null,textRasterizationParam:J,colorLocked:!!p||!!N,effects:e,alignment:a,anchorPoint:{x:0,y:0},isAbsoluteAnchorPoint:!1,fontName:H,decoration:d,weight:u.weight,style:u.style,size:A??_,angle:G??g,offsetX:X??x,offsetY:F??L,transform:{type:"cim-marker-transform-param",params:l},horizontalAlignment:C(f.horizontalAlignment),verticalAlignment:z(f.verticalAlignment),text:W,color:R??this._getValueOrOverrideExpression(f.type,i.primitiveName,"Color",E),outlineColor:I,outlineSize:V,backgroundColor:T,borderLineColor:Y,borderLineWidth:j,referenceSize:s,sizeRatio:1,markerPlacement:t})}_analyzeMultiLayerGraphicNonSDF(e,r,t,i,a,s,n,p,c,m,y,f){const h=this._buildSimpleMarker(e,a),d=e.primitiveName,u=this._analyzeMaterialOverrides(d,["Rotation","OffsetX","OffsetY"]),v=this._normalizePrimitiveOverrideProps(u),[O,_,g]=l.getTextureAnchor(h,this._resourceManager),S=this._getMaterialOverrides(s,e.type);S.push(...v);const k={type:"sprite-rasterization-param",resource:{...h,avoidSDFRasterization:!0},overrides:S};this._cimLayers.push({type:"marker",spriteRasterizationParam:k,colorLocked:y,effects:r,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:n,anchorPoint:{x:O,y:_},isAbsoluteAnchorPoint:!1,size:m,rotation:0,offsetX:0,offsetY:0,transform:{type:"cim-marker-transform-param",params:c},color:[255,255,255,1],outlineColor:[0,0,0,0],outlineWidth:0,scaleX:1,frameHeight:m,widthRatio:1,rotateClockwise:!!e.rotateClockwise,referenceSize:p,sizeRatio:g/o(e.size),isOutline:f,markerPlacement:t,animatedSymbolProperties:i})}_createMarkerPlacementOverrideExpression(e){if(!e)return null;const r=[];return c.findApplicableOverrides(e,this._primitiveOverrides,r),{type:"cim-marker-placement-info",placement:e,overrides:F(r)}}_createAnimatedSymbolPropertiesOverrideExpression(e){if(!e)return null;const r=[];return c.findApplicableOverrides(e,this._primitiveOverrides,r),{type:"cim-animation-info",animation:e,overrides:F(r)}}_buildSimpleMarker(e,r){return{type:e.type,enable:!0,name:e.name,colorLocked:e.colorLocked,primitiveName:e.primitiveName,anchorPoint:e.anchorPoint,anchorPointUnits:e.anchorPointUnits,offsetX:0,offsetY:0,rotateClockwise:e.rotateClockwise,rotation:0,size:e.size,billboardMode3D:e.billboardMode3D,depth3D:e.depth3D,frame:e.frame,markerGraphics:[r],scaleSymbolsProportionally:e.scaleSymbolsProportionally,respectFrame:e.respectFrame,clippingPath:e.clippingPath}}_analyzeCompositeMarkerGraphic(e,r,t,i,o,a,s,l,p,c,f,d){const u=o.geometry,v=a[0],_=a[1],g=m(u);if(!g)return;const S="Relative"!==e.anchorPointUnits,[k,M,P,b]=y(g,e.frame,e.size,e.anchorPoint,S),{path:C}=_,z=_.primitiveName,x=v.primitiveName,L=o.primitiveName;let E=null;_.colorLocked||f||(E=this._maybeGetValueOrOverrideExpression(L,"FillColor"));const I=E??this._getValueOrOverrideExpression(_.type,z,"Color",h(_.color));let V=null;v.colorLocked||f||(V=this._maybeGetValueOrOverrideExpression(L,"StrokeColor"));const N=V??this._getValueOrOverrideExpression(v.type,x,"Color",h(v.color)),w=this._maybeGetValueOrOverrideExpression(L,"StrokeWidth")??this._getValueOrOverrideExpression(v.type,x,"Width",O(v.width,n.CIMSolidStroke.width)),R={type:"sprite-rasterization-param",resource:C?{type:"path",path:C,asFill:!0}:{type:"sdf",geom:u,asFill:!0},overrides:[]};this._cimLayers.push({type:"marker",spriteRasterizationParam:R,colorLocked:f,effects:r,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:s,anchorPoint:{x:M,y:P},isAbsoluteAnchorPoint:S,size:c,rotation:0,offsetX:0,offsetY:0,scaleX:1,transform:{type:"cim-marker-transform-param",params:p},frameHeight:c,widthRatio:b,rotateClockwise:!1,referenceSize:l,sizeRatio:k,color:I,outlineColor:N,outlineWidth:w,isOutline:d,markerPlacement:t,animatedSymbolProperties:i})}_setPoMap(e,r,t){let i;this._poMap[e]?i=this._poMap[e]:(i={},this._poMap[e]=i),i[r]=t}_maybeGetValueOrOverrideExpression(e,r,t){return this._getValueOrOverrideExpression("",e,r,t,!1)}_getValueOrOverrideExpression(e,r,t,i,o=!0){if(o&&!x(i)&&(i=_(e,t.toLowerCase())),null==r)return i;const a=this._poMap[r];if(null==a)return i;const s=a[t];return"string"==typeof s||"number"==typeof s||Array.isArray(s)?s:s?{valueExpressionInfo:s,defaultValue:i}:i}_analyzePrimitiveOverrides(e,r,t,i){if(null==e)return!1;"string"==typeof e&&(e=[e]);for(const o of this._primitiveOverrides)if(e.includes(o.primitiveName)&&o.valueExpressionInfo)return!0;if(null!=r)for(const o of r)if(o?.overrides.length>0)return!0;if(null!=t)for(const o of t)if(o?.overrides.length>0)return!0;if(null!=i)for(const o of i)if(o?.overrides.length>0)return!0;return!1}_getMaterialOverrides(e,r){if(!e)return[];const t=[];for(const i of e)t.push(...this._getPrimitiveMaterialOverrides(i,r));return t}_getPrimitiveMaterialOverrides(e,r){if(!e)return[];const t=this._normalizePrimitiveOverrideProps(this._primitiveOverrides.filter((r=>r.primitiveName===e)));return t.forEach((e=>e.defaultValue=_(r,e.propertyName.toLowerCase()))),t}_analyzeMaterialOverrides(e,r){return this._primitiveOverrides.filter((t=>t.primitiveName!==e||!r.includes(t.propertyName)))}_normalizePrimitiveOverrideProps(e){return e.map((e=>({...e,propertyName:L(e.propertyName)})))}}function R(e){if(e&&0===e.indexOf("Level_")){const r=parseInt(e.substr(6),10);if(!isNaN(r))return r}return 0}function A(e,r){if(!r||0===r.length)return e;const i=t(e);return c.applyOverrides(i,r),i}const G=e=>e&&2===e.length&&e[0].enable&&e[1].enable&&"CIMSolidStroke"===e[0].type&&"CIMSolidFill"===e[1].type&&null==e[0].path&&null==e[1].path&&!e[0].effects&&!e[1].effects;function X(e){const r=e.symbolLayers;if(!r||2!==r.length)return!1;const t=r.find((e=>e.effects?.find((e=>"CIMGeometricEffectDashes"===e.type&&null!=e.dashTemplate)))),i=r.find((e=>e.effects?.find((e=>"CIMGeometricEffectAddControlPoints"===e.type))));return!!t||!!i}function F(e){return t(e).map((e=>({...e,propertyName:L(e.propertyName)})))}export{w as CIMAnalyzer,A as analyzeCIMResource};
|
|
@@ -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"../../../core/has.js";import e from"../../../core/Logger.js";function r(r,n,t){if(null==r)return null;const u=n.readArcadeFeature();n.contextTimeZone=t.$view?.timeZone;try{return r.evaluate({...t,$feature:u},r.services)}catch(a){return e.getLogger("esri.views.2d.support.arcadeOnDemand").warn("Feature arcade evaluation failed:",a),null}}function n(e){return null==e||e===1/0||e===-1/0||"number"==typeof e&&isNaN(e)}function t(e,r,t,u){if(null==e)return null!=u?u:null;const a=r.readArcadeFeature()
|
|
5
|
+
import"../../../core/has.js";import e from"../../../core/Logger.js";function r(r,n,t){if(null==r)return null;const u=n.readArcadeFeature();n.contextTimeZone=t.$view?.timeZone;try{return r.evaluate({...t,$feature:u},r.services)}catch(a){return e.getLogger("esri.views.2d.support.arcadeOnDemand").warn("Feature arcade evaluation failed:",a),null}}function n(e){return null==e||e===1/0||e===-1/0||"number"==typeof e&&isNaN(e)}function t(e,r,t,u){if(null==e)return null!=u?u:null;const a=r.readArcadeFeature();r.contextTimeZone=t.$view?.timeZone;const o=e.evaluate({...t,$feature:a},e.services);return n(o)?null!=u?u:null:o}export{r as callExpressionWithCursor,t as callExpressionWithCursorWithDefault,n as isBadArcadeResult};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import has from"../../../../../core/has.js";import{filterFlag0 as e,effectFlag0 as t}from"../definitions.js";import{CollisionBitsetGrid as o,none as i,hasCollision as n,outsideExtent as
|
|
5
|
+
import has from"../../../../../core/has.js";import{filterFlag0 as e,effectFlag0 as t}from"../definitions.js";import{CollisionBitsetGrid as o,none as i,hasCollision as n,outsideExtent as l}from"./CollisionGrid.js";const s=254,r=255,c=0;function a(e,t){const o=e.children.slice();o.sort(((e,t)=>e.tileAge-t.tileAge)),o.forEach((e=>{null!=e.labelMetrics&&e.isReady&&t(e,e.labelMetrics)}))}function f(e,t){return(!e.minScale||e.minScale>=t)&&(!e.maxScale||e.maxScale<=t)}class d{run(e,t,o,i){const n=[];for(let l=e.length-1;l>=0;l--){const t=e[l];t.labelingCollisionInfos?.length&&n.push(...t.labelingCollisionInfos)}has("esri-2d-update-debug")&&n.length&&console.debug("CollisionEngine.run"),this._transformMetrics(n),this._runCollision(n,t,o,i);for(const l of n)l.container.requestRender()}_runCollision(e,t,i,n){const[l,d]=t.state.size,u=new o(l,d,t.pixelRatio);for(const{container:o,deconflictionEnabled:b,visible:h}of e){const e=o.attributeView;b?h?(this._prepare(o),this._collideVisible(u,o,i,n),this._collideInvisible(u,o)):a(o,((t,o)=>{for(const i of o)e.setLabelMinZoom(i.entityTexel,r)})):a(o,((t,o)=>{for(const n of o)f(n,i)?(e.setLabelMinZoom(n.entityTexel,c),h&&u.insertMetrics(n)):e.setLabelMinZoom(n.entityTexel,s)}))}}_isFiltered(o,i,n){const l=i.getFilterFlags(o),s=!n.hasFilter||!!(l&e),r=null==n.featureEffect||n.featureEffect.excludedLabelsVisible||!!(l&t);return!(s&&r)}_prepare(e){const t=e.attributeView,o=new Set;a(e,((i,n)=>{for(const l of n){const i=l.entityTexel;if(o.has(i))continue;if(o.add(i),this._isFiltered(i,t,e.layerView)){t.setLabelMinZoom(i,s);continue}t.getLabelMinZoom(i)!==c?t.setLabelMinZoom(i,r):t.setLabelMinZoom(i,c)}}))}_collideVisible(e,t,o,r){const d=t.attributeView,u=new Set;a(t,((t,a)=>{for(let b=0;b<a.length;b++){const h=a[b].entityTexel;if(u.has(h))continue;if(t.key.level!==r){d.setLabelMinZoom(h,s),u.add(h);continue}if(!f(a[b],o)){d.setLabelMinZoom(h,s),u.add(h);continue}if(0!==d.getLabelMinZoom(h)){u.add(h);continue}let m=!1,M=!0;const g=b;let p=b;for(;p<a.length;p++){const t=a[p];if(t.entityTexel!==h)break;if(m)continue;switch(e.hasCollision(t)){case l:break;case n:m=!0,M=!1;break;case i:M=!1}}if(!m)for(let t=g;t<p;t++)e.insertMetrics(a[t]);b=p-1,M||(u.add(h),d.setLabelMinZoom(h,m?s:c))}}))}_collideInvisible(e,t){const o=t.attributeView,s=new Set;a(t,((t,a)=>{for(let f=0;f<a.length;f++){const t=a[f].entityTexel;if(s.has(t))continue;if(o.getLabelMinZoom(t)!==r){s.add(t);continue}let d=!1,u=!0;const b=f;let h=f;for(;h<a.length;h++){const o=a[h];if(o.entityTexel!==t)break;if(d)continue;switch(e.hasCollision(o)){case l:break;case n:d=!0,u=!1;break;case i:u=!1}}if(!d)for(let o=b;o<h;o++)e.insertMetrics(a[o]);f=h-1,u||(s.add(t),o.setLabelMinZoom(t,d?r:c))}}))}_transformMetrics(e){for(const{container:t,geometryType:o,vvEvaluators:i}of e)a(t,((e,n)=>{const l=t.attributeView,s=e.transforms.labelMat2d;s[4]=Math.round(s[4]),s[5]=Math.round(s[5]);const r="polyline"===o;for(const t of n){const{entityTexel:e,anchorX:o,anchorY:n}=t;let c=t.referenceBounds?.size??0;const a=i[0];if(null!=a){const t=a(l.getVVSize(e));c=isNaN(t)||null==t||t===1/0?c:t}const f=t.directionX*(c/2),d=t.directionY*(c/2);for(const i of t.bounds){let e=o,t=n;if(r){let o=e+i.x+f,n=t+i.y+d;o=s[0]*o+s[2]*n+s[4],n=s[1]*o+s[3]*n+s[5],i.computedX=Math.floor(o),i.computedY=Math.floor(n)}else{e=s[0]*o+s[2]*n+s[4],t=s[1]*o+s[3]*n+s[5];const l=e+i.x+f,r=t+i.y+d;i.computedX=l,i.computedY=r}}}}))}}export{d as CollisionEngine};
|
|
@@ -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{getJsonType as e}from"../../../../../../geometry/support/jsonUtils.js";import t from"../../../../../../layers/support/FieldsIndex.js";import{MeshData as r}from"../../mesh/MeshData.js";import{AResourceProxy as o}from"./mesh/AResourceProxy.js";import{createMeshWriterDirect as s}from"./mesh/createMeshWriter.js";import{ComputedAttributeStorage as n}from"../../../../layers/features/support/ComputedAttributeStorage.js";import{FeatureMetadata as m}from"../../../../layers/features/support/FeatureMetadata.js";import{FeatureSetReaderJSON as
|
|
5
|
+
import"../../../../../../geometry.js";import{getJsonType as e}from"../../../../../../geometry/support/jsonUtils.js";import t from"../../../../../../layers/support/FieldsIndex.js";import{MeshData as r}from"../../mesh/MeshData.js";import{AResourceProxy as o}from"./mesh/AResourceProxy.js";import{createMeshWriterDirect as s}from"./mesh/createMeshWriter.js";import{ComputedAttributeStorage as n}from"../../../../layers/features/support/ComputedAttributeStorage.js";import{FeatureMetadata as m}from"../../../../layers/features/support/FeatureMetadata.js";import{FeatureSetReaderJSON as i}from"../../../../layers/features/support/FeatureSetReaderJSON.js";import a from"../../../../../../geometry/SpatialReference.js";async function l(o){const l=new r("0.0.0.0"),p=new u,d={},c={fields:new t,spatialReference:a.WebMercator},f={$view:{scale:0,timeZone:null}},h=new n(c);for(const t of o){const r=await s(h,p,t.technique.meshWriter.constructor,t.instanceId,{params:t.meshParams},d);t.feature.displayId=t.feature.attributes.objectId;const o=i.fromFeatures([t.feature],new m({fields:[],objectIdField:"objectId",geometryType:e(t.feature.geometry),globalIdField:null,spatialReference:null,subtypeField:null,subtypes:null,timeInfo:null,typeIdField:null,types:null,timeReferenceUnknownClient:!1}));o.next(),l.entityStart(o.getDisplayId(),0),r.write(l,p,o,f,0),l.entityEnd()}return l.serialize().message}class u extends o{fetchDictionaryResourceImmediate(e){throw new Error("Method not implemented.")}fetchResourceImmediate(e){throw new Error("Method not implemented.")}enqueueRequest(e){throw new Error("Method not implemented.")}fetchEnqueuedResources(){throw new Error("Method not implemented.")}getResource(e){throw new Error("Method not implemented.")}}export{l as createTestMeshData};
|
|
@@ -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{isSome as e}from"../../../../../../../core/arrayUtils.js";import r from"../../../../../../../core/Error.js";import{clone as t}from"../../../../../../../core/lang.js";import s from"../../../../../../../core/Logger.js";import{getStartGroup as a}from"../../../grouping.js";import{applyComputedValue as o}from"./utils.js";import{DictionaryValue as i}from"../../../../../layers/features/support/DictionaryValue.js";const n=()=>s.getLogger("esri.views.2d.engine.webgl.shaderGraph.techniques.mesh.MeshWriterInputEvaluator");async function c(e,r,t=!1){const{defaultValue:s,valueExpressionInfo:a,value:o}=r;if(a){const{expression:o}=a,i=await e.createComputedField({expression:o},t);return i?{...r,computed:i,defaultValue:s}:null}return{...r,computed:new i(o),defaultValue:s}}async function m(e,r){const{defaultValue:t,valueExpressionInfo:s}=r,{expression:a}=s,o=await e.createComputedField({expression:a});return o?{...r,computed:o,defaultValue:t}:null}const p=e=>"boolean"!=typeof e&&"number"!=typeof e&&"valueExpressionInfo"in e,f=e=>e.some((e=>{for(const r in e){const t=e[r];if(p(t))return!0}return!1}));class l{static async create(r,t,s){const a={},o=new Map,i=new Map,n=new Map,u=new Map,d=new Map;for(const l in s.params){const h=s.params[l];if(null!=h&&"object"==typeof h)if(Array.isArray(h)){if("object"==typeof h[0])throw new Error(`InternalError: Cannot handle ${l}. Nested array params are not supported`);a[l]=h}else if("valueExpressionInfo"in h){if(h.value){a[l]=h.value;continue}const e=await m(r,h);if(!e){a[l]=h.defaultValue;continue}o.set(l,e),a[l]=null}else switch(h.type){case"cim-effect-infos":if(h.effectInfos.some((e=>e.overrides.length))){i.set(l,{effects:await Promise.all(h.effectInfos.map((async t=>{const s=t.overrides.map((e=>c(r,e)));return{effect:t.effect,compiledOverrides:(await Promise.all(s)).filter(e)}})))});break}a[l]=h.effectInfos.map((e=>e.effect));break;case"cim-marker-placement-info":h.overrides.length&&n.set(l,{placementInfo:h,compiledOverrides:(await Promise.all(h.overrides.map((e=>c(r,e))))).filter(e)}),a[l]=h.placement;break;case"text-rasterization-param":{if(h.overrides.length){const t=h.overrides.map((e=>c(r,e,h.useLegacyLabelEvaluationRules)));u.set(l,{compiledOverrides:(await Promise.all(t)).filter(e),rasterizationParam:h,objectIdToResourceId:new Map});continue}const s={type:"cim-rasterization-info",resource:h.resource};a[l]=await t.fetchResourceImmediate(s)??null;break}case"sprite-rasterization-param":{if(h.overrides.length){const t=h.overrides.map((e=>c(r,e)));u.set(l,{compiledOverrides:(await Promise.all(t)).filter(e),rasterizationParam:h,objectIdToResourceId:new Map});continue}if("animated"===h.resource.type){u.set(l,{compiledOverrides:[],rasterizationParam:h,objectIdToResourceId:new Map});continue}const s={type:"cim-rasterization-info",resource:h.resource};a[l]=await t.fetchResourceImmediate(s)??null;break}case"cim-marker-transform-param":{const{params:e}=h;if(f(e)){const t={compiledMarkerInfos:[]};await Promise.all(e.map((async e=>{const s={props:{}};for(const t in e)if(p(e[t])){const a=await m(r,e[t]);s.compiledExpressionMap||(s.compiledExpressionMap=new Map);const o=s.compiledExpressionMap;a&&o.set(t,a)}else s.props[t]=e[t];t.compiledMarkerInfos.push(s)}))),d.set(l,t)}else a[l]={type:"cim-marker-transform-info",infos:e};break}default:a[l]=h}else a[l]=h}return new l(s,a,o,i,n,u,d)}constructor(e,r,t,s,a,o,i){this.inputMeshParams=e,this._resolvedMeshParams=r,this._dynamicProperties=t,this._dynamicEffectProperties=s,this._dynamicPlacementProperties=a,this._dynamicAsyncProperties=o,this._dynamicTransformProperties=i,this.evaluator=e=>e}get hasDynamicProperties(){return!!(this._dynamicProperties.size||this._dynamicAsyncProperties.size||this._dynamicEffectProperties.size||this._dynamicTransformProperties.size||this._dynamicPlacementProperties.size)}get evaluatedMeshParams(){return this._evaluatedMeshParams||(this._evaluatedMeshParams=this.evaluator(this._resolvedMeshParams)),this._evaluatedMeshParams}enqueueRequest(e,s,i){for(const m of this._dynamicAsyncProperties.values()){const p=t(m.rasterizationParam.resource);"animated"===m.rasterizationParam.resource.type&&m.rasterizationParam.resource.randomizeStartTime&&(p.startGroup=a(s.getObjectId()||0));for(const{primitiveName:e,propertyName:t,computed:a,defaultValue:l,valueExpressionInfo:u}of m.compiledOverrides)try{o(p,
|
|
5
|
+
import{isSome as e}from"../../../../../../../core/arrayUtils.js";import r from"../../../../../../../core/Error.js";import{clone as t}from"../../../../../../../core/lang.js";import s from"../../../../../../../core/Logger.js";import{getStartGroup as a}from"../../../grouping.js";import{applyComputedValue as o}from"./utils.js";import{DictionaryValue as i}from"../../../../../layers/features/support/DictionaryValue.js";const n=()=>s.getLogger("esri.views.2d.engine.webgl.shaderGraph.techniques.mesh.MeshWriterInputEvaluator");async function c(e,r,t=!1){const{defaultValue:s,valueExpressionInfo:a,value:o}=r;if(a){const{expression:o}=a,i=await e.createComputedField({expression:o},t);return i?{...r,computed:i,defaultValue:s}:null}return{...r,computed:new i(o),defaultValue:s}}async function m(e,r){const{defaultValue:t,valueExpressionInfo:s}=r,{expression:a}=s,o=await e.createComputedField({expression:a});return o?{...r,computed:o,defaultValue:t}:null}const p=e=>"boolean"!=typeof e&&"number"!=typeof e&&"valueExpressionInfo"in e,f=e=>e.some((e=>{for(const r in e){const t=e[r];if(p(t))return!0}return!1}));class l{static async create(r,t,s){const a={},o=new Map,i=new Map,n=new Map,u=new Map,d=new Map;for(const l in s.params){const h=s.params[l];if(null!=h&&"object"==typeof h)if(Array.isArray(h)){if("object"==typeof h[0])throw new Error(`InternalError: Cannot handle ${l}. Nested array params are not supported`);a[l]=h}else if("valueExpressionInfo"in h){if(h.value){a[l]=h.value;continue}const e=await m(r,h);if(!e){a[l]=h.defaultValue;continue}o.set(l,e),a[l]=null}else switch(h.type){case"cim-effect-infos":if(h.effectInfos.some((e=>e.overrides.length))){i.set(l,{effects:await Promise.all(h.effectInfos.map((async t=>{const s=t.overrides.map((e=>c(r,e)));return{effect:t.effect,compiledOverrides:(await Promise.all(s)).filter(e)}})))});break}a[l]=h.effectInfos.map((e=>e.effect));break;case"cim-marker-placement-info":h.overrides.length&&n.set(l,{placementInfo:h,compiledOverrides:(await Promise.all(h.overrides.map((e=>c(r,e))))).filter(e)}),a[l]=h.placement;break;case"text-rasterization-param":{if(h.overrides.length){const t=h.overrides.map((e=>c(r,e,h.useLegacyLabelEvaluationRules)));u.set(l,{compiledOverrides:(await Promise.all(t)).filter(e),rasterizationParam:h,objectIdToResourceId:new Map});continue}const s={type:"cim-rasterization-info",resource:h.resource};a[l]=await t.fetchResourceImmediate(s)??null;break}case"sprite-rasterization-param":{if(h.overrides.length){const t=h.overrides.map((e=>c(r,e)));u.set(l,{compiledOverrides:(await Promise.all(t)).filter(e),rasterizationParam:h,objectIdToResourceId:new Map});continue}if("animated"===h.resource.type){u.set(l,{compiledOverrides:[],rasterizationParam:h,objectIdToResourceId:new Map});continue}const s={type:"cim-rasterization-info",resource:h.resource};a[l]=await t.fetchResourceImmediate(s)??null;break}case"cim-marker-transform-param":{const{params:e}=h;if(f(e)){const t={compiledMarkerInfos:[]};await Promise.all(e.map((async e=>{const s={props:{}};for(const t in e)if(p(e[t])){const a=await m(r,e[t]);s.compiledExpressionMap||(s.compiledExpressionMap=new Map);const o=s.compiledExpressionMap;a&&o.set(t,a)}else s.props[t]=e[t];t.compiledMarkerInfos.push(s)}))),d.set(l,t)}else a[l]={type:"cim-marker-transform-info",infos:e};break}default:a[l]=h}else a[l]=h}return new l(s,a,o,i,n,u,d)}constructor(e,r,t,s,a,o,i){this.inputMeshParams=e,this._resolvedMeshParams=r,this._dynamicProperties=t,this._dynamicEffectProperties=s,this._dynamicPlacementProperties=a,this._dynamicAsyncProperties=o,this._dynamicTransformProperties=i,this.evaluator=e=>e}get hasDynamicProperties(){return!!(this._dynamicProperties.size||this._dynamicAsyncProperties.size||this._dynamicEffectProperties.size||this._dynamicTransformProperties.size||this._dynamicPlacementProperties.size)}get evaluatedMeshParams(){return this._evaluatedMeshParams||(this._evaluatedMeshParams=this.evaluator(this._resolvedMeshParams)),this._evaluatedMeshParams}enqueueRequest(e,s,i){for(const m of this._dynamicAsyncProperties.values()){const p=t(m.rasterizationParam.resource);"animated"===m.rasterizationParam.resource.type&&m.rasterizationParam.resource.randomizeStartTime&&(p.primitiveName="__RESERVED__PRIMITIVE__NAME__",p.startGroup=a(s.getObjectId()||0));for(const{primitiveName:e,propertyName:t,computed:a,defaultValue:l,valueExpressionInfo:u}of m.compiledOverrides)try{const r="animated"===m.rasterizationParam.resource.type?p.primitiveName:e;o(p,r,t,a,s,i,l)}catch(c){n().errorOnce(new r("invalid-arcade-expression",`Encountered an error when evaluating the arcade expression '${u?.expression}' (primitive: '${e}', property: '${t}')`,c))}const f=e.enqueueRequest({type:"cim-rasterization-info",resource:p});m.objectIdToResourceId.set(s.getObjectId(),f)}}evaluateMeshParams(e,r,t){for(const[s,a]of this._dynamicProperties.entries())this._resolvedMeshParams[s]=a.computed.readWithDefault(r,t,a.defaultValue);for(const[s,a]of this._dynamicPlacementProperties.entries())for(const{computed:e,defaultValue:o,propertyName:i}of a.compiledOverrides){const n=e.readWithDefault(r,t,o);a.placementInfo.placement[i]=n,this._resolvedMeshParams[s]=a.placementInfo.placement}for(const[s,a]of this._dynamicEffectProperties.entries())for(const e of a.effects){for(const{computed:s,defaultValue:a,propertyName:o}of e.compiledOverrides){const i=s.readWithDefault(r,t,a);e.effect[o]=i}this._resolvedMeshParams[s]=a.effects.map((e=>e.effect))}for(const[s,a]of this._dynamicTransformProperties.entries()){const e={type:"cim-marker-transform-info",infos:[]};for(const s of a.compiledMarkerInfos){const a={...s.props};if(s.compiledExpressionMap)for(const[e,o]of s.compiledExpressionMap){const s=o.computed.readWithDefault(r,t,o.defaultValue);a[e]="number"==typeof s||"boolean"==typeof s?s:o.defaultValue}e.infos.push(a)}this._resolvedMeshParams[s]=e}for(const[s,a]of this._dynamicAsyncProperties.entries()){const t=a.objectIdToResourceId.get(r.getObjectId());if(null==t)continue;const o=e.getResource(t);this._resolvedMeshParams[s]=o}return this._evaluatedMeshParams=this.evaluator(this._resolvedMeshParams),this.evaluatedMeshParams}}export{l as MeshWriterInputEvaluator};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import"../../../../geometry.js";import t from"../../../../Graphic.js";import"../../../../symbols.js";import{getContrast as i}from"../../../../core/colorUtils.js";import{destroyMaybe as s}from"../../../../core/maybe.js";import{watch as o}from"../../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as r}from"../../../../core/unitUtils.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{subtract as h,normalize as c}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as l,UNIT_X as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{h as _,l as m,n as d,g as y,k as u,f as g}from"../../../../chunks/vec32.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{project as v,initializeProjection as G}from"../../../../geometry/projection.js";import{a as w,c as R}from"../../../../chunks/boundedPlane.js";import{equals as b}from"../../../../geometry/support/spatialReferenceUtils.js";import k from"../../../../layers/GraphicsLayer.js";import{ViewingMode as j}from"../../../ViewingMode.js";import{DragManipulation as P}from"./manipulations/DragManipulation.js";import{RotateManipulation as A}from"./manipulations/RotateManipulation.js";import{ScaleManipulation as C}from"./manipulations/ScaleManipulation.js";import{PreserveAspectRatio as S,SnapRotation as M}from"./manipulations/utils.js";import{primaryKey as T}from"../../../input/keys.js";import{InteractiveToolBase as x}from"../../../interactive/InteractiveToolBase.js";import{EditGeometry as O}from"../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as D}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{AccumulationBehavior as U}from"../../../interactive/editGeometry/interfaces.js";import{AccumulationType as E}from"../../../interactive/editGeometry/operations/UpdateVertices.js";import{calculateOrientedBounds as L}from"../../../interactive/editGeometry/support/editPlaneUtils.js";import{findFirstGraphicHit as B}from"../../../support/hitTestSelectUtils.js";import{createScreenPointFromEvent as H}from"../../../support/screenUtils.js";import V from"../../../../geometry/Polygon.js";import I from"../../../../geometry/Point.js";import z from"../../../../symbols/SimpleFillSymbol.js";import K from"../../../../symbols/SimpleMarkerSymbol.js";const N={up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",plus:"+",minus:"-",toggleOpacity:"t",shift:"Shift",primaryKey:T},W=80,q=10,F=30,J=[[1,1],[1,-1],[-1,-1],[-1,1],[1,0],[0,-1],[-1,0],[0,1]],Q=1,X=10;let Y=class extends x{constructor(e){super(e),this._initialControlPoints=null,this._initialGeometry=null,this._graphic=null,this._planeCache=w(),this._displayPlaneCache=w(),this._mainAxisCache=l(),this._rotationHandleCache=f(),this._cornerA=f(),this._cornerB=f(),this._cornerC=f(),this._cornerD=f(),this._avgAB=f(),this._avgBC=f(),this._avgCD=f(),this._avgDA=f(),this._preserveAspectRatio=new S,this._snapRotation=new M,this._graphicsLayer=new k({internal:!0,listMode:"hide",visible:!1}),this._sharedUndoStack=[],this._sharedRedoStack=[],this._isOpacityToggled=!1,this._isModifierActive=!1,this._factor=1,this.preserveAspectRatio=null,this.snapRotation=null}initialize(){this._initialize()}destroy(){const{map:e}=this.view;this._dragManipulation.destroy(),this._rotateManipulation.destroy(),this._scaleManipulations.forEach((e=>e.destroy())),this._editGeometryOperations.destroy(),e.removeMany([this._graphicsLayer]),this._graphicsLayer.removeAll(),this._graphicsLayer=s(this._graphicsLayer),this._initialControlPoints=null,this._initialGeometry=null,this._graphic=null,this._preserveAspectRatio=null,this._snapRotation=null,this._planeCache=null,this._displayPlaneCache=null,this._rotationHandleCache=null,this._mainAxisCache=null,this._cornerA=null,this._cornerB=null,this._cornerC=null,this._cornerD=null,this._avgAB=null,this._avgBC=null,this._avgCD=null,this._avgDA=null,this._sharedUndoStack=null,this._sharedRedoStack=null}get _plane(){const e=this._graphic.geometry;if(null==e)return null;const t=this._editGeometryOperations.data,i=t.components[0].edges[0],s=h(this._mainAxisCache,i.leftVertex.pos,i.rightVertex.pos);c(s,s);let o=W*this.view.resolution;const a=this.view.spatialReference;return b(a,e.spatialReference)&&(o*=r(a)/r(e.spatialReference)),L(s,t,o,this._planeCache)}get _displayPlane(){const e=this._plane;if(!e)return null;const t=this._displayPlaneCache;R(e,t);const i=q*this.view.resolution;return _(t.basis1,t.basis1,1+i/m(t.basis1)),_(t.basis2,t.basis2,1+i/m(t.basis2)),t}get _backgroundGraphicGeometry(){const e=this._displayPlane;if(!e)return null;const t=this.view.spatialReference;return this._updateDisplayPlaneConrers(e),new V({spatialReference:t,rings:[[this._cornerA,this._cornerB,this._cornerC,this._cornerD,this._cornerA]]})}get _rotateGraphicGeometry(){const e=this._plane;if(!e)return null;const t=this._rotationHandleCache;return d(t,e.basis1),_(t,t,F*this.view.resolution),y(t,t,e.origin),y(t,t,e.basis1),new I({x:t[0],y:t[1],spatialReference:this.view.spatialReference})}get _scaleGraphicGeometries(){const e=this._displayPlane;if(!e)return[];const t=this.view.spatialReference;this._updateDisplayPlaneConrers(e);const{_cornerA:i,_cornerB:s,_cornerC:o,_cornerD:r}=this,a=u(this._avgAB,i,s,.5),n=u(this._avgBC,s,o,.5),h=u(this._avgCD,o,r,.5),c=u(this._avgDA,r,i,.5);return[new I({x:i[0],y:i[1],spatialReference:t}),new I({x:s[0],y:s[1],spatialReference:t}),new I({x:o[0],y:o[1],spatialReference:t}),new I({x:r[0],y:r[1],spatialReference:t}),new I({x:a[0],y:a[1],spatialReference:t}),new I({x:n[0],y:n[1],spatialReference:t}),new I({x:h[0],y:h[1],spatialReference:t}),new I({x:c[0],y:c[1],spatialReference:t})]}onActivate(){this.visible=!0}onDeactivate(){this.visible=!1}onShow(){this._graphicsLayer.visible=!0}onHide(){this._graphicsLayer.visible=!1}canUndo(){return this._editGeometryOperations.canUndo}canRedo(){return this._editGeometryOperations.canRedo}undo(){this._editGeometryOperations.undo(),this.updateGraphics()}redo(){this._editGeometryOperations.redo(),this.updateGraphics()}refresh(){const{view:e,target:t}=this,i="georeference"in t?t.georeference.coords:t.geometry,s=this._editGeometryOperations,o=s.data.components[0].vertices,r=O.fromGeometry(v(i,e.spatialReference),j.Local).components[0].vertices;o.forEach(((e,t)=>{s.setVertexPosition(e,r[t].pos)})),this.updateGraphics()}reset(){const{target:e}=this;if("georeference"in e){const t=e.georeference;"control-points"===t.type&&(t.controlPoints=this._initialControlPoints)}else e.geometry=this._initialGeometry;this.refresh(),this._sharedUndoStack.length=0,this._sharedRedoStack.length=0}updateGraphics(){const e=this._editGeometryOperations.data.geometry;if("georeference"in this.target){this.target.georeference.coords=e}this._graphic.geometry=e,this._backgroundGraphic.geometry=this._backgroundGraphicGeometry,this._rotateGraphic.geometry=this._rotateGraphicGeometry,this._scaleGraphicGeometries.forEach(((e,t)=>{this._scaleGraphics[t].geometry=e}))}setSharedUndoStack(e){this._sharedUndoStack=e}setSharedRedoStack(e){this._sharedRedoStack=e}async _initialize(){const{view:e,target:s}=this;if("georeference"in s){const e=s.georeference;this._graphic=new t({geometry:e.coords}),this._initialControlPoints="control-points"===e.type?e.controlPoints:null}else this._graphic=s,this._initialGeometry=s.geometry;e.map.addMany([this._graphicsLayer]),e.focus(),this.visible=!1,this.finishToolCreation(),await this._loadProjectionEngine(),this._editGeometryOperations=D.fromGeometry(v(this._graphic.geometry,e.spatialReference),j.Local),this._backgroundGraphic=new t({symbol:new z({color:"transparent",outline:{type:"simple-line",color:e.effectiveTheme.accentColor,width:2}}),geometry:this._backgroundGraphicGeometry}),this._rotateGraphic=new t({symbol:new K({color:i(e.effectiveTheme.accentColor),outline:{type:"simple-line",color:e.effectiveTheme.accentColor,width:1}}),geometry:this._rotateGraphicGeometry}),this._scaleGraphics=this._scaleGraphicGeometries.map((s=>new t({symbol:new K({size:6,style:"square",color:i(e.effectiveTheme.accentColor),outline:{type:"simple-line",color:e.effectiveTheme.accentColor,width:1}}),geometry:s}))),this._graphicsLayer.graphics.addMany([this._backgroundGraphic,this._rotateGraphic,...this._scaleGraphics]),this._dragManipulation=new P({tool:this,view:e,graphic:this._graphic}),this._rotateManipulation=new A({tool:this,view:e,graphic:this._rotateGraphic,snapRotation:this._snapRotation}),this._scaleManipulations=this._scaleGraphics.map(((t,i)=>new C({tool:this,view:e,graphic:t,direction:J[i],preserveAspectRatio:this._preserveAspectRatio}))),this.addHandles([this._dragManipulation.createDragPipeline(this._getInfo.bind(this),this._updateGraphics.bind(this)),this._rotateManipulation.createDragPipeline(this._getInfo.bind(this),this._updateGraphics.bind(this)),...this._scaleManipulations.map((e=>e.createDragPipeline(this._getInfo.bind(this),this._updateGraphics.bind(this)))),o((()=>this.view.scale),(()=>this.active?this.updateGraphics():null)),e.on("click",(async t=>{if(null!=e.activeTool&&e.activeTool!==this)return;const i=H(t),o=[];e.map.allLayers.forEach((e=>{"vector-tile"!==e.type&&"imagery"!==e.type||o.push(e)}));const r=await this.view.hitTest(i,{exclude:o}),a=r.results;if(0===a.length)e.activeTool=null;else{const t=B(r.results),i="georeference"in s,o=a.map((e=>"media"===e.type?e.element:null)).filter(Boolean),n=new Set([...this._graphicsLayer.graphics,i?null:s].filter(Boolean));i&&o.includes(s)||null!=t&&n.has(t.graphic)?null==e.activeTool&&(e.activeTool=this):e.activeTool=null}}))]);const r=e=>{this.addHandles(e.events.on("grab-changed",(e=>{"georeference"in s&&("start"===e.action?s.opacity*=.5:"end"===e.action&&(s.opacity*=2))})))};this._dragManipulation.forEachManipulator(r),this._rotateManipulation.forEachManipulator(r),this._scaleManipulations.forEach((e=>e.forEachManipulator(r))),this.addHandles([e.on("key-down",(t=>{e.activeTool===this&&(t.key!==N.shift||t.repeat||(null==this.preserveAspectRatio&&(this._preserveAspectRatio.enabled=!this._preserveAspectRatio.enabled),null==this.snapRotation&&(this._snapRotation.enabled=!this._snapRotation.enabled),this._isModifierActive=!0,t.stopPropagation()),t.key!==N.toggleOpacity||t.repeat||("georeference"in s&&(s.opacity*=this._isOpacityToggled?2:.5,this._isOpacityToggled=!this._isOpacityToggled),t.stopPropagation()),t.key!==N.primaryKey||t.repeat||(this._factor=X,t.stopPropagation()),this._isModifierActive&&(t.key===N.plus&&(this._scale(this._factor),t.stopPropagation()),t.key===N.minus&&(this._scale(-this._factor),t.stopPropagation()),t.key===N.up&&(this._move(0,this._factor),t.stopPropagation()),t.key===N.down&&(this._move(0,-this._factor),t.stopPropagation()),t.key===N.left&&(this._move(-this._factor,0),t.stopPropagation()),t.key===N.right&&(this._move(this._factor,0),t.stopPropagation())))})),e.on("key-up",(t=>{e.activeTool===this&&(t.key===N.shift&&(null==this.preserveAspectRatio&&(this._preserveAspectRatio.enabled=!this._preserveAspectRatio.enabled),null==this.snapRotation&&(this._snapRotation.enabled=!this._snapRotation.enabled),this._isModifierActive=!1,t.stopPropagation()),t.key===N.primaryKey&&(this._factor=Q,t.stopPropagation()))}))])}async _loadProjectionEngine(){const e=this._graphic.geometry;return G(e.spatialReference,this.view.spatialReference)}_updateDisplayPlaneConrers(e){const{basis1:t,basis2:i,origin:s}=e,o=this._cornerA;y(o,s,t),y(o,o,i);const r=this._cornerB;y(r,s,t),g(r,r,i);const a=this._cornerC;g(a,s,t),g(a,a,i);const n=this._cornerD;g(n,s,t),y(n,n,i)}_getInfo(){return{editGeometryOperations:this._editGeometryOperations,plane:this._plane,displayPlane:this._displayPlane}}_updateGraphics(e,t){"start"===e.action&&(this._sharedUndoStack.push({tool:this,operation:t}),this._sharedRedoStack.length=0),this.updateGraphics()}_scale(e){const t=this._editGeometryOperations,i=[];for(const a of t.data.components)i.push(...a.vertices);const s=t.data.geometry.extent?.width,o=(s+e*this.view.resolution)/s,r=t.scaleVertices(i,this._plane.origin,p,o,o,U.NEW_STEP,E.REPLACE);this._sharedUndoStack.push({tool:this,operation:r}),this._sharedRedoStack.length=0,this.updateGraphics()}_move(e,t){const i=this._editGeometryOperations,s=[];for(const r of i.data.components)s.push(...r.vertices);const o=i.moveVertices(s,e*this.view.resolution,t*this.view.resolution,0,U.NEW_STEP);this._sharedUndoStack.push({tool:this,operation:o}),this._sharedRedoStack.length=0,this.updateGraphics()}};e([a()],Y.prototype,"_plane",null),e([a()],Y.prototype,"_backgroundGraphicGeometry",null),e([a()],Y.prototype,"_rotateGraphicGeometry",null),e([a()],Y.prototype,"_scaleGraphicGeometries",null),e([a()],Y.prototype,"preserveAspectRatio",void 0),e([a()],Y.prototype,"snapRotation",void 0),e([a({constructOnly:!0,nonNullable:!0})],Y.prototype,"target",void 0),e([a({constructOnly:!0})],Y.prototype,"view",void 0),Y=e([n("esri.views.2d.interactive.editingTools.TransformTool")],Y);export{Y as TransformTool,N as keys};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import"../../../../geometry.js";import t from"../../../../Graphic.js";import"../../../../symbols.js";import{getContrast as i}from"../../../../core/colorUtils.js";import{destroyMaybe as s}from"../../../../core/maybe.js";import{watch as o}from"../../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as r}from"../../../../core/unitUtils.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{subtract as h,normalize as c}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as l,UNIT_X as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{h as _,l as m,n as d,g as y,m as u,f as g}from"../../../../chunks/vec32.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{project as v,initializeProjection as G}from"../../../../geometry/projection.js";import{a as w,c as R}from"../../../../chunks/boundedPlane.js";import{equals as b}from"../../../../geometry/support/spatialReferenceUtils.js";import j from"../../../../layers/GraphicsLayer.js";import{ViewingMode as k}from"../../../ViewingMode.js";import{DragManipulation as P}from"./manipulations/DragManipulation.js";import{RotateManipulation as A}from"./manipulations/RotateManipulation.js";import{ScaleManipulation as C}from"./manipulations/ScaleManipulation.js";import{PreserveAspectRatio as S,SnapRotation as M}from"./manipulations/utils.js";import{primaryKey as T}from"../../../input/keys.js";import{InteractiveToolBase as x}from"../../../interactive/InteractiveToolBase.js";import{EditGeometry as O}from"../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as D}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{AccumulationBehavior as U}from"../../../interactive/editGeometry/interfaces.js";import{AccumulationType as E}from"../../../interactive/editGeometry/operations/UpdateVertices.js";import{calculateOrientedBounds as L}from"../../../interactive/editGeometry/support/editPlaneUtils.js";import{findFirstGraphicHit as B}from"../../../support/hitTestSelectUtils.js";import{createScreenPointFromEvent as H}from"../../../support/screenUtils.js";import V from"../../../../geometry/Polygon.js";import I from"../../../../geometry/Point.js";import z from"../../../../symbols/SimpleFillSymbol.js";import K from"../../../../symbols/SimpleMarkerSymbol.js";const N={up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",plus:"+",minus:"-",toggleOpacity:"t",shift:"Shift",primaryKey:T},W=80,q=10,F=30,J=[[1,1],[1,-1],[-1,-1],[-1,1],[1,0],[0,-1],[-1,0],[0,1]],Q=1,X=10;let Y=class extends x{constructor(e){super(e),this._initialControlPoints=null,this._initialGeometry=null,this._graphic=null,this._planeCache=w(),this._displayPlaneCache=w(),this._mainAxisCache=l(),this._rotationHandleCache=f(),this._cornerA=f(),this._cornerB=f(),this._cornerC=f(),this._cornerD=f(),this._avgAB=f(),this._avgBC=f(),this._avgCD=f(),this._avgDA=f(),this._preserveAspectRatio=new S,this._snapRotation=new M,this._graphicsLayer=new j({internal:!0,listMode:"hide",visible:!1}),this._sharedUndoStack=[],this._sharedRedoStack=[],this._isOpacityToggled=!1,this._isModifierActive=!1,this._factor=1,this.preserveAspectRatio=null,this.snapRotation=null}initialize(){this._initialize()}destroy(){const{map:e}=this.view;this._dragManipulation.destroy(),this._rotateManipulation.destroy(),this._scaleManipulations.forEach((e=>e.destroy())),this._editGeometryOperations.destroy(),e.removeMany([this._graphicsLayer]),this._graphicsLayer.removeAll(),this._graphicsLayer=s(this._graphicsLayer),this._initialControlPoints=null,this._initialGeometry=null,this._graphic=null,this._preserveAspectRatio=null,this._snapRotation=null,this._planeCache=null,this._displayPlaneCache=null,this._rotationHandleCache=null,this._mainAxisCache=null,this._cornerA=null,this._cornerB=null,this._cornerC=null,this._cornerD=null,this._avgAB=null,this._avgBC=null,this._avgCD=null,this._avgDA=null,this._sharedUndoStack=null,this._sharedRedoStack=null}get _plane(){const e=this._graphic.geometry;if(null==e)return null;const t=this._editGeometryOperations.data,i=t.components[0].edges[0],s=h(this._mainAxisCache,i.leftVertex.pos,i.rightVertex.pos);c(s,s);let o=W*this.view.resolution;const a=this.view.spatialReference;return b(a,e.spatialReference)&&(o*=r(a)/r(e.spatialReference)),L(s,t,o,this._planeCache)}get _displayPlane(){const e=this._plane;if(!e)return null;const t=this._displayPlaneCache;R(e,t);const i=q*this.view.resolution;return _(t.basis1,t.basis1,1+i/m(t.basis1)),_(t.basis2,t.basis2,1+i/m(t.basis2)),t}get _backgroundGraphicGeometry(){const e=this._displayPlane;if(!e)return null;const t=this.view.spatialReference;return this._updateDisplayPlaneConrers(e),new V({spatialReference:t,rings:[[this._cornerA,this._cornerB,this._cornerC,this._cornerD,this._cornerA]]})}get _rotateGraphicGeometry(){const e=this._plane;if(!e)return null;const t=this._rotationHandleCache;return d(t,e.basis1),_(t,t,F*this.view.resolution),y(t,t,e.origin),y(t,t,e.basis1),new I({x:t[0],y:t[1],spatialReference:this.view.spatialReference})}get _scaleGraphicGeometries(){const e=this._displayPlane;if(!e)return[];const t=this.view.spatialReference;this._updateDisplayPlaneConrers(e);const{_cornerA:i,_cornerB:s,_cornerC:o,_cornerD:r}=this,a=u(this._avgAB,i,s,.5),n=u(this._avgBC,s,o,.5),h=u(this._avgCD,o,r,.5),c=u(this._avgDA,r,i,.5);return[new I({x:i[0],y:i[1],spatialReference:t}),new I({x:s[0],y:s[1],spatialReference:t}),new I({x:o[0],y:o[1],spatialReference:t}),new I({x:r[0],y:r[1],spatialReference:t}),new I({x:a[0],y:a[1],spatialReference:t}),new I({x:n[0],y:n[1],spatialReference:t}),new I({x:h[0],y:h[1],spatialReference:t}),new I({x:c[0],y:c[1],spatialReference:t})]}onActivate(){this.visible=!0}onDeactivate(){this.visible=!1}onShow(){this._graphicsLayer.visible=!0}onHide(){this._graphicsLayer.visible=!1}canUndo(){return this._editGeometryOperations.canUndo}canRedo(){return this._editGeometryOperations.canRedo}undo(){this._editGeometryOperations.undo(),this.updateGraphics()}redo(){this._editGeometryOperations.redo(),this.updateGraphics()}refresh(){const{view:e,target:t}=this,i="georeference"in t?t.georeference.coords:t.geometry,s=this._editGeometryOperations,o=s.data.components[0].vertices,r=O.fromGeometry(v(i,e.spatialReference),k.Local).components[0].vertices;o.forEach(((e,t)=>{s.setVertexPosition(e,r[t].pos)})),this.updateGraphics()}reset(){const{target:e}=this;if("georeference"in e){const t=e.georeference;"control-points"===t.type&&(t.controlPoints=this._initialControlPoints)}else e.geometry=this._initialGeometry;this.refresh(),this._sharedUndoStack.length=0,this._sharedRedoStack.length=0}updateGraphics(){const e=this._editGeometryOperations.data.geometry;if("georeference"in this.target){this.target.georeference.coords=e}this._graphic.geometry=e,this._backgroundGraphic.geometry=this._backgroundGraphicGeometry,this._rotateGraphic.geometry=this._rotateGraphicGeometry,this._scaleGraphicGeometries.forEach(((e,t)=>{this._scaleGraphics[t].geometry=e}))}setSharedUndoStack(e){this._sharedUndoStack=e}setSharedRedoStack(e){this._sharedRedoStack=e}async _initialize(){const{view:e,target:s}=this;if("georeference"in s){const e=s.georeference;this._graphic=new t({geometry:e.coords}),this._initialControlPoints="control-points"===e.type?e.controlPoints:null}else this._graphic=s,this._initialGeometry=s.geometry;e.map.addMany([this._graphicsLayer]),e.focus(),this.visible=!1,this.finishToolCreation(),await this._loadProjectionEngine(),this._editGeometryOperations=D.fromGeometry(v(this._graphic.geometry,e.spatialReference),k.Local),this._backgroundGraphic=new t({symbol:new z({color:"transparent",outline:{type:"simple-line",color:e.effectiveTheme.accentColor,width:2}}),geometry:this._backgroundGraphicGeometry}),this._rotateGraphic=new t({symbol:new K({color:i(e.effectiveTheme.accentColor),outline:{type:"simple-line",color:e.effectiveTheme.accentColor,width:1}}),geometry:this._rotateGraphicGeometry}),this._scaleGraphics=this._scaleGraphicGeometries.map((s=>new t({symbol:new K({size:6,style:"square",color:i(e.effectiveTheme.accentColor),outline:{type:"simple-line",color:e.effectiveTheme.accentColor,width:1}}),geometry:s}))),this._graphicsLayer.graphics.addMany([this._backgroundGraphic,this._rotateGraphic,...this._scaleGraphics]),this._dragManipulation=new P({tool:this,view:e,graphic:this._graphic}),this._rotateManipulation=new A({tool:this,view:e,graphic:this._rotateGraphic,snapRotation:this._snapRotation}),this._scaleManipulations=this._scaleGraphics.map(((t,i)=>new C({tool:this,view:e,graphic:t,direction:J[i],preserveAspectRatio:this._preserveAspectRatio}))),this.addHandles([this._dragManipulation.createDragPipeline(this._getInfo.bind(this),this._updateGraphics.bind(this)),this._rotateManipulation.createDragPipeline(this._getInfo.bind(this),this._updateGraphics.bind(this)),...this._scaleManipulations.map((e=>e.createDragPipeline(this._getInfo.bind(this),this._updateGraphics.bind(this)))),o((()=>this.view.scale),(()=>this.active?this.updateGraphics():null)),e.on("click",(async t=>{if(null!=e.activeTool&&e.activeTool!==this)return;const i=H(t),o=[];e.map.allLayers.forEach((e=>{"vector-tile"!==e.type&&"imagery"!==e.type||o.push(e)}));const r=await this.view.hitTest(i,{exclude:o}),a=r.results;if(0===a.length)e.activeTool=null;else{const t=B(r.results),i="georeference"in s,o=a.map((e=>"media"===e.type?e.element:null)).filter(Boolean),n=new Set([...this._graphicsLayer.graphics,i?null:s].filter(Boolean));i&&o.includes(s)||null!=t&&n.has(t.graphic)?null==e.activeTool&&(e.activeTool=this):e.activeTool=null}}))]);const r=e=>{this.addHandles(e.events.on("grab-changed",(e=>{"georeference"in s&&("start"===e.action?s.opacity*=.5:"end"===e.action&&(s.opacity*=2))})))};this._dragManipulation.forEachManipulator(r),this._rotateManipulation.forEachManipulator(r),this._scaleManipulations.forEach((e=>e.forEachManipulator(r))),this.addHandles([e.on("key-down",(t=>{e.activeTool===this&&(t.key!==N.shift||t.repeat||(null==this.preserveAspectRatio&&(this._preserveAspectRatio.enabled=!this._preserveAspectRatio.enabled),null==this.snapRotation&&(this._snapRotation.enabled=!this._snapRotation.enabled),this._isModifierActive=!0,t.stopPropagation()),t.key!==N.toggleOpacity||t.repeat||("georeference"in s&&(s.opacity*=this._isOpacityToggled?2:.5,this._isOpacityToggled=!this._isOpacityToggled),t.stopPropagation()),t.key!==N.primaryKey||t.repeat||(this._factor=X,t.stopPropagation()),this._isModifierActive&&(t.key===N.plus&&(this._scale(this._factor),t.stopPropagation()),t.key===N.minus&&(this._scale(-this._factor),t.stopPropagation()),t.key===N.up&&(this._move(0,this._factor),t.stopPropagation()),t.key===N.down&&(this._move(0,-this._factor),t.stopPropagation()),t.key===N.left&&(this._move(-this._factor,0),t.stopPropagation()),t.key===N.right&&(this._move(this._factor,0),t.stopPropagation())))})),e.on("key-up",(t=>{e.activeTool===this&&(t.key===N.shift&&(null==this.preserveAspectRatio&&(this._preserveAspectRatio.enabled=!this._preserveAspectRatio.enabled),null==this.snapRotation&&(this._snapRotation.enabled=!this._snapRotation.enabled),this._isModifierActive=!1,t.stopPropagation()),t.key===N.primaryKey&&(this._factor=Q,t.stopPropagation()))}))])}async _loadProjectionEngine(){const e=this._graphic.geometry;return G(e.spatialReference,this.view.spatialReference)}_updateDisplayPlaneConrers(e){const{basis1:t,basis2:i,origin:s}=e,o=this._cornerA;y(o,s,t),y(o,o,i);const r=this._cornerB;y(r,s,t),g(r,r,i);const a=this._cornerC;g(a,s,t),g(a,a,i);const n=this._cornerD;g(n,s,t),y(n,n,i)}_getInfo(){return{editGeometryOperations:this._editGeometryOperations,plane:this._plane,displayPlane:this._displayPlane}}_updateGraphics(e,t){"start"===e.action&&(this._sharedUndoStack.push({tool:this,operation:t}),this._sharedRedoStack.length=0),this.updateGraphics()}_scale(e){const t=this._editGeometryOperations,i=[];for(const a of t.data.components)i.push(...a.vertices);const s=t.data.geometry.extent?.width,o=(s+e*this.view.resolution)/s,r=t.scaleVertices(i,this._plane.origin,p,o,o,U.NEW_STEP,E.REPLACE);this._sharedUndoStack.push({tool:this,operation:r}),this._sharedRedoStack.length=0,this.updateGraphics()}_move(e,t){const i=this._editGeometryOperations,s=[];for(const r of i.data.components)s.push(...r.vertices);const o=i.moveVertices(s,e*this.view.resolution,t*this.view.resolution,0,U.NEW_STEP);this._sharedUndoStack.push({tool:this,operation:o}),this._sharedRedoStack.length=0,this.updateGraphics()}};e([a()],Y.prototype,"_plane",null),e([a()],Y.prototype,"_backgroundGraphicGeometry",null),e([a()],Y.prototype,"_rotateGraphicGeometry",null),e([a()],Y.prototype,"_scaleGraphicGeometries",null),e([a()],Y.prototype,"preserveAspectRatio",void 0),e([a()],Y.prototype,"snapRotation",void 0),e([a({constructOnly:!0,nonNullable:!0})],Y.prototype,"target",void 0),e([a({constructOnly:!0})],Y.prototype,"view",void 0),Y=e([n("esri.views.2d.interactive.editingTools.TransformTool")],Y);export{Y as TransformTool,N as keys};
|
|
@@ -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/Handles.js";import{set as i,normalize as e}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{l as s,c as a,
|
|
5
|
+
import t from"../../../../../core/Handles.js";import{set as i,normalize as e}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{l as s,c as a,r as n,f as o,k as l}from"../../../../../chunks/vec32.js";import{create as c}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a as h,c as p}from"../../../../../chunks/boundedPlane.js";import{getInfo as u}from"../../../../../geometry/support/spatialReferenceUtils.js";import{Manipulation as _,ManipulatorType as m}from"./Manipulation.js";import{onGrabChangedHandle as d}from"./utils.js";import{createManipulatorDragEventPipeline as f,screenToMap as v}from"../../../../interactive/dragEventPipeline.js";import{GraphicManipulator as g}from"../../../../interactive/GraphicManipulator.js";import{AccumulationBehavior as b}from"../../../../interactive/editGeometry/interfaces.js";import{AccumulationType as x}from"../../../../interactive/editGeometry/operations/UpdateVertices.js";import{apply as C}from"../../../../interactive/editGeometry/support/editPlaneUtils.js";const E=10,S=1e-6,y=.3;function j(t){const i=s(t.basis1),e=s(t.basis2);return y*Math.min(i,e)}class w extends _{constructor(i){super(),this._handles=new t,this._planeStart=h(),this._displayPlaneStart=h(),this._originCache=c(),this._axisCache=r(),this._renderStartCache=c(),this._renderEndCache=c(),this._resizeOriginCache=c(),this._view=i.view,this._tool=i.tool,this._graphic=i.graphic,this._direction=i.direction,this._preserveAspectRatio=i.preserveAspectRatio,this._manipulator=this._createManipulator(),this._handles.add([this._manipulator.events.on("grab-changed",(t=>d(t,this._manipulator)))]),this.forEachManipulator((t=>this._tool.manipulators.add(t)))}destroy(){this._handles.destroy(),this.forEachManipulator((t=>{this._tool.manipulators.remove(t),t.destroy()})),this._tool=null,this._view=null,this._graphic=null,this._manipulator=null,this._direction=null,this._handles=null,this._planeStart=null,this._displayPlaneStart=null,this._originCache=null,this._axisCache=null,this._renderStartCache=null,this._renderEndCache=null,this._resizeOriginCache=null,this._preserveAspectRatio=null}forEachManipulator(t){t(this._manipulator,m.SCALE)}createDragPipeline(t,r){let c=null,h=null,_=null,m=0,d=null,g=null;const y=this._planeStart,w=this._displayPlaneStart,P=this._direction;return f(this._manipulator,((f,M)=>{M.next((i=>{if("start"===i.action){f.cursor="grabbing";const i=t();c=i.plane,h=i.displayPlane,_=i.editGeometryOperations,m=E*this._view.resolution,p(c,y),p(h,w);const e=u(_.data.spatialReference);d=e?e.valid[1]-e.valid[0]-3*E*this._view.resolution:null}return i})).next(v(this._view)).next((t=>{const i=a(this._renderStartCache,[t.mapStart.x,t.mapStart.y,0]),e=a(this._renderEndCache,[t.mapEnd.x,t.mapEnd.y,0]),r=a(this._resizeOriginCache,w.origin);n(r,r,w.basis1,-P[0]),n(r,r,w.basis2,-P[1]),o(e,e,r),o(i,i,r);const c=0!==P[0]&&0!==P[1],p=j(w),u=j(h)/p,_=(t,r)=>{if(0===t)return 1;let a=s(r),n=.5*t*l(r,e)/a;const o=n<0?-1:1;if(c){n+=(a-.5*t*l(r,i)/a)*o*u}const h=a<1.5*m?1:S;return a=Math.max(a-m,S),o>0&&(n-=E*this._view.resolution),o*Math.max(o*(n/a),h)},d=_(P[0],w.basis1),f=_(P[1],w.basis2);return{...t,direction:P,factor1:d,factor2:f}})).next(this._preserveAspectRatio.createDragEventPipelineStep(),this._preserveAspectRatio.next).next((t=>{const s=a(this._originCache,y.origin);n(s,s,y.basis1,-P[0]),n(s,s,y.basis2,-P[1]);const o=i(this._axisCache,y.basis1[0],y.basis1[1]);e(o,o);const l=[];for(const i of _.data.components)l.push(...i.vertices);const h="start"===t.action?b.NEW_STEP:b.ACCUMULATE_STEPS,u=_.scaleVertices(l,s,o,t.factor1,t.factor2,h,x.REPLACE);return d&&d<_.data.geometry.extent.width&&g?_.updateVertices(l,g):(p(y,c),C(u,c),g=u.operation,r(t,u)),t})).next((t=>("end"===t.action&&(f.cursor="grab"),t)))}))}_createManipulator(){return new g({view:this._view,graphic:this._graphic,selectable:!0,cursor:"grab"})}}export{w as ScaleManipulation,j as calculateDiagonalResizeHandleScale};
|
|
@@ -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"../../../AggregateGraphic.js";import"../../../geometry.js";import r from"../../../Graphic.js";import{isSome as s}from"../../../core/arrayUtils.js";import i from"../../../core/Collection.js";import{neverReached as a}from"../../../core/compilerUtils.js";import o from"../../../core/Error.js";import{makeHandle as n}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import u from"../../../core/Logger.js";import{destroyMaybe as l}from"../../../core/maybe.js";import{debounce as h,throwIfNotAbortError as c,isAbortError as p}from"../../../core/promiseUtils.js";import{watch as d,initial as y}from"../../../core/reactiveUtils.js";import{property as g}from"../../../core/accessorSupport/decorators/property.js";import{subclass as f}from"../../../core/accessorSupport/decorators/subclass.js";import{diff as m}from"../../../core/accessorSupport/diffUtils.js";import _ from"../../../layers/effects/FeatureEffectView.js";import w from"../../../layers/support/FeatureFilter.js";import{packFields as v}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as b}from"../../../layers/support/layerUtils.js";import S from"../../../rest/support/AggregateFeatureSet.js";import F from"../../../rest/support/FeatureSet.js";import A from"../../../rest/support/Query.js";import{getHighlightBits as E}from"../engine/highlightReasons.js";import{LayerView2DMixin as V}from"./LayerView2D.js";import{FeatureContainer as C}from"./features/FeatureContainer.js";import{createFeaturePipelineWorkerProxy as R}from"./features/FeaturePipelineWorkerProxy.js";import{FeatureSourceEventLog as U}from"./features/FeatureSourceEventLog.js";import{CatalogFootprintLayerAdapter as j}from"./features/layerAdapters/CatalogFootprintLayerAdapter.js";import{FeatureLayerAdapter as x}from"./features/layerAdapters/FeatureLayerAdapter.js";import{InMemoryLayerAdapter as q}from"./features/layerAdapters/InMemoryLayerAdapter.js";import{KnowledgeGraphSublayerAdapter as Q}from"./features/layerAdapters/KnowledgeGraphSublayerAdapter.js";import{OGCFeatureLayerAdapter as k}from"./features/layerAdapters/OGCFeatureLayerAdapter.js";import{OrientedImageryLayerAdapter as I}from"./features/layerAdapters/OrientedImageryLayerAdapter.js";import{StreamLayerAdapter as O}from"./features/layerAdapters/StreamLayerAdapter.js";import{SubtypeGroupLayerAdapter as L}from"./features/layerAdapters/SubtypeGroupLayerAdapter.js";import{createComplexSymbolInstances as H}from"./features/schema/processor/symbols/ComplexSymbolSchema.js";import D from"./support/FeatureCommandQueue.js";import{HighlightCounter as J}from"./support/HighlightCounter.js";import{FeatureTileSubscriptionManager as N}from"../tiling/FeatureTileSubscriptionManager.js";import T from"../../layers/FeatureLayerView.js";import M from"../../layers/LayerView.js";import $ from"../../layers/RefreshableLayerView.js";import G from"../../../geometry/Extent.js";function P(e,t){const r=new Set;return e&&e.forEach((e=>r.add(e))),t&&t.forEach((e=>r.add(e))),r.has("*")?["*"]:Array.from(r)}const z="esri.views.2d.layers.FeatureLayerView2D",B=4294967294;async function K(e,t){try{return await e}catch(r){if("no-queryEngine"!==r.name)throw r;return t}}let Z=class extends(T($(V(M)))){constructor(){super(...arguments),this._commandsQueue=new D({process:e=>{switch(e.type){case"processed-edit":return this._doEdit(e);case"update":return this._doUpdate()}}}),this._visibilityOverrides=new Set,this._highlightCounter=new J,this._updateHighlight=h((async()=>{const e=[];for(const t of this._highlightCounter.ids()){const r=this._highlightCounter.getHighestReason(t),s=E(r);e.push({objectId:t,highlightFlags:s})}this._worker.pipeline.updateHighlight({highlights:e})})),this._lastAvailableFields=[],this.eventLog=new U,this._sourceRefreshVersion=1,this._displayRefreshVersion=1,this._pipelineUpdating=!1,this._fields=null,this.featureEffectView=new _}destroy(){this._worker?.destroy(),this._commandsQueue.destroy()}initialize(){this.addResolvingPromise(this._initProxy()),this.featureEffectView.featureEffect=this.featureEffect,this.featureEffectView.endTransitions()}async _initProxy(){const e=this.layer;if("isTable"in e&&e.isTable)throw new o("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e});if("mesh"===e.geometryType)throw new o("featurelayerview:geometry-type-not-supported",`Geometry type of ${e.geometryType} is not supported`,{layer:e});if(("feature"===e.type||"subtype-group"===e.type)&&!1===b(e)?.operations.supportsQuery)throw new o("featurelayerview:query-not-supported","layer view requires a layer with query capability",{layer:e});this._worker&&this._worker.destroy();const t=this._createClientOptions();this._worker=await R(t)}get hasAllFeatures(){return this.layer.visible&&this.eventLog.hasAllFeatures}get hasAllFeaturesInView(){return this.layer.visible&&this.eventLog.hasAllFeaturesInView}get hasFullGeometries(){return this.layer.visible&&this.eventLog.hasFullGeometries}get labelingCollisionInfos(){const e=this.layerAdapter.getLabelingDeconflictionInfo(this.view),t=this.layer.geometryType,r=!this.suspended;return e.map((({vvEvaluators:e,deconflictionEnabled:s})=>({container:this.featureContainer,vvEvaluators:e,deconflictionEnabled:s,geometryType:t,visible:r})))}get layerAdapter(){switch(this.layer.type){case"feature":return"memory"===this.layer.source.type?new q(this.layer):new x(this.layer);case"geojson":case"csv":case"wfs":return new q(this.layer);case"subtype-group":return new L(this.layer);case"ogc-feature":return new k(this.layer);case"stream":return new O(this.layer);case"oriented-imagery":return new I(this.layer);case"knowledge-graph-sublayer":return new Q(this.layer);case"catalog-footprint":return new j(this.layer);default:a(this.layer)}return null}get updateHash(){if(!this.layerAdapter)return null;const{availableFields:e,_displayRefreshVersion:t,timeExtent:r,clips:s,filter:i,featureEffect:a,_sourceRefreshVersion:o,view:{timeZone:n}}=this,u=JSON.stringify(s),l=a?.toJSON(),h=i?.toJSON();return JSON.stringify({availableFields:e,clipsHash:u,displayRefreshVersion:t,effectHash:l,filterHash:h,sourceRefreshVersion:o,timeExtent:r,timeZone:n,...this.layerAdapter.getUpdateHashProperties(this.view)})}getDisplayStatistics(e,t){return this.featureContainer?.getDisplayStatistics(e,t)}async queryHeatmapStatistics(e){return this._worker.pipeline.queryHeatmapStatistics(e)}highlight(e,t="highlight"){let a;e instanceof r?a=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?a=[e]:i.isCollection(e)&&e.length>0?a=e.map((e=>e?.getObjectId())).toArray():Array.isArray(e)&&e.length>0&&(a="number"==typeof e[0]||"string"==typeof e[0]?e:e.map((e=>e?.getObjectId())));const o=a?.filter(s);return o?.length?(this._addHighlight(o,t),n((()=>this._removeHighlight(o,t)))):n()}getHighlightIds(){return Array.from(this._highlightCounter.ids())}hasHighlight(){return!this._highlightCounter.empty}async hitTest(e,s){const i=await this.featureContainer.hitTest(s);if(0===i.length)return null;const{features:a,aggregates:o}=await this._worker.pipeline.getDisplayFeatures(i),n=this.featureContainer.getSortKeys(i),u=({displayId:e},{displayId:t})=>n.has(e)&&n.has(t)?n.get(e)-n.get(t):e-t;return a.sort(u).reverse(),o.sort(u).reverse(),[...o.map((r=>this._createGraphicHit(e,t.fromJSON(r)))),...a.map((t=>this._createGraphicHit(e,r.fromJSON(t))))]}queryStatistics(){return K(this._worker.pipeline.queryStatistics(),{featureCount:0,ringCount:0,vertexCount:0})}querySummaryStatistics(e,t,r){const s={...t,scale:this.view.scale};return K(this._worker.features.executeQueryForSummaryStatistics(this._cleanUpQuery(e),s,r),{})}async queryAggregateSummaryStatistics(e,t,r){const s={...t,scale:this.view.scale};return K(this._worker.aggregates.executeQueryForSummaryStatistics(this._cleanUpAggregateQuery(e),s,r),{})}async queryUniqueValues(e,t,r){const s={...t,scale:this.view.scale};return K(this._worker.features.executeQueryForUniqueValues(this._cleanUpQuery(e),s,r),{uniqueValueInfos:[]})}async queryAggregateUniqueValues(e,t,r){const s={...t,scale:this.view.scale};return K(this._worker.aggregates.executeQueryForUniqueValues(this._cleanUpAggregateQuery(e),s,r),{uniqueValueInfos:[]})}async queryClassBreaks(e,t,r){const s={...t,scale:this.view.scale};return K(this._worker.features.executeQueryForClassBreaks(this._cleanUpQuery(e),s,r),{classBreakInfos:[]})}async queryAggregateClassBreaks(e,t,r){const s={...t,scale:this.view.scale};return K(this._worker.aggregates.executeQueryForClassBreaks(this._cleanUpAggregateQuery(e),s,r),{classBreakInfos:[]})}async queryHistogram(e,t,r){const s={...t,scale:this.view.scale};return K(this._worker.features.executeQueryForHistogram(this._cleanUpQuery(e),s,r),{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}async queryAggregateHistogram(e,t,r){const s={...t,scale:this.view.scale};return K(this._worker.aggregates.executeQueryForHistogram(this._cleanUpAggregateQuery(e),s,r),{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then((e=>{const t=F.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}async queryVisibleFeatures(e,t){const r=this._worker.pipeline.queryVisibleFeatures(this._cleanUpQuery(e),t),s=await K(r,{features:[]}),i=F.fromJSON(s);return i.features.forEach((e=>this._setLayersForFeature(e))),i}async queryAggregates(e,t){const r=this._worker.aggregates.executeQuery(this._cleanUpAggregateQuery(e),t),s=await K(r,{features:[]}),i=S.fromJSON(s);return i.features.forEach((e=>this._setLayersForFeature(e))),i}queryAggregateIds(e,t){return K(this._worker.aggregates.executeQueryForIds(this._cleanUpAggregateQuery(e),t),[])}queryAggregateCount(e,t){return K(this._worker.aggregates.executeQueryForCount(this._cleanUpAggregateQuery(e),t),0)}queryAggregateJSON(e,t){return K(this._worker.aggregates.executeQuery(this._cleanUpAggregateQuery(e),t),{features:[]})}async queryFeaturesJSON(e,t){return K(this._worker.features.executeQuery(this._cleanUpQuery(e),t),{features:[]})}queryObjectIds(e,t){return K(this._worker.features.executeQueryForIds(this._cleanUpQuery(e),t),[])}queryFeatureCount(e,t){return K(this._worker.features.executeQueryForCount(this._cleanUpQuery(e),t),0)}async queryExtent(e,t){const r=this._worker.features.executeQueryForExtent(this._cleanUpQuery(e),t),s=await K(r,{count:0,extent:null});return{count:s.count,extent:G.fromJSON(s.extent)}}async getSampleFeatures(e){return this._worker.pipeline.getSampleFeatures(e)}setVisibility(e,t){t?this._visibilityOverrides.delete(e):this._visibilityOverrides.add(e),this._update()}update(e){if(!this._subscriptionManager)return;const t=this._subscriptionManager.update(e);this.featureContainer.setVisibleTiles(t)}attach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.attach"),this.featureContainer=new C(this),this.container.addChild(this.featureContainer),this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this._subscriptionManager=new N({tileInfoView:this.view.featuresTilingScheme,updateSubscriptions:e=>{this.featureContainer.updateSubscriptions(e),this._worker.pipeline.updateSubscriptions(e)},isDone:e=>this.featureContainer.isDone(e)}),this.requestUpdate(),this.addAttachHandles([d((()=>this.updateHash),(()=>this._update()),y),d((()=>this.updateSuspended),(e=>{e||this._subscriptionManager.resume()}))]),"stream"!==this.layer.type&&"catalog-footprint"!==this.layer.type&&this.addAttachHandles(this.layer.on("edits",(e=>this._edit(e))))}detach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.detach"),this._fields=null,this.featureContainer.destroy(),this._commandsQueue.clear(),this.container.removeAllChildren(),this._subscriptionManager=l(this._subscriptionManager),this._worker.pipeline.onDetach()}moveStart(){this.requestUpdate()}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}isUpdating(){const e="renderer"in this.layer&&null!=this.layer.renderer,t=this._commandsQueue.updateTracking.updating,r=null!=this._updatingRequiredFieldsPromise,s=this.featureContainer.updatingHandles.updating,i=e&&(t||r)||s||this._pipelineUpdating||this.dataUpdating;if(has("esri-2d-log-updating")){console.log(`Updating FLV2D (${this.layer.id}): ${i}\n -> hasRenderer ${e}\n -> updatingRequiredFields ${r}\n -> hasPendingCommand ${t}\n -> dataUpdating ${this.dataUpdating}\n -> processing ${this._pipelineUpdating}\n -> updatingContainer ${s}\n`);for(const e of this.featureContainer.subscriptions())console.log(` -> Tile[${e.id}] Done: ${e.done}`)}return i}_createClientOptions(){const e=this;return{get container(){return e.featureContainer},setUpdating:e=>{this._set("_pipelineUpdating",e.pipeline),this._set("dataUpdating",e.data)},emitEvent:e=>{this.emit(e.name,e.event)},get eventLog(){return e.eventLog},fetch:t=>Promise.all(t.map((t=>e.view.stage.painter.textureManager.rasterizeItem(t)))),fetchDictionary:e=>Promise.all(e.map((e=>this._fetchDictionaryRequest(e))))}}async _fetchDictionaryRequest(e){try{if("subtype-group"===this.layer.type)throw new Error("InternalError: SubtypeGroupLayer does not support dictionary renderer");const t=this.layer.renderer;if(!t||"dictionary"!==t.type)throw new Error("InternalError: Expected layer to have a DictionaryRenderer");const r=this._lastSchema.processor.mesh.factory.symbology;if("dictionary"!==r.type)throw new Error("InternalError: Expected schema to be of type 'dictionary'");const s={cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,store:this.featureContainer.instanceStore,scaleExpression:r.scaleExpression};this._fields||(this._fields=this.layer.fields.map((e=>e.toJSON())));const i=r.visualVariableUniforms,a=await t.getSymbolAsync(e.feature,{fields:this._fields});if(!a||!a.data)return{type:"dictionary-response",meshes:[]};return{type:"dictionary-response",meshes:await H(a.data,{uniforms:i,path:"renderer",schemaOptions:s})}}catch(t){return{type:"dictionary-response",meshes:[]}}}_cleanUpQuery(e){const t=A.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAggregateQuery(e){const t=A.from(e)||this.createAggregateQuery();t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference);const r=t.objectIds??[];for(const s of t.aggregateIds??[])r.push(s);return t.objectIds=r,t.aggregateIds=[],t.toJSON()}async _update(){return this._commandsQueue.push({type:"update"})}async _edit(e){if(this.updateSuspended)return void this._subscriptionManager.suspend();return this._validateEdit(e)?this._commandsQueue.push({type:"edit",edits:e}).catch(c):void 0}async doRefresh(e){this.attached&&(this.updateSuspended&&e||(e?this.incrementSourceRefreshVersion():this.incrementDisplayRefreshVersion()))}incrementSourceRefreshVersion(){this._sourceRefreshVersion=(this._sourceRefreshVersion+1)%B+1}incrementDisplayRefreshVersion(){this._displayRefreshVersion=(this._displayRefreshVersion+1)%B+1}_validateEdit(e){const t="globalIdField"in this.layer&&this.layer.globalIdField,r=e.deletedFeatures.some((e=>-1===e.objectId||!e.objectId)),s=t&&this.availableFields.includes(t);return r&&!s?(u.getLogger(this).error(new o("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected on the map`)),null):e}async _doUpdate(){"featureReduction"in this.layer&&this.layer.featureReduction&&this.layer.featureReduction!==this._lastFeatureReduction&&(this.layer.featureReduction=this.layer.featureReduction?.clone(),this._lastFeatureReduction=this.layer.featureReduction);try{if(await this._updateRequiredFields(),this.destroyed||!this.layerAdapter?.hasRequiredSupport||!this._subscriptionManager)return;const e=this.featureContainer.instanceStore;this.featureContainer.attributeView.lockTextureUploads(),e.updateStart();const t=this.featureEffect,r={store:e,cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,scaleExpression:void 0},s=await this.layerAdapter.createServiceOptions(this.view),i=this._createViewSchemaConfig(),a={source:this.layerAdapter.createSourceSchema(s,i,this._sourceRefreshVersion),processor:await this.layerAdapter.createProcessorSchema(r,i,this._displayRefreshVersion)},o=!!m(this._lastSchema?.source.mutable,a.source.mutable)||!!m(this._lastSchema?.processor,a.processor);if(!o)return this.featureContainer.requestRender(),this.featureContainer.attributeView.unlockTextureUploads(),e.updateEnd(),void(this.featureEffectView.featureEffect=t);this._lastSchema=a,this._fields=null;const n=Math.round(performance.now());has("esri-2d-update-debug")&&console.debug(`Id[${this.layer.uid}] Version[${n}] FeatureLayerView2D._doUpdate`,{changes:o});let u=[];Array.isArray(s.source)&&(u=s.source),await this._worker.pipeline.updateSchema(a,n,{transferList:u}),e.updateEnd(),this.featureEffectView.featureEffect=t,this.featureEffectView.endTransitions(),this.featureContainer.attributeView.unlockTextureUploads(),this.featureContainer.swapRenderState(),this.featureContainer.requestRender(),has("esri-2d-update-debug")&&console.debug(`Version[${n}] FeatureLayerView2D.updateEnd`),this.requestUpdate()}catch(e){has("esri-2d-update-debug")&&console.error("Encountered an error during update",e)}}async _doEdit(e){try{this.featureContainer.editStart(),await this._worker.pipeline.onEdits(e),this.featureContainer.editEnd()}catch(t){p(t),0}}get hasFilter(){const e=this.layerAdapter.hasFilters?.(this.view)??!1;return null!=this.filter||null!=this.timeExtent||this._visibilityOverrides.size>0||e}_getEffectiveAvailableFields(e){const t=P(this._lastAvailableFields,e);return this._lastAvailableFields=t,v(this.layer.fieldsIndex,t)}_createViewSchemaConfig(){const e=[W(this.view,this.layerAdapter,this.timeExtent,this._visibilityOverrides,this.filter),this.featureEffect?.filter?.toJSON()??null];return{availableFields:this._getEffectiveAvailableFields(this.availableFields),filters:e,outSpatialReference:this.view.spatialReference,tileInfoJSON:this.view.featuresTilingScheme.tileInfo.toJSON(),scale:this.view.scale}}_addHighlight(e,t){this._highlightCounter.addReason(e,t),this._updateHighlight().catch((e=>{p(e)||u.getLogger(this).error(e)}))}_removeHighlight(e,t){this._highlightCounter.deleteReason(e,t),this._updateHighlight().catch((e=>{p(e)||u.getLogger(this).error(e)}))}_setLayersForFeature(e){e.layer=e.sourceLayer=this.layer,this.layerAdapter.setGraphicOrigin&&this.layerAdapter.setGraphicOrigin(e)}_createGraphicHit(e,t){return this._setLayersForFeature(t),null!=t.geometry&&(t.geometry.spatialReference=this.view.spatialReference),{type:"graphic",graphic:t,layer:this.layer,mapPoint:e}}};function W(e,t,r,s,i){i&&(i=i.clone());const a=null!=i?i.timeExtent:null,o=null!=r&&null!=a?r.intersection(a):r||a;o&&(i??=new w,i.timeExtent=o),i=t.addFilters?.(i,e)??i;let n=i?.toJSON()??null;return s.size&&(n??=(new w).toJSON(),n.hiddenIds=Array.from(s)),n}e([g()],Z.prototype,"_worker",void 0),e([g()],Z.prototype,"_commandsQueue",void 0),e([g()],Z.prototype,"_sourceRefreshVersion",void 0),e([g()],Z.prototype,"_displayRefreshVersion",void 0),e([g({readOnly:!0})],Z.prototype,"_pipelineUpdating",void 0),e([g({readOnly:!0})],Z.prototype,"hasAllFeatures",null),e([g({readOnly:!0})],Z.prototype,"hasAllFeaturesInView",null),e([g({readOnly:!0})],Z.prototype,"hasFullGeometries",null),e([g()],Z.prototype,"featureEffectView",void 0),e([g()],Z.prototype,"labelingCollisionInfos",null),e([g()],Z.prototype,"layerAdapter",null),e([g()],Z.prototype,"updateHash",null),e([g()],Z.prototype,"updating",void 0),Z=e([f(z)],Z);const X=Z;export{X as default};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../AggregateGraphic.js";import"../../../geometry.js";import r from"../../../Graphic.js";import{isSome as i}from"../../../core/arrayUtils.js";import s from"../../../core/Collection.js";import{neverReached as a}from"../../../core/compilerUtils.js";import o from"../../../core/Error.js";import{makeHandle as n}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import u from"../../../core/Logger.js";import{destroyMaybe as l}from"../../../core/maybe.js";import{debounce as h,throwIfNotAbortError as c,isAbortError as p}from"../../../core/promiseUtils.js";import{watch as d,initial as y}from"../../../core/reactiveUtils.js";import{property as g}from"../../../core/accessorSupport/decorators/property.js";import{subclass as f}from"../../../core/accessorSupport/decorators/subclass.js";import{diff as m}from"../../../core/accessorSupport/diffUtils.js";import _ from"../../../layers/effects/FeatureEffectView.js";import w from"../../../layers/support/FeatureFilter.js";import{packFields as v}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as b}from"../../../layers/support/layerUtils.js";import S from"../../../rest/support/AggregateFeatureSet.js";import F from"../../../rest/support/FeatureSet.js";import A from"../../../rest/support/Query.js";import{getHighlightBits as E}from"../engine/highlightReasons.js";import{LayerView2DMixin as V}from"./LayerView2D.js";import{FeatureContainer as C}from"./features/FeatureContainer.js";import{createFeaturePipelineWorkerProxy as R}from"./features/FeaturePipelineWorkerProxy.js";import{FeatureSourceEventLog as U}from"./features/FeatureSourceEventLog.js";import{CatalogFootprintLayerAdapter as j}from"./features/layerAdapters/CatalogFootprintLayerAdapter.js";import{FeatureLayerAdapter as x}from"./features/layerAdapters/FeatureLayerAdapter.js";import{InMemoryLayerAdapter as q}from"./features/layerAdapters/InMemoryLayerAdapter.js";import{KnowledgeGraphSublayerAdapter as Q}from"./features/layerAdapters/KnowledgeGraphSublayerAdapter.js";import{OGCFeatureLayerAdapter as k}from"./features/layerAdapters/OGCFeatureLayerAdapter.js";import{OrientedImageryLayerAdapter as I}from"./features/layerAdapters/OrientedImageryLayerAdapter.js";import{StreamLayerAdapter as O}from"./features/layerAdapters/StreamLayerAdapter.js";import{SubtypeGroupLayerAdapter as L}from"./features/layerAdapters/SubtypeGroupLayerAdapter.js";import{createComplexSymbolInstances as H}from"./features/schema/processor/symbols/ComplexSymbolSchema.js";import D from"./support/FeatureCommandQueue.js";import{HighlightCounter as J}from"./support/HighlightCounter.js";import{FeatureTileSubscriptionManager as N}from"../tiling/FeatureTileSubscriptionManager.js";import T from"../../layers/FeatureLayerView.js";import M from"../../layers/LayerView.js";import $ from"../../layers/RefreshableLayerView.js";import G from"../../../geometry/Extent.js";function P(e,t){const r=new Set;return e&&e.forEach((e=>r.add(e))),t&&t.forEach((e=>r.add(e))),r.has("*")?["*"]:Array.from(r)}const z="esri.views.2d.layers.FeatureLayerView2D",B=4294967294;async function Z(e,t){try{return await e}catch(r){if("no-queryEngine"!==r.name)throw r;return t}}let K=class extends(T($(V(M)))){constructor(){super(...arguments),this._commandsQueue=new D({process:e=>{switch(e.type){case"processed-edit":return this._doEdit(e);case"update":return this._doUpdate()}}}),this._visibilityOverrides=new Set,this._highlightCounter=new J,this._updateHighlight=h((async()=>{const e=[];for(const t of this._highlightCounter.ids()){const r=this._highlightCounter.getHighestReason(t),i=E(r);e.push({objectId:t,highlightFlags:i})}this._worker.pipeline.updateHighlight({highlights:e})})),this._lastAvailableFields=[],this.eventLog=new U,this._sourceRefreshVersion=1,this._displayRefreshVersion=1,this._pipelineUpdating=!1,this._fields=null,this.featureEffectView=new _}destroy(){this._worker?.destroy(),this._commandsQueue.destroy()}initialize(){this.addResolvingPromise(this._initProxy()),this.featureEffectView.featureEffect=this.featureEffect,this.featureEffectView.endTransitions()}async _initProxy(){const e=this.layer;if("isTable"in e&&e.isTable)throw new o("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e});if("mesh"===e.geometryType)throw new o("featurelayerview:geometry-type-not-supported",`Geometry type of ${e.geometryType} is not supported`,{layer:e});if(("feature"===e.type||"subtype-group"===e.type)&&!1===b(e)?.operations.supportsQuery)throw new o("featurelayerview:query-not-supported","layer view requires a layer with query capability",{layer:e});this._worker&&this._worker.destroy();const t=this._createClientOptions();this._worker=await R(t)}get hasAllFeatures(){return this.layer.visible&&this.eventLog.hasAllFeatures}get hasAllFeaturesInView(){return this.layer.visible&&this.eventLog.hasAllFeaturesInView}get hasFullGeometries(){return this.layer.visible&&this.eventLog.hasFullGeometries}get labelingCollisionInfos(){const e=this.layerAdapter.getLabelingDeconflictionInfo(this.view),t=this.layer.geometryType,r=!this.suspended;return e.map((({vvEvaluators:e,deconflictionEnabled:i})=>({container:this.featureContainer,vvEvaluators:e,deconflictionEnabled:i,geometryType:t,visible:r})))}get layerAdapter(){switch(this.layer.type){case"feature":return"memory"===this.layer.source.type?new q(this.layer):new x(this.layer);case"geojson":case"csv":case"wfs":return new q(this.layer);case"subtype-group":return new L(this.layer);case"ogc-feature":return new k(this.layer);case"stream":return new O(this.layer);case"oriented-imagery":return new I(this.layer);case"knowledge-graph-sublayer":return new Q(this.layer);case"catalog-footprint":return new j(this.layer);default:a(this.layer)}return null}get updateHash(){if(!this.layerAdapter)return null;const{availableFields:e,_displayRefreshVersion:t,timeExtent:r,clips:i,filter:s,featureEffect:a,_sourceRefreshVersion:o,view:{timeZone:n}}=this,u=JSON.stringify(i),l=a?.toJSON(),h=s?.toJSON();return JSON.stringify({availableFields:e,clipsHash:u,displayRefreshVersion:t,effectHash:l,filterHash:h,sourceRefreshVersion:o,timeExtent:r,timeZone:n,...this.layerAdapter.getUpdateHashProperties(this.view)})}getDisplayStatistics(e,t){return this.featureContainer?.getDisplayStatistics(e,t)}async queryHeatmapStatistics(e){return this._worker.pipeline.queryHeatmapStatistics(e)}highlight(e,t="highlight"){let a;e instanceof r?a=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?a=[e]:s.isCollection(e)&&e.length>0?a=e.map((e=>e?.getObjectId())).toArray():Array.isArray(e)&&e.length>0&&(a="number"==typeof e[0]||"string"==typeof e[0]?e:e.map((e=>e?.getObjectId())));const o=a?.filter(i);return o?.length?(this._addHighlight(o,t),n((()=>this._removeHighlight(o,t)))):n()}getHighlightIds(){return Array.from(this._highlightCounter.ids())}hasHighlight(){return!this._highlightCounter.empty}async hitTest(e,i){const s=await this.featureContainer.hitTest(i);if(0===s.length)return null;const{features:a,aggregates:o}=await this._worker.pipeline.getDisplayFeatures(s),n=this.featureContainer.getSortKeys(s),u=({displayId:e},{displayId:t})=>n.has(e)&&n.has(t)?n.get(e)-n.get(t):e-t;return a.sort(u).reverse(),o.sort(u).reverse(),[...o.map((r=>this._createGraphicHit(e,t.fromJSON(r)))),...a.map((t=>this._createGraphicHit(e,r.fromJSON(t))))]}queryStatistics(){return Z(this._worker.pipeline.queryStatistics(),{featureCount:0,ringCount:0,vertexCount:0})}querySummaryStatistics(e,t,r){const i={...t,scale:this.view.scale};return Z(this._worker.features.executeQueryForSummaryStatistics(this._cleanUpQuery(e),i,r),{})}async queryAggregateSummaryStatistics(e,t,r){const i={...t,scale:this.view.scale};return Z(this._worker.aggregates.executeQueryForSummaryStatistics(this._cleanUpAggregateQuery(e),i,r),{})}async queryUniqueValues(e,t,r){const i={...t,scale:this.view.scale};return Z(this._worker.features.executeQueryForUniqueValues(this._cleanUpQuery(e),i,r),{uniqueValueInfos:[]})}async queryAggregateUniqueValues(e,t,r){const i={...t,scale:this.view.scale};return Z(this._worker.aggregates.executeQueryForUniqueValues(this._cleanUpAggregateQuery(e),i,r),{uniqueValueInfos:[]})}async queryClassBreaks(e,t,r){const i={...t,scale:this.view.scale};return Z(this._worker.features.executeQueryForClassBreaks(this._cleanUpQuery(e),i,r),{classBreakInfos:[]})}async queryAggregateClassBreaks(e,t,r){const i={...t,scale:this.view.scale};return Z(this._worker.aggregates.executeQueryForClassBreaks(this._cleanUpAggregateQuery(e),i,r),{classBreakInfos:[]})}async queryHistogram(e,t,r){const i={...t,scale:this.view.scale};return Z(this._worker.features.executeQueryForHistogram(this._cleanUpQuery(e),i,r),{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}async queryAggregateHistogram(e,t,r){const i={...t,scale:this.view.scale};return Z(this._worker.aggregates.executeQueryForHistogram(this._cleanUpAggregateQuery(e),i,r),{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then((e=>{const t=F.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}async queryVisibleFeatures(e,t){const r=this._worker.pipeline.queryVisibleFeatures(this._cleanUpQuery(e),t),i=await Z(r,{features:[]}),s=F.fromJSON(i);return s.features.forEach((e=>this._setLayersForFeature(e))),s}async queryAggregates(e,t){const r=this._worker.aggregates.executeQuery(this._cleanUpAggregateQuery(e),t),i=await Z(r,{features:[]}),s=S.fromJSON(i);return s.features.forEach((e=>this._setLayersForFeature(e))),s}queryAggregateIds(e,t){return Z(this._worker.aggregates.executeQueryForIds(this._cleanUpAggregateQuery(e),t),[])}queryAggregateCount(e,t){return Z(this._worker.aggregates.executeQueryForCount(this._cleanUpAggregateQuery(e),t),0)}queryAggregateJSON(e,t){return Z(this._worker.aggregates.executeQuery(this._cleanUpAggregateQuery(e),t),{features:[]})}async queryFeaturesJSON(e,t){return Z(this._worker.features.executeQuery(this._cleanUpQuery(e),t),{features:[]})}queryObjectIds(e,t){return Z(this._worker.features.executeQueryForIds(this._cleanUpQuery(e),t),[])}queryFeatureCount(e,t){return Z(this._worker.features.executeQueryForCount(this._cleanUpQuery(e),t),0)}async queryExtent(e,t){const r=this._worker.features.executeQueryForExtent(this._cleanUpQuery(e),t),i=await Z(r,{count:0,extent:null});return{count:i.count,extent:G.fromJSON(i.extent)}}async getSampleFeatures(e){return this._worker.pipeline.getSampleFeatures(e)}setVisibility(e,t){t?this._visibilityOverrides.delete(e):this._visibilityOverrides.add(e),this._update()}update(e){if(!this._subscriptionManager)return;const t=this._subscriptionManager.update(e);this.featureContainer.setVisibleTiles(t)}attach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.attach"),this.featureContainer=new C(this),this.container.addChild(this.featureContainer),this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this._subscriptionManager=new N({tileInfoView:this.view.featuresTilingScheme,updateSubscriptions:e=>{this.featureContainer.updateSubscriptions(e),this._worker.pipeline.updateSubscriptions(e)},isDone:e=>this.featureContainer.isDone(e)}),this.requestUpdate(),this.addAttachHandles([d((()=>this.updateHash),(()=>this._update()),y),d((()=>this.updateSuspended),(e=>{e||this._subscriptionManager.resume()}))]),"stream"!==this.layer.type&&"catalog-footprint"!==this.layer.type&&this.addAttachHandles(this.layer.on("edits",(e=>this._edit(e))))}detach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.detach"),this._fields=null,this.featureContainer.destroy(),this._commandsQueue.clear(),this.container.removeAllChildren(),this._subscriptionManager=l(this._subscriptionManager),this._worker.pipeline.onDetach()}moveStart(){this.requestUpdate()}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}isUpdating(){const e="renderer"in this.layer&&null!=this.layer.renderer,t=this._commandsQueue.updateTracking.updating,r=null!=this._updatingRequiredFieldsPromise,i=this.featureContainer.updatingHandles.updating,s=e&&(t||r)||i||this._pipelineUpdating||this.dataUpdating;if(has("esri-2d-log-updating")){console.log(`Updating FLV2D (${this.layer.id}): ${s}\n -> hasRenderer ${e}\n -> updatingRequiredFields ${r}\n -> hasPendingCommand ${t}\n -> dataUpdating ${this.dataUpdating}\n -> processing ${this._pipelineUpdating}\n -> updatingContainer ${i}\n`);for(const e of this.featureContainer.subscriptions())console.log(` -> Tile[${e.id}] Done: ${e.done}`)}return s}_createClientOptions(){const e=this;return{get container(){return e.featureContainer},setUpdating:e=>{this._set("_pipelineUpdating",e.pipeline),this._set("dataUpdating",e.data)},emitEvent:e=>{this.emit(e.name,e.event)},get eventLog(){return e.eventLog},fetch:t=>Promise.all(t.map((t=>e.view.stage.painter.textureManager.rasterizeItem(t)))),fetchDictionary:e=>Promise.all(e.map((e=>this._fetchDictionaryRequest(e))))}}async _fetchDictionaryRequest(e){try{if("subtype-group"===this.layer.type)throw new Error("InternalError: SubtypeGroupLayer does not support dictionary renderer");const t=this.layer.renderer;if(!t||"dictionary"!==t.type)throw new Error("InternalError: Expected layer to have a DictionaryRenderer");const r=this._lastSchema.processor.mesh.factory.symbology;if("dictionary"!==r.type)throw new Error("InternalError: Expected schema to be of type 'dictionary'");const i={cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,store:this.featureContainer.instanceStore,scaleExpression:r.scaleExpression};this._fields||(this._fields=this.layer.fields.map((e=>e.toJSON())));const s=r.visualVariableUniforms,a=await t.getSymbolAsync(e.feature,{fields:this._fields});if(!a||!a.data)return{type:"dictionary-response",meshes:[]};return{type:"dictionary-response",meshes:await H(a.data,{uniforms:s,path:"renderer",schemaOptions:i})}}catch(t){return{type:"dictionary-response",meshes:[]}}}_cleanUpQuery(e){const t=A.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAggregateQuery(e){const t=A.from(e)||this.createAggregateQuery();t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference);const r=t.objectIds??[];for(const i of t.aggregateIds??[])r.push(i);return t.objectIds=r,t.aggregateIds=[],t.toJSON()}async _update(){return this._commandsQueue.push({type:"update"})}async _edit(e){if(this.updateSuspended)return void this._subscriptionManager.suspend();return this._validateEdit(e)?this._commandsQueue.push({type:"edit",edits:e}).catch(c):void 0}async doRefresh(e){this.attached&&(this.updateSuspended&&e||(e?this.incrementSourceRefreshVersion():this.incrementDisplayRefreshVersion()))}incrementSourceRefreshVersion(){this._sourceRefreshVersion=(this._sourceRefreshVersion+1)%B+1}incrementDisplayRefreshVersion(){this._displayRefreshVersion=(this._displayRefreshVersion+1)%B+1}_validateEdit(e){const t="globalIdField"in this.layer&&this.layer.globalIdField,r=e.deletedFeatures.some((e=>-1===e.objectId||!e.objectId)),i=t&&this.availableFields.includes(t);return r&&!i?(u.getLogger(this).error(new o("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected on the map`)),null):e}async _doUpdate(){"featureReduction"in this.layer&&this.layer.featureReduction&&this.layer.featureReduction!==this._lastFeatureReduction&&(this.layer.featureReduction=this.layer.featureReduction?.clone(),this._lastFeatureReduction=this.layer.featureReduction);try{if(await this._updateRequiredFields(),this.destroyed||!this.layerAdapter?.hasRequiredSupport||!this._subscriptionManager)return;const e=this.featureContainer.instanceStore;this.featureContainer.attributeView.lockTextureUploads(),e.updateStart();const t=this.featureEffect,r={store:e,cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,scaleExpression:void 0},i=await this.layerAdapter.createServiceOptions(this.view),s=this._createViewSchemaConfig(),a={source:this.layerAdapter.createSourceSchema(i,s,this._sourceRefreshVersion),processor:await this.layerAdapter.createProcessorSchema(r,s,this._displayRefreshVersion)},o=!!m(this._lastSchema?.source.mutable,a.source.mutable)||!!m(this._lastSchema?.processor,a.processor);if(!o)return this.featureContainer.requestRender(),this.featureContainer.attributeView.unlockTextureUploads(),e.updateEnd(),void(this.featureEffectView.featureEffect=t);this._lastSchema=a,this._fields=null;const n=Math.round(performance.now());has("esri-2d-update-debug")&&console.debug(`Id[${this.layer.uid}] Version[${n}] FeatureLayerView2D._doUpdate`,{changes:o});let u=[];Array.isArray(i.source)&&(u=i.source),await this._worker.pipeline.updateSchema(a,n,{transferList:u}),e.updateEnd(),this.featureEffectView.featureEffect=t,this.featureEffectView.endTransitions(),this.featureContainer.attributeView.unlockTextureUploads(),this.featureContainer.swapRenderState(),this.featureContainer.requestRender(),has("esri-2d-update-debug")&&console.debug(`Version[${n}] FeatureLayerView2D.updateEnd`),this.requestUpdate()}catch(e){has("esri-2d-update-debug")&&console.error("Encountered an error during update",e)}}async _doEdit(e){try{this.featureContainer.editStart(),await this._worker.pipeline.onEdits(e),this.featureContainer.editEnd()}catch(t){p(t),0}}get hasFilter(){const e=this.layerAdapter.hasFilters?.(this.view)??!1;return null!=this.filter||null!=this.timeExtent||this._visibilityOverrides.size>0||e}_getEffectiveAvailableFields(e){const t=P(this._lastAvailableFields,e);return this._lastAvailableFields=t,v(this.layer.fieldsIndex,t)}_createViewSchemaConfig(){const e=[W(this.view,this.layerAdapter,this.timeExtent,this._visibilityOverrides,this.filter),this.featureEffect?.filter?.toJSON()??null];return{availableFields:this._getEffectiveAvailableFields(this.availableFields),filters:e,outSpatialReference:this.view.spatialReference,tileInfoJSON:this.view.featuresTilingScheme.tileInfo.toJSON(),scale:this.view.scale,timeZone:this.view.timeZone}}_addHighlight(e,t){this._highlightCounter.addReason(e,t),this._updateHighlight().catch((e=>{p(e)||u.getLogger(this).error(e)}))}_removeHighlight(e,t){this._highlightCounter.deleteReason(e,t),this._updateHighlight().catch((e=>{p(e)||u.getLogger(this).error(e)}))}_setLayersForFeature(e){e.layer=e.sourceLayer=this.layer,this.layerAdapter.setGraphicOrigin&&this.layerAdapter.setGraphicOrigin(e)}_createGraphicHit(e,t){return this._setLayersForFeature(t),null!=t.geometry&&(t.geometry.spatialReference=this.view.spatialReference),{type:"graphic",graphic:t,layer:this.layer,mapPoint:e}}};function W(e,t,r,i,s){s&&(s=s.clone());const a=null!=s?s.timeExtent:null,o=null!=r&&null!=a?r.intersection(a):r||a;o&&(s??=new w,s.timeExtent=o),s=t.addFilters?.(s,e)??s;let n=s?.toJSON()??null;return i.size&&(n??=(new w).toJSON(),n.hiddenIds=Array.from(i)),n}e([g()],K.prototype,"_worker",void 0),e([g()],K.prototype,"_commandsQueue",void 0),e([g()],K.prototype,"_sourceRefreshVersion",void 0),e([g()],K.prototype,"_displayRefreshVersion",void 0),e([g({readOnly:!0})],K.prototype,"_pipelineUpdating",void 0),e([g({readOnly:!0})],K.prototype,"hasAllFeatures",null),e([g({readOnly:!0})],K.prototype,"hasAllFeaturesInView",null),e([g({readOnly:!0})],K.prototype,"hasFullGeometries",null),e([g()],K.prototype,"featureEffectView",void 0),e([g()],K.prototype,"labelingCollisionInfos",null),e([g()],K.prototype,"layerAdapter",null),e([g()],K.prototype,"updateHash",null),e([g()],K.prototype,"updating",void 0),K=e([f(z)],K);const X=K;export{X 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 has from"../../../../core/has.js";import{destroyMaybe as t}from"../../../../core/maybe.js";import{ignoreAbortErrors as e,throwIfNotAbortError as s,throwIfAborted as r}from"../../../../core/promiseUtils.js";import{diff as i,hasDiff as a}from"../../../../core/accessorSupport/diffUtils.js";import o from"../../../../geometry/SpatialReference.js";import
|
|
5
|
+
import has from"../../../../core/has.js";import{destroyMaybe as t}from"../../../../core/maybe.js";import{ignoreAbortErrors as e,throwIfNotAbortError as s,throwIfAborted as r}from"../../../../core/promiseUtils.js";import{diff as i,hasDiff as a}from"../../../../core/accessorSupport/diffUtils.js";import o from"../../../../geometry/SpatialReference.js";import{MultiTileMeshData as n}from"../../engine/webgl/mesh/MultiTileMeshData.js";import{FeatureMeshFactory as c}from"../../engine/webgl/mesh/factories/FeatureMeshFactory.js";import{ResourceProxy as h}from"../../engine/webgl/mesh/factories/ResourceProxy.js";import{BinningStrategy as u}from"./processor/BinningStrategy.js";import{ClusterStrategy as g}from"./processor/ClusterStrategy.js";import{FeatureUpdateStrategy as d}from"./processor/FeatureUpdateStrategy.js";import{AttributeStore as y}from"./support/AttributeStore.js";import{ComputedAttributeStorage as _}from"./support/ComputedAttributeStorage.js";import{QueueProcessor as p}from"../../../support/QueueProcessor.js";class l{constructor(t,s){this._connection=t,this._source=s,this._version=1,this._queue=new p({concurrency:1,process:t=>this._process(t)}),this._proxy=new h({fetch:(t,e)=>this._connection.layerView.fetch(t,e),fetchDictionary:(t,e)=>this._connection.layerView.fetchDictionary(t,e)}),this._attributeStore=new y({isLocal:!1,update:t=>e(this._connection.container.updateAttributeView(t))})}destroy(){this._proxy.destory(),this._strategy?.destroy(),this._attributeStore.destroy()}get aggregateQueryEngine(){return this._strategy?.aggregateQueryEngine}getDisplayFeatures(t){return this._strategy?this._strategy.getDisplayFeatures(t):{features:[],aggregates:[]}}getFeatureObjectIdsForAggregate(t){return this._strategy?this._strategy.getFeatureObjectIdsForAggregate(t):[]}onSubscribe(t){this._strategy?.onSubscribe(t)}onUnsubscribe(t){this._strategy?.onUnsubscribe(t)}async update(t,e,s,r,n){const h=t.processor,u=i(this._schema,h);if(!u&&!r)return;has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] SymbolProcessor.update`,{changes:u,schema:h}),this._schema=h;const g=o.fromJSON(t.source.mutable.dataFilter.outSpatialReference),d=new _({fields:this._source.metadata.fieldsIndex,spatialReference:g});return await this._attributeStore.update(h.storage,d,this._source.metadata,g,e),this._strategy?.invalidateAttributeData(),r||a(u,"mesh")?(a(u,"mesh.strategy")&&await this._updateStrategy(h.mesh.strategy,g,n,h.mesh.timeZone),this._updateSortKey(d,"sortKey"in h.mesh?h.mesh.sortKey:null),(a(u,"mesh.factory")||"dictionary"===h.mesh.factory.symbology.type)&&(this._factory=await c.create(d,this._proxy,h.mesh.factory,s)),this._invalidate(),this._version=e,this._connection.container.updateRenderState(this._version)):void 0}async applyOverride(t){if(!this._strategy)return;const e=this._strategy.applyOverride(t);for await(const r of e)try{await this._process(r)}catch(s){}this._source.applyOverride(t)}async updateChunks(){return this._doUpdateChunks()}async removeChunks(t){this._strategy?.removeChunks(t),this._attributeStore.incrementDisplayIdGeneration()}updateHighlight({highlights:t}){if(!this._strategy)return void this._attributeStore.setHighlight(t.map((({objectId:t,highlightFlags:e})=>({objectId:t,highlightFlags:e,displayId:-1}))),t);const e=this._strategy.displayMap(t,(({objectId:t})=>t),((t,{highlightFlags:e},s)=>({objectId:s,displayId:t,highlightFlags:e})));this._attributeStore.setHighlight(e,t)}async _doUpdateChunks(){if(!this._strategy)return;const t=this._strategy.updateChunks(),e=[];for await(const i of t){const t=this._queue.push(i).catch((t=>s(t)));e.push(t)}try{await Promise.all(e)}catch(r){}has("esri-2d-update-debug")&&console.log("SendUpdates"),await this._attributeStore.sendUpdates(),has("esri-2d-update-debug")&&console.log("SendUpdates.await")}async _updateStrategy(t,e,s,r){switch(this._strategy?.destroy(),t.type){case"feature":this._strategy=new d(this._source,this._attributeStore,r);break;case"binning":this._strategy=await u.create(t,e,this._source,this._attributeStore,r);break;case"cluster":this._strategy=await g.create(this._connection,t,e,this._source,this._attributeStore,r)}for(const i of s)this._strategy.onSubscribe(i)}async _updateSortKey(e,s){if(this._sortInfo=t(this._sortInfo?.computed),null!=s){const t=s.byRenderer?null:await e.createComputedField(s);this._sortInfo={...s,computed:t}}}_invalidate(){this._strategy&&this._strategy.invalidate()}async _process(t){const e=t.subscription;if(has("esri-2d-update-debug")){const s=e.tile;console.debug(`Version[${this._version}] Tile[${s.key.id}, end=${t.end}] Processor._process`)}await this._fetchResources(t),r(e.signal);const s=await this._write(t,e.tile.createArcadeEvaluationOptions(this._schema.mesh.timeZone)),i=e.tile.tileInfoView.tileInfo.isWrappable,{message:a,transferList:o}=s.serialize(i),n=t.createMessage(a,this._version,this._attributeStore.epoch);if(r(e.signal),await this._connection.container.onMessage(n,{signal:e.signal,transferList:o}),await this._attributeStore.sendUpdates(),has("esri-2d-update-debug")){const s=e.tile;console.debug(`Version[${this._version}] Tile[${s.key.id}, end=${t.end}] Processor._process.await`)}}async _fetchResources(t){await this._fetchMatcherResources(t),await this._fetchWriterResources(t)}async _fetchMatcherResources(t){if(t.reader)return this._factory.enqueueMatcherRequests(this._proxy,t.reader)}async _fetchWriterResources(t){if(!t.reader)return;const e=t.reader.getCursor(),s=t.subscription.tile.createArcadeEvaluationOptions(this._schema.mesh.timeZone);for(;e.next();)this._factory.enqueueWriterRequests(this._proxy,e,s);await this._proxy.fetchEnqueuedResources()}async _write(t,e){const s=t.subscription.tile,r=t.reader?.getCursor(),i=r?.getSize()??0,a=new n(s.key.id,this._strategy.enablePixelBuffering,i);if(!r)return a;const o=s.createArcadeEvaluationOptions(this._schema.mesh.timeZone);for(;r.next();){const t=this._getSortKeyValue(r,e);a.entityStart(r.getDisplayId(),t),this._factory.write(a,this._proxy,r,o,s.level),a.entityEnd()}return a}_getSortKeyValue(t,e){if(!this._sortInfo)return 0;const{computed:s,order:r,byRenderer:i}=this._sortInfo,a=i?this._factory.getSortKey(t,e):s?.read(t,e);return null==a||isNaN(a)?0:a*("asc"===r?-1:1)}}export{l as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{GeohashTree as e}from"../../../../../geohash/GeohashTree.js";import{getGeohash as
|
|
5
|
+
import{GeohashTree as e}from"../../../../../geohash/GeohashTree.js";import{getGeohash as t}from"../../../../../geohash/geohashUtils.js";import{tileSize as r}from"../../../engine/webgl/definitions.js";class o{constructor(t){this._options=t,this._tree=new e(t.fields)}insert(e,t){const r=e.getCursor(),o={$view:{scale:0,timeZone:this._options.timeZone}};for(;r.next();)this._insertFeature(r,o,t)}putBins(e,t){this._tree.putBins(e,t)}_insertFeature(e,o,s){const{featureFilter:i,geohashLevel:n,spatialReference:a}=this._options;if(null!==i&&!i.check(e))return;let l=0,c=0;if("esriGeometryPoint"===e.geometryType)l=e.readXWorldSpace(),c=e.readYWorldSpace();else{if(s){const t=e.readCentroidForDisplay();if(null==t)return;const[o,s]=t.coords;if(o<0||o>r||s<0||s>r)return}const t=e.readCentroidWorldSpace();if(null==t)return;l=t.coords[0],c=t.coords[1]}const h=t(l,c,n,a);h&&this._tree.insert(e,l,c,h[0],h[1],n,o)}}export{o as GeohashSpatialIndex};
|
|
@@ -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{getMetersPerUnitForSR as e,inchesPerMeter as t}from"../../../../../core/unitUtils.js";import{tileSize as i}from"../../../engine/webgl/definitions.js";import{GridCell as s}from"./GridCell.js";const o=96;function l(i,s){return e(i)*t*o/s}class r{constructor(e){this._options=e,this._cells=new Map,this._pixelsPerMapUnit=l(e.spatialReference,e.scale)}insert(e,t){const i=e.getCursor(),s={$view:{scale:this._options.scale}};for(;i.next();)this._insertFeature(i,s,t)}putCellsInBounds(e,t){const[i,s,o,l]=t,r=Math.floor(i*this._pixelsPerMapUnit/this._options.cellSize),n=Math.floor(s*this._pixelsPerMapUnit/this._options.cellSize),c=Math.ceil(o*this._pixelsPerMapUnit/this._options.cellSize),p=Math.ceil(l*this._pixelsPerMapUnit/this._options.cellSize);for(let a=n;a<=p;a++)for(let t=r;t<=c;t++){const i=`${t}.${a}`,s=this._cells.get(i);if(!s)continue;const o=e.get(s.id);o?s&&!e.has(s.id)&&o.merge(s):e.set(s.id,s.clone())}}putCells(e){for(const t of this._cells.values()){const i=e.get(t.id);i?i.merge(t):e.set(t.id,t.clone())}}_insertFeature(e,t,s){const{featureFilter:o}=this._options;if(null!==o&&!o.check(e))return;let l=0,r=0;if("esriGeometryPoint"===e.geometryType)l=e.readXWorldSpace(),r=e.readYWorldSpace();else{if(s){const t=e.readCentroidForDisplay();if(null==t)return;const[s,o]=t.coords;if(s<0||s>i||o<0||o>i)return}const t=e.readCentroidWorldSpace();if(null==t)return;l=t.coords[0],r=t.coords[1]}const n=l*this._pixelsPerMapUnit,c=r*this._pixelsPerMapUnit,p=Math.floor(n/this._options.cellSize),a=Math.floor(c/this._options.cellSize);this._getCellOrCreate(p,a).insert(e,t,l,r)}_getCellOrCreate(e,t){const i=s.createId(e,t);let o=this._cells.get(i);if(!o){const l=1*this._options.cellSize/this._pixelsPerMapUnit;o=s.create(e,t,this._options.fields,l),this._cells.set(i,o)}return o}}export{r as GridSpatialIndex,l as pixelsPerMapUnit};
|
|
5
|
+
import{getMetersPerUnitForSR as e,inchesPerMeter as t}from"../../../../../core/unitUtils.js";import{tileSize as i}from"../../../engine/webgl/definitions.js";import{GridCell as s}from"./GridCell.js";const o=96;function l(i,s){return e(i)*t*o/s}class r{constructor(e){this._options=e,this._cells=new Map,this._pixelsPerMapUnit=l(e.spatialReference,e.scale)}insert(e,t){const i=e.getCursor(),s={$view:{scale:this._options.scale,timeZone:this._options.timeZone}};for(;i.next();)this._insertFeature(i,s,t)}putCellsInBounds(e,t){const[i,s,o,l]=t,r=Math.floor(i*this._pixelsPerMapUnit/this._options.cellSize),n=Math.floor(s*this._pixelsPerMapUnit/this._options.cellSize),c=Math.ceil(o*this._pixelsPerMapUnit/this._options.cellSize),p=Math.ceil(l*this._pixelsPerMapUnit/this._options.cellSize);for(let a=n;a<=p;a++)for(let t=r;t<=c;t++){const i=`${t}.${a}`,s=this._cells.get(i);if(!s)continue;const o=e.get(s.id);o?s&&!e.has(s.id)&&o.merge(s):e.set(s.id,s.clone())}}putCells(e){for(const t of this._cells.values()){const i=e.get(t.id);i?i.merge(t):e.set(t.id,t.clone())}}_insertFeature(e,t,s){const{featureFilter:o}=this._options;if(null!==o&&!o.check(e))return;let l=0,r=0;if("esriGeometryPoint"===e.geometryType)l=e.readXWorldSpace(),r=e.readYWorldSpace();else{if(s){const t=e.readCentroidForDisplay();if(null==t)return;const[s,o]=t.coords;if(s<0||s>i||o<0||o>i)return}const t=e.readCentroidWorldSpace();if(null==t)return;l=t.coords[0],r=t.coords[1]}const n=l*this._pixelsPerMapUnit,c=r*this._pixelsPerMapUnit,p=Math.floor(n/this._options.cellSize),a=Math.floor(c/this._options.cellSize);this._getCellOrCreate(p,a).insert(e,t,l,r)}_getCellOrCreate(e,t){const i=s.createId(e,t);let o=this._cells.get(i);if(!o){const l=1*this._options.cellSize/this._pixelsPerMapUnit;o=s.create(e,t,this._options.fields,l),this._cells.set(i,o)}return o}}export{r as GridSpatialIndex,l as pixelsPerMapUnit};
|
|
@@ -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{getGeohashBounds as e}from"../../../../../geohash/geohashUtils.js";import{unquantizeOptimizedGeometry as t,convertToFeature as s}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as r}from"../../../../../layers/graphics/OptimizedFeature.js";import{ComputedAggregateField as a}from"../aggregation/ComputedAggregateField.js";import{AAggregateStrategy as
|
|
5
|
+
import"../../../../../geometry.js";import{getGeohashBounds as e}from"../../../../../geohash/geohashUtils.js";import{unquantizeOptimizedGeometry as t,convertToFeature as s}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as r}from"../../../../../layers/graphics/OptimizedFeature.js";import{checkProjectionSupport as o}from"../../../../../layers/graphics/data/projectionSupport.js";import{ComputedAggregateField as a}from"../aggregation/ComputedAggregateField.js";import{AAggregateStrategy as i}from"./AAggregateStrategy.js";import{ASendState as n}from"./AProcessorStrategy.js";import{FeatureTileUpdateMessage as l}from"../sources/FeatureSourceMessage.js";import{ComputedAttributeStorage as d}from"../support/ComputedAttributeStorage.js";import c from"../support/FeatureFilter.js";import{FeatureMetadata as u}from"../support/FeatureMetadata.js";import{FeatureSetReaderJSON as p}from"../support/FeatureSetReaderJSON.js";import f from"../../../tiling/TileKey.js";import h from"../../../../../geometry/SpatialReference.js";class m extends n{constructor(e,t){super(e),this.bins=new Map,this.done=!1,this._store=t}reset(){this.destroy(),this.bins.clear(),this.done=!1,this.handledChunks.clear()}destroy(){const e=this.subscription.tile.key.level;for(const t of this.bins.values()){const s=t.cachedFeature?.objectId;null!=s&&this._store.releaseDisplayIdForObjectId(`${s}.${e}`)}}*featuresWorldSpace(){for(const e of this.bins.values()){const s=e.cachedFeature;if(s){const e=s.clone();t(e.geometry,e.geometry,!1,!1,this.subscription.tile.transform),yield e}}}getGeohashBounds(t,s){const r=this.subscription.tile;return e(r.extent,r.resolution,s,t)}}class g extends i{static async create(e,t,s,r,i){const n=new d({spatialReference:t}),l=e.fixedBinLevel,u=await Promise.all(e.fields.map((async e=>a.create(n,e)))),p=e.featureFilter?await c.create({geometryType:s.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:s.metadata.timeInfo,fieldsIndex:s.metadata.fieldsIndex,spatialReference:t,filterJSON:e.featureFilter}):null;return await o(t,h.WGS84),new g({fields:u,geohashLevel:l,spatialReference:t,featureFilter:p,timeZone:i},e.fields,s,r)}constructor(e,t,s,r){super(s,r,e.spatialReference,e.fields),this._indexOptions=e,this._metadata=new u({geometryType:"esriGeometryPolygon",objectIdField:"aggregateId",fields:t,globalIdField:null,spatialReference:s.metadata.spatialReference,subtypeField:null,subtypes:null,timeInfo:null,timeReferenceUnknownClient:null,typeIdField:null,types:null})}createState(e){return new m(e,this._attributeStore)}async*applyOverride(e){for(const t of this._sendStates.values())t.reset()}displayMap(e,t,s){const r=new Map(e.map((e=>[t(e),e]))),o=[];for(const a of this._sendStates.values())for(const e of a.featuresWorldSpace()){const{objectId:t,displayId:a}=e,i=r.get(t);if(null!=i){const e=s(a,i,t);o.push(e),r.delete(t)}}return o}getDisplayFeatures(e){const t=new Set(e),r=new Set,o=[];for(const a of this._sendStates.values())for(const e of a.featuresWorldSpace())t.has(e.displayId)&&!r.has(e.objectId)&&(e.geometry&&o.push({...s(e,this._metadata.geometryType,!1,!1),displayId:e.displayId}),r.add(e.objectId));return{features:[],aggregates:o}}getFeatureObjectIdsForAggregate(e){for(const t of this._sendStates.values())for(const s of t.bins.values())if(s.id===e)return Array.from(s.objectIds);return[]}async*updateChunks(){if(this._source.chunks().length)for(const e of this._sendStates.values())yield*this._update(e,this._source)}forEachAggregateWorldSpace(e){for(const t of this._sendStates.values())for(const s of t.featuresWorldSpace())e(s)}async*_update(e,t){const{handledChunks:s,subscription:o,bins:a}=e,{spatialReference:i,geohashLevel:n}=this._indexOptions,d=o.tile;if(e.done)return;for(const r of t.chunks()){if(s.has(r.chunkId))continue;s.add(r.chunkId);const t=r.queryInfo;if("tileId"in t){const e=new f(t.tileId);if(e.level!==d.level||e.world!==d.key.world)continue}const o=r.getGeohashIndex(this._indexOptions),l=e.getGeohashBounds(i,n);null!=l&&o.putBins(a,l)}const c=[],u=o.tile.transform,h=o.tile.key.level;for(const l of a.values()){if(l.cachedFeature)l.cachedFeature.attributes=l.getAttributes();else{const e=l.getGeometry(this.spatialReference,u),t=new r(e,l.getAttributes(),null);e||(t.centroid=l.getGeometryCentroid(this.spatialReference,u)),t.objectId=l.id,t.displayId=this._attributeStore.createDisplayIdForObjectId(`${t.objectId}.${h}`),l.cachedFeature=t}c.push(l.cachedFeature)}this.events.emit("changed"),e.done=!t.updateTracking.updating;const m=p.fromOptimizedFeatures(c,this._metadata,u),g=m.getCursor(),y=e.subscription.tile.createArcadeEvaluationOptions(this._indexOptions.timeZone);for(;g.next();)this._attributeStore.setAttributeData(g.getDisplayId(),g,y);const b=new l(e.subscription,m,[],e.done,{});yield b}}export{m as BinningState,g as BinningStrategy};
|
|
@@ -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{convertToFeature as e}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as t}from"../../../../../layers/graphics/OptimizedFeature.js";import{tileSize as s}from"../../../engine/webgl/definitions.js";import{ComputedAggregateField as i}from"../aggregation/ComputedAggregateField.js";import{GridCell as r}from"../aggregation/GridCell.js";import{pixelsPerMapUnit as
|
|
5
|
+
import{convertToFeature as e}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as t}from"../../../../../layers/graphics/OptimizedFeature.js";import{tileSize as s}from"../../../engine/webgl/definitions.js";import{ComputedAggregateField as i}from"../aggregation/ComputedAggregateField.js";import{GridCell as r}from"../aggregation/GridCell.js";import{pixelsPerMapUnit as a}from"../aggregation/GridSpatialIndex.js";import{AAggregateStrategy as n}from"./AAggregateStrategy.js";import{ASendState as l}from"./AProcessorStrategy.js";import{WithDisplayId as o}from"./support/WithDisplayId.js";import{FeatureTileAppendMessage as d}from"../sources/FeatureSourceMessage.js";import{ComputedAttributeStorage as c}from"../support/ComputedAttributeStorage.js";import u from"../support/FeatureFilter.js";import{FeatureMetadata as h}from"../support/FeatureMetadata.js";import{FeatureSetReaderJSON as p}from"../support/FeatureSetReaderJSON.js";import f from"../../../tiling/TileKey.js";const g=128;class _ extends l{constructor(e){super(e),this.didSend=!1,this.done=!1}}class m{constructor(e,t,s,i,r){this._level=e,this._scale=t,this._indexOptions=s,this._clusterRadius=i,this._store=r,this._cells=new Map,this._handledChunks=new Set,this._statistics=new Map,this._clusters=new Map}destroy(){this._clearClusters()}_clearClusters(){for(const e of this._clusters.values())this._store.releaseDisplayIdForObjectId(e.inner.id);this._clusters.clear()}*aggregatesWorldSpace(){for(const e of this._clusters.values()){const s=e.inner.getCentroid(null),i=new t(s,e.inner.getAttributes(),null);i.objectId=e.inner.id,i.displayId=e.displayId,yield i}}clusters(){return this._clusters.values()}updateChunks(e){let t=!1;for(const s of e){const e=s.queryInfo;if("tileId"in e){if(new f(e.tileId).level!==this._level)continue}if(!this._handledChunks.has(s.normalizedChunkId)){this._handledChunks.add(s.normalizedChunkId),t=!0;s.getGridIndex({...this._indexOptions,scale:this._scale}).putCells(this._cells)}}return t&&this._clusterCells(),t}async updateStatistics(e){let t=!1;for(const s of this._clusters.values())s.inner.count>1&&(t=this._updateAggregateStatistics(this._statistics,s.inner)||t);if(t){const t=Array.from(this._statistics.entries()).map((([e,t])=>({fieldName:e,minValue:t.minValue,maxValue:t.maxValue})));await e.container.updateStatistics(this._level,t)}}createAggregateFeatures(e,i){const r=e.subscription,a=[],n=r.tile.transform;for(const l of this._clusters.values()){const e=l.inner.getCentroid(n),i=new t(e,l.inner.getAttributes(),null);i.objectId=l.inner.id,i.displayId=l.displayId;const o=i.geometry.coords,d=r.tile.lod,c=d.wrap?d.worldSize[0]:null;if(null!=c)if(1===c){const e=i.clone();e.geometry.coords[0]-=s,a.push(e);const t=i.clone();t.geometry.coords[0]+=s,a.push(t)}else o[0]>s+s/2?o[0]-=c*s:o[0]<-s/2&&(o[0]+=c*s);const[u,h]=i.geometry.coords;u<s+g&&u>=-g&&h<s+g&&h>=-g&&a.push(i)}return p.fromOptimizedFeatures(a,i,r.tile.transform)}_clusterCells(){let e=Array.from(this._cells.values());e=e.sort(((e,t)=>t.count-e.count));const t=[];for(const i of this._clusters.values())t.push(i.inner.id);this._clusters.clear();const s=new Set;for(const i of e){if(s.has(i.id))continue;const e=this._store.createDisplayIdForObjectId(i.id),t=new o(i.clone(),e);s.add(i.id),this._clusters.set(i.id,t);const n=this._clusterRadius*(1/a(this._indexOptions.spatialReference,this._scale)),l=1+this._clusterRadius/this._indexOptions.cellSize,d=i.centroidXWorld,c=i.centroidYWorld;for(let a=i.gridY-l;a<=i.gridY+l;a++)for(let e=i.gridX-l;e<=i.gridX+l;e++){if(a===i.gridY&&e===i.gridX)continue;const l=this._cells.get(r.createId(e,a));if(!l||s.has(l.id))continue;const o=Math.abs(l.centroidXWorld-d),u=Math.abs(l.centroidYWorld-c);o<n&&u<n&&(t.inner.merge(l),s.add(l.id))}}for(const i of t)this._store.releaseDisplayIdForObjectId(i)}_updateAggregateStatistics(e,t){let s=!1;for(const i of t.statistics.values()){if("esriFieldTypeString"===i.field.type)continue;const t=i.value,r=i.field,a=e.get(r.name);if(a){const{minValue:e,maxValue:i}=a,r=Math.min(a.minValue,t),n=Math.max(a.maxValue,t);e===r&&i===n||(a.minValue=r,a.maxValue=n,s=!0)}else e.set(r.name,{minValue:t,maxValue:t}),s=!0}return s}}class y extends n{static async create(e,t,s,r,a,n){const l=new c({spatialReference:s}),o={fields:await Promise.all(t.fields.map((async e=>i.create(l,e)))),spatialReference:s,featureFilter:t.featureFilter?await u.create({geometryType:r.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:r.metadata.timeInfo,fieldsIndex:r.metadata.fieldsIndex,spatialReference:s,filterJSON:t.featureFilter}):null,cellSize:t.clusterRadius/4,timeZone:n};return new y(e,t.clusterRadius,o,t.fields,r,a)}constructor(e,t,s,i,r,a){super(r,a,s.spatialReference,s.fields),this._connection=e,this._clusterRadius=t,this._indexOptions=s,this._cellsPerScale=new Map,this._metadata=new h({geometryType:"esriGeometryPoint",objectIdField:"aggregateId",fields:[...i,...this._source.metadata.fieldsIndex.fields,{name:"aggregateId",alias:"aggregateId",type:"esriFieldTypeOID"}],globalIdField:null,spatialReference:r.metadata.spatialReference,subtypeField:null,subtypes:null,timeInfo:null,timeReferenceUnknownClient:null,typeIdField:null,types:null})}get enablePixelBuffering(){return!1}invalidate(){super.invalidate();for(const e of this._cellsPerScale.values())e.destroy();this._cellsPerScale.clear()}onSubscribe(e){super.onSubscribe(e),this._requiredLevel=e.tile.level,this._requiredScale=e.tile.scale}createState(e){return new _(e)}async*applyOverride(e){for(const t of this._cellsPerScale.values())t.destroy();this._cellsPerScale.clear();for(const t of this._sendStates.values())t.done=!1}displayMap(e,t,s){const i=new Map(e.map((e=>[t(e),e]))),r=[],a=this._getClusterState(this._requiredLevel,this._requiredScale);for(const n of a.clusters()){const e=i.get(n.inner.id);if(null==e){if(1===n.inner.count){const e=i.get(n.inner.firstObjectId);if(null!=e){const t=s(n.displayId,e,n.inner.firstObjectId);r.push(t),i.delete(n.inner.firstObjectId)}}}else{const t=s(n.displayId,e,n.inner.id);r.push(t),i.delete(n.inner.id)}}return r}getDisplayFeatures(t){const s=new Set(t),i=new Set,r=[],a=[],n=this._getClusterState(this._requiredLevel,this._requiredScale);for(const l of n.aggregatesWorldSpace())if(s.has(l.displayId)&&!i.has(l.displayId)){const t=e(l,this._metadata.geometryType,!1,!1);if(i.add(l.displayId),1===t.attributes.cluster_count){r.push({...t,displayId:l.displayId});continue}a.push({...t,displayId:l.displayId})}return{features:r,aggregates:a}}getFeatureObjectIdsForAggregate(e){const t=this._getClusterState(this._requiredLevel,this._requiredScale);for(const s of t.clusters())if(s.inner.id===e)return Array.from(s.inner.objectIds);return[]}async*updateChunks(){const e=this._source.chunks();if(!e.length)return;const t=this._getClusterState(this._requiredLevel,this._requiredScale);if(t.updateChunks(e)||!this._source.updateTracking.updating)for(const r of this._sendStates.values())r.subscription.tile.level===this._requiredLevel&&(r.didSend=!1,r.done=!1);const s=Array.from(this._sendStates.values()).filter((e=>e.done)).map((e=>e.subscription.tile.key)),i=new Set(s);for(const r of this._sendStates.values()){if(this._source.updateTracking.updating){if(s.some((e=>e.containsChild(r.subscription.tile.key))))continue;if(r.subscription.tile.key.getChildKeys().every((e=>i.has(e))))continue}r.didSend||r.subscription.tile.level!==this._requiredLevel||(r.didSend=!0,yield*this._update(r,t,this._source))}await t.updateStatistics(this._connection)}forEachAggregateWorldSpace(e){if(null==this._requiredLevel||null==this._requiredScale)return;const t=this._getClusterState(this._requiredLevel,this._requiredScale);for(const s of t.aggregatesWorldSpace())e(s)}_getClusterState(e,t){if(null==e||null==t)throw new Error("InternalError: Level and scale must be defined");let s=this._cellsPerScale.get(t);return s||(s=new m(e,t,this._indexOptions,this._clusterRadius,this._attributeStore),this._cellsPerScale.set(t,s)),s}async*_update(e,t,s){if(e.done)return;const i=t.createAggregateFeatures(e,this._metadata);this.events.emit("changed"),e.done=!s.updateTracking.updating;const r=i.getCursor(),a=e.subscription.tile.createArcadeEvaluationOptions(this._indexOptions.timeZone);for(;r.next();)this._attributeStore.setAttributeData(r.getDisplayId(),r,a);const n=new d(e.subscription,i,!0,e.done,{});yield n}}export{_ as ClusterState,y as ClusterStrategy};
|