@arcgis/core 6.0.0-next.54 → 6.0.0-next.55
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/WebScene.js +2 -2
- package/applications/Components/OrientedImageryViewer/shared/constants.js +1 -1
- package/applications/SceneViewer/sceneViewerUtils.js +1 -1
- package/arcade/arcadeAsyncRuntime.js +1 -1
- package/arcade/arcadeCompiler.js +1 -1
- package/arcade/arcadeRuntime.js +1 -1
- package/arcade/featureset/support/sqlUtils.js +1 -1
- package/arcade/validation/arcadeValidator.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0329fa3aa3403f1c243b.js +1 -0
- package/assets/esri/core/workers/chunks/{6602310c3fcd91fb6a2f.js → 07c8ac092e4b9e8d5b3c.js} +1 -1
- package/assets/esri/core/workers/chunks/0a97b1974367382cfdf5.js +1 -0
- package/assets/esri/core/workers/chunks/{db0a7671ab5cbe8afd72.js → 123661019bb69c53f2d3.js} +1 -1
- package/assets/esri/core/workers/chunks/{d14732a57c8e63948c60.js → 14259910f44c08fd5bbd.js} +1 -1
- package/assets/esri/core/workers/chunks/{1b41ba050cde068d2860.js → 193a73a2c7f4f8482c21.js} +1 -1
- package/assets/esri/core/workers/chunks/20acb6f3ed5140b6c6c6.js +1 -0
- package/assets/esri/core/workers/chunks/{e507dfc4788295d9c244.js → 249a687ce1b6d0815242.js} +1 -1
- package/assets/esri/core/workers/chunks/{afb4dfb89fbc8a342cc5.js → 3354f1fa90f8ce4c8fde.js} +1 -1
- package/assets/esri/core/workers/chunks/{9b458b0d1627f22fdd93.js → 3b11e4d2e69b7aea1d65.js} +1 -1
- package/assets/esri/core/workers/chunks/41694ee8990e799da225.js +1 -0
- package/assets/esri/core/workers/chunks/{e592f2483db71230e8e5.js → 4401b3f8ebb658abe789.js} +1 -1
- package/assets/esri/core/workers/chunks/{12add2003631fa314f25.js → 5060be52a380fc4920f8.js} +1 -1
- package/assets/esri/core/workers/chunks/{2aa6be0b047a1b25a520.js → 53bbb9aa6e4e4a0a8121.js} +1 -1
- package/assets/esri/core/workers/chunks/{4707aedcc1b3bdf5e987.js → 5c34d49a6c9cc34b7626.js} +1 -1
- package/assets/esri/core/workers/chunks/69a09c6acb5ae03c67f6.js +1 -0
- package/assets/esri/core/workers/chunks/7b156905d168bf973518.js +1 -0
- package/assets/esri/core/workers/chunks/{e83806797979138fd22a.js → 844c593754b2692257f4.js} +1 -1
- package/assets/esri/core/workers/chunks/{2d3e977f3b75474d7ebc.js → 846248697c398468d8e6.js} +1 -1
- package/assets/esri/core/workers/chunks/{f7e33d37dd11fb08f3f8.js → 97107e64407fa6825620.js} +1 -1
- package/assets/esri/core/workers/chunks/{032733b863426c5bde00.js → 9e508f930086d2ef5f22.js} +3 -3
- package/assets/esri/core/workers/chunks/{5118c7269b706089c88e.js → a05a2c2aaf0c288f9681.js} +1 -1
- package/assets/esri/core/workers/chunks/{817bf487df056da1e6ec.js → a116dd204921e7464944.js} +1 -1
- package/assets/esri/core/workers/chunks/{944f17e9c9f681b971fb.js → a12e2a345005189c64be.js} +1 -1
- package/assets/esri/core/workers/chunks/{15b3386ad92a0b4149b8.js → a24dc5350af001db417a.js} +1 -1
- package/assets/esri/core/workers/chunks/{10967a36c77c5188690d.js → a66d6298236d59a615db.js} +1 -1
- package/assets/esri/core/workers/chunks/{255f5b45c4d32f97f86c.js → ac0861014b3d2f1a1de2.js} +1 -1
- package/assets/esri/core/workers/chunks/ace210d313ce53f3ae10.js +1 -0
- package/assets/esri/core/workers/chunks/ae48ee283cfa5b3c14b0.js +1 -0
- package/assets/esri/core/workers/chunks/bbd8fcb0bbba7bde3d9b.js +1 -0
- package/assets/esri/core/workers/chunks/{ac8d38016e4bee37a77c.js → be0b8bb4f09aae6ff5de.js} +1 -1
- package/assets/esri/core/workers/chunks/d0659f1b0495734be4b3.js +1 -0
- package/assets/esri/core/workers/chunks/{b9a2b05ede02c305e865.js → d8ffb1502def5c85740b.js} +1 -1
- package/assets/esri/core/workers/chunks/{7dfe1e78d2e66de6be22.js → d9ef244019954d5a8a27.js} +1 -1
- package/assets/esri/core/workers/chunks/{95403bb27a4ea0a4b7b1.js → ddbfa664e69612295785.js} +1 -1
- package/assets/esri/core/workers/chunks/{c6d82397044e403a1f61.js → e61082f56c08abe54b3a.js} +1 -1
- package/assets/esri/core/workers/chunks/{55d28d3f5b8ced061e39.js → eaf73ce60f39a48ddd2a.js} +1 -1
- package/assets/esri/core/workers/chunks/ed2f2a5da830d058e339.js +1 -0
- package/assets/esri/core/workers/chunks/{944cb751c85d3a127f49.js → f52d081bbde5c95265cf.js} +1 -1
- package/assets/esri/core/workers/chunks/{1de9be7b65109c207bd5.js → fbd5f3b81cd9f061824d.js} +1 -1
- package/assets/esri/layers/raster/formats/blosc-wasm.wasm +0 -0
- package/assets/esri/libs/librust-parquet/pkg/parquet_bg.wasm +0 -0
- package/basemapGallery/support/basemapCompatibilityUtils.js +1 -1
- package/chunks/CypherParser.js +1 -1
- package/chunks/GeodeticDistanceCalculator-zRp89-dW.js +1 -1
- package/chunks/MultiPathImpl.js +1 -1
- package/chunks/OperatorGeodesicBuffer.js +1 -1
- package/chunks/UnitFactory.js +1 -1
- package/chunks/blosc-wasm.js +2 -0
- package/chunks/cameraUtilsSpherical.js +1 -1
- package/chunks/parquet.js +1 -1
- package/chunks/text.js +1 -1
- package/config.js +1 -1
- package/core/sql/SqlInterval.js +1 -1
- package/core/urlUtils.js +1 -1
- package/geometry/geometryEngine.js +1 -1
- package/geometry/operators/gx/operatorOffset.js +1 -1
- package/geometry/support/Ellipsoid.js +1 -1
- package/geometry/support/curves/ellipticArc7Utils.js +1 -1
- package/geometry/support/geodesicConstants.js +1 -1
- package/geometry/support/meshUtils/primitives.js +1 -1
- package/kernel.js +1 -1
- package/layers/Lyr3DWasmPerSceneView.js +1 -1
- package/layers/VoxelWasmPerSceneView.js +1 -1
- package/layers/effects/parser.js +1 -1
- package/layers/geospatialPDF/GeospatialPDFLayerWorker.js +1 -1
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/graphics/data/QueryEngineResult.js +1 -1
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/parquet.js +1 -1
- package/layers/raster/datasets/ZarrRaster.js +1 -1
- package/layers/raster/datasets/wcsCoverageParser.js +1 -1
- package/layers/raster/formats/RasterCodec.js +1 -1
- package/layers/raster/formats/blosc.js +2 -0
- package/layers/support/BuildingFilter.js +1 -1
- package/layers/support/IntegratedMeshSemantics.js +1 -1
- package/layers/support/fieldUtils.d.ts +23 -87
- package/layers/support/fieldUtils.js +1 -1
- package/layers/support/layersMapping.js +1 -1
- package/layers/video/VideoController.js +1 -1
- package/legend/ActiveLayerInfo.js +1 -1
- package/libs/ajv/ajv.bundle-wrapper.js +1 -1
- package/package.json +4 -4
- package/renderers/types.d.ts +1 -1
- package/rest/knowledgeGraphService.js +1 -1
- package/rest/query/operations/pbfFeatureServiceParser.js +1 -1
- package/smartMapping/statistics/support/attributeDensity.js +1 -1
- package/smartMapping/support/adapters/support/utils.js +1 -1
- package/support/tests/serviceMockDependencies.js +1 -1
- package/symbols/cim/CIMEffects.js +1 -1
- package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
- package/symbols/cim/effects/EffectControlMeasureLine.js +1 -1
- package/symbols/cim/placements/PlacementInsidePolygon.js +1 -1
- package/symbols/cim/rasterizingUtils.js +1 -1
- package/views/2d/PaddedViewState.js +1 -1
- package/views/2d/engine/vectorTiles/buckets/FillBucket.js +1 -1
- package/views/2d/engine/vectorTiles/constants.js +1 -1
- package/views/2d/engine/vectorTiles/style/geoJSONVectorTileUtils.js +1 -1
- package/views/2d/engine/webgl/effects/HighlightEffect.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/segmentUtils.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/constants.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
- package/views/2d/interactive/editingTools/ControlPointsTransformTool.js +1 -1
- package/views/2d/interactive/editingTools/TransformTool.js +1 -1
- package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
- package/views/2d/layers/ParquetLayerView2D.js +1 -1
- package/views/2d/layers/features/Processor.js +1 -1
- package/views/2d/layers/features/aggregation/GridSpatialIndex.js +1 -1
- package/views/2d/layers/features/support/AttributeStore.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
- package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
- package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementPathHelper.js +1 -1
- package/views/3d/analysis/Dimension/DimensionTool.js +1 -1
- package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
- package/views/3d/analysis/ElevationProfile/ElevationProfileLineSceneComputation.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightItemManipulatedObject3D.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
- package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
- package/views/3d/analysis/Slice/SliceTool.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedObserverManipulatedObject3D.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedSnappingController.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
- package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillComputation.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementVisualization.js +1 -1
- package/views/3d/animation/pointToPoint/Camera.js +1 -1
- package/views/3d/camera/constraintUtils.js +1 -1
- package/views/3d/camera/intersectionUtils.js +1 -1
- package/views/3d/environment/EnvironmentView.js +1 -1
- package/views/3d/focusAreaUtils.js +1 -1
- package/views/3d/interactive/editingTools/ManipulatedObject3DGraphic.js +1 -1
- package/views/3d/interactive/editingTools/dragEventPipeline3D.js +1 -1
- package/views/3d/interactive/editingTools/manipulations/config.js +1 -1
- package/views/3d/interactive/editingTools/media/MediaElementControllerControlPoints.js +1 -1
- package/views/3d/interactive/editingTools/media/MediaElementControllerShape.js +1 -1
- package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
- package/views/3d/interactive/editingTools/transform/ScaleRotateMeshAdapter.js +1 -1
- package/views/3d/interactive/editingTools/transform/TransformTool3D.js +1 -1
- package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js +1 -1
- package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DView.js +1 -1
- package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/TiledLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.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/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolFactory.js +1 -1
- package/views/3d/layers/graphics/LabelInfo.js +1 -1
- package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/layers/i3s/I3SIntersectionHandler.js +1 -1
- package/views/3d/layers/i3s/I3SMeshViewFilter.js +1 -1
- package/views/3d/layers/i3s/I3SNode.js +1 -1
- package/views/3d/layers/i3s/I3SOverrides.js +1 -1
- package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
- package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3DContext.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/StageLayerElevationProvider.js +1 -1
- package/views/3d/layers/support/Tiles3DLayerViewRegistration.js +1 -1
- package/views/3d/layers/support/selectTiles3DSpatialReference.js +1 -1
- package/views/3d/layers/support/uvUtils.js +1 -1
- package/views/3d/state/Constraints.js +1 -1
- package/views/3d/state/ConstraintsManager.js +1 -1
- package/views/3d/state/NearFarHeuristic.js +1 -1
- package/views/3d/state/ViewState.js +1 -1
- package/views/3d/state/ViewStateManager.js +1 -1
- package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
- package/views/3d/state/controllers/PinchAndPanControllerLocal.js +1 -1
- package/views/3d/state/controllers/PointToPointAnimationController.js +1 -1
- package/views/3d/state/controllers/ZoomStepControllerGlobal.js +1 -1
- package/views/3d/state/controllers/ZoomStepControllerLocal.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/state/utils/OffsetCorrectionController.js +1 -1
- package/views/3d/state/utils/groundNavigationUtils.js +1 -1
- package/views/3d/state/utils/navigationUtils.js +1 -1
- package/views/3d/support/FrustumExtentIntersection.js +1 -1
- package/views/3d/support/RenderCoordsHelper.js +1 -1
- package/views/3d/support/SweptSphereVolume.js +1 -1
- package/views/3d/support/cameraUtils.js +1 -1
- package/views/3d/support/elevationUpdateExtentUtils.js +1 -1
- package/views/3d/support/engineContent/line.js +1 -1
- package/views/3d/support/engineContent/marker.js +1 -1
- package/views/3d/support/hitTest.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/PointsOfInterest.js +1 -1
- package/views/3d/support/pointsOfInterest/SurfaceGeometryUpdates.js +1 -1
- package/views/3d/support/sunUtils.js +1 -1
- package/views/3d/terrain/ExtentHelper.js +1 -1
- package/views/3d/terrain/OverlayManager.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/PatchGeometryFactory.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/Tile.js +1 -1
- package/views/3d/terrain/TilingSchemeLogic.js +1 -1
- package/views/3d/terrain/terrainUtils.js +1 -1
- package/views/3d/webgl/RenderCamera.js +1 -1
- package/views/3d/webgl-engine/Stage.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticBVH.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticComponentGeometryBVH.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ElevationAgnosticBVH.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/collections/Component/Material/ComponentMaterialRepository.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/atmosphere/MarsAtmosphere.js +1 -1
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
- package/views/3d/webgl-engine/effects/laserlines/LaserlinePathData.js +1 -1
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/Intersector.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/TextRenderParameters.js +1 -1
- package/views/3d/webgl-engine/lib/TextRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/TriangleIntersectionData.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/strokes.js +1 -1
- package/views/3d/webgl-engine/lib/verticalOffsetUtils.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PolygonOffset.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/MapView.d.ts +1 -0
- package/views/SceneView.js +1 -1
- package/views/View2D.js +1 -1
- package/views/ViewingMode.js +1 -1
- package/views/analysis/ElevationProfile/elevationProfileChartBoundsUtils.js +1 -1
- package/views/analysis/ElevationProfile/elevationProfileGeometryUtils.js +1 -1
- package/views/draw/DrawAction.js +1 -1
- package/views/draw/DrawOperation.js +1 -1
- package/views/draw/DrawTool.js +1 -1
- package/views/draw/SegmentDrawAction.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/views/draw/support/helpMessageUtils.js +1 -1
- package/views/draw/support/managers/EditSessionManager.js +1 -1
- package/views/interactive/dragEventPipeline.js +1 -1
- package/views/interactive/editGeometry/EditGeometry.js +1 -1
- package/views/interactive/editGeometry/EditGeometryOperations.js +1 -1
- package/views/interactive/editGeometry/operations/AddOrUpdatePart.js +1 -1
- package/views/layers/support/editableLayerViews.js +1 -1
- package/views/overlay/TextOverlayItem.js +1 -1
- package/views/support/DefaultsFromMap.js +1 -1
- package/views/support/Scheduler.js +1 -1
- package/views/support/spatialReferenceSupport.js +1 -1
- package/views/webgl/ShaderTranspiler.js +2 -2
- package/widgets/AreaMeasurement2D/AreaMeasurement2DTool.js +1 -1
- package/widgets/BasemapGallery/support/basemapCompatibilityUtils.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/DistanceMeasurement2D/DistanceMeasurement2DTool.js +1 -1
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/ElevationProfile/ElevationProfileLineView.js +1 -1
- package/widgets/ElevationProfile/support/chartUtils.js +1 -1
- package/widgets/ElevationProfile/support/geometryUtils.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/Legend/styles/card/ColorRamp.js +1 -1
- package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
- package/widgets/Measurement.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageLocationWidget.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageMeasurementWidget.js +1 -1
- package/widgets/Search/support/layerSearchUtils.js +1 -1
- package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
- package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js +1 -1
- package/widgets/UtilityNetworkAssociations.js +1 -1
- package/widgets/Weather/WeatherViewModel.js +1 -1
- package/widgets/Weather/css.js +1 -1
- package/widgets/Weather.js +1 -1
- package/assets/esri/core/workers/chunks/021bd07b9a3e70598840.js +0 -1
- package/assets/esri/core/workers/chunks/170e68624b71ac96de4a.js +0 -1
- package/assets/esri/core/workers/chunks/8a820e303941b351de81.js +0 -1
- package/assets/esri/core/workers/chunks/90d567e920b6982b402d.js +0 -1
- package/assets/esri/core/workers/chunks/97cdcedfe853280f6258.js +0 -1
- package/assets/esri/core/workers/chunks/9ebc6026934400fc1e1f.js +0 -1
- package/assets/esri/core/workers/chunks/b4a325dcf50e276751d7.js +0 -1
- package/assets/esri/core/workers/chunks/be5857b0d1b00faf430b.js +0 -1
- package/assets/esri/core/workers/chunks/cd9100a7c8309dfa7569.js +0 -1
- package/assets/esri/core/workers/chunks/e58f51618251f74aaafd.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{inchesPerMeter as e}from"../../../core/units.js";import{GeometryCursor as t}from"../../../geometry/GeometryCursor.js";import{collectMultipath as n}from"../../../geometry/geometryCursorCollectUtils.js";import r from"../../../geometry/SpatialReference.js";import{getPathLength as i}from"../../../geometry/support/coordsUtils.js";import{setId as a}from"../CIMCursor.js";import{lazyOffsetOperator as o}from"../CIMEffects.js";class s{static{this.instance=null}static local(){return s.instance===null&&(s.instance=new s),s.instance}execute(e,t,n){return new c(e,t,n)}}class c{constructor(e,t,n){this._defaultPointSize=20,this._inputGeometries=e,this._geomUnitsPerPoint=n.geomUnitsPerPoint??1,this._scale=n?.scale,this._rule=t.rule??`FullGeometry`,this._spatialReference=n?.spatialReference??r.WebMercator,this._width=this._computeWidth(t.width??25),this._defaultSize=this._defaultPointSize*this._geomUnitsPerPoint}next(){let e;for(;e=this._inputGeometries.next();){let r=this._processGeom(n(e));if(r?.length)return t.fromJSONCIM({paths:r})}return null}_computeWidth(t){if(!l(this._rule)||this._scale==null||!this._spatialReference.metersPerUnit)return t*this._geomUnitsPerPoint;let n=this._scale/(96*e*this._spatialReference.metersPerUnit);return t/(this._spatialReference.metersPerUnit*n)}_clone(e){return[e[0],e[1]]}_mid(e,t){return[(e[0]+t[0])/2,(e[1]+t[1])/2]}_mix(e,t,n,r){return[e[0]*t+n[0]*r,e[1]*t+n[1]*r]}_add(e,t){return[e[0]+t[0],e[1]+t[1]]}_add2(e,t,n){return[e[0]+t,e[1]+n]}_sub(e,t){return[e[0]-t[0],e[1]-t[1]]}_dist(e,t){return Math.sqrt((e[0]-t[0])*(e[0]-t[0])+(e[1]-t[1])*(e[1]-t[1]))}_norm(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}_normalize(e,t=1){let n=t/this._norm(e);e[0]*=n,e[1]*=n}_leftPerpendicular(e){let t=-e[1],n=e[0];e[0]=t,e[1]=n}_leftPerp(e){return[-e[1],e[0]]}_rightPerpendicular(e){let t=e[1],n=-e[0];e[0]=t,e[1]=n}_rightPerp(e){return[e[1],-e[0]]}_dotProduct(e,t){return e[0]*t[0]+e[1]*t[1]}_crossProduct(e,t){return e[0]*t[1]-e[1]*t[0]}_rotateDirect(e,t,n){let r=e[0]*t-e[1]*n,i=e[0]*n+e[1]*t;e[0]=r,e[1]=i}_makeCtrlPt(e){let t=[e[0],e[1]];return a(t,1),t}_addAngledTicks(e,t,n,r){let i=this._sub(n,t);this._normalize(i);let a=this._crossProduct(i,this._sub(r,t)),o;o=a>0?this._rightPerp(i):this._leftPerp(i);let s=Math.abs(a)/2,c=[];c.push([t[0]+(o[0]-i[0])*s,t[1]+(o[1]-i[1])*s]),c.push(t),c.push(n),c.push([n[0]+(o[0]+i[0])*s,n[1]+(o[1]+i[1])*s]),e.push(c)}_addBezier2(e,t,n,r,i){if(i--===0){e.push(r);return}let a=this._mid(t,n),o=this._mid(n,r),s=this._mid(a,o);this._addBezier2(e,t,a,s,i),this._addBezier2(e,s,o,r,i)}_addBezier3(e,t,n,r,i,a){if(a--===0){e.push(i);return}let o=this._mid(t,n),s=this._mid(n,r),c=this._mid(r,i),l=this._mid(o,s),u=this._mid(s,c),d=this._mid(l,u);this._addBezier3(e,t,o,l,d,a),this._addBezier3(e,d,u,c,i,a)}_add90DegArc(e,t,n,r,i){let a=i??this._crossProduct(this._sub(n,t),this._sub(r,t))>0,o=this._mid(t,n),s=this._sub(o,t);a?this._leftPerpendicular(s):this._rightPerpendicular(s),o[0]+=s[0],o[1]+=s[1],this._addBezier3(e,t,this._mix(t,.33333,o,.66667),this._mix(n,.33333,o,.66667),n,4)}_addArrow(e,t,n){let r=t[0],i=t[1],a=t[t.length-1],o=this._sub(r,i),s=this._norm(o);this._normalize(o);let c=Math.abs(this._crossProduct(o,this._sub(a,i))),l=this._dotProduct(o,this._sub(a,i));l<s*.05?l=s*.05:l>s*.95&&(l=s*.95);let u=c*.5,d=this._leftPerp(o),f=[i[0]+o[0]*l,i[1]+o[1]*l],p=t.length-1,m=[];m.push(n?[-d[0],-d[1]]:d);let h=[-o[0],-o[1]];for(let e=1;e<p-1;e++){let n=this._sub(t[e+1],t[e]);this._normalize(n);let r=this._dotProduct(n,h),i=this._crossProduct(n,h),a=Math.sqrt((1+r)/2),o=this._sub(n,h);this._normalize(o),o[0]/=a,o[1]/=a,m.push(i<0?[-o[0],-o[1]]:o),h=n}m.push(this._rightPerp(h));for(let n=m.length-1;n>0;n--)e.push([t[n][0]+m[n][0]*u,t[n][1]+m[n][1]*u]);e.push([f[0]+m[0][0]*u,f[1]+m[0][1]*u]),e.push([f[0]+m[0][0]*c,f[1]+m[0][1]*c]),e.push(r),e.push([f[0]-m[0][0]*c,f[1]-m[0][1]*c]),e.push([f[0]-m[0][0]*u,f[1]-m[0][1]*u]);for(let n=1;n<m.length;n++)e.push([t[n][0]-m[n][0]*u,t[n][1]-m[n][1]*u])}_addDash(e,t,n){let r=this._norm(n)/7;this._normalize(n);let i=[];for(let a=0;a<=7;a++)i.push([t[0]+n[0]*a*r,t[1]+n[1]*a*r]),a&1&&(e.push(i),i=[])}_cp2(e,t,n){return e.length>=2?e[1]:this._add2(e[0],t*this._defaultSize,n*this._defaultSize)}_cp3(e,t,n,r){if(e.length>=3)return e[2];let i=this._mix(e[0],1-n,t,n),a=this._sub(t,e[0]);return this._normalize(a),this._rightPerpendicular(a),[i[0]+a[0]*r*this._defaultSize,i[1]+a[1]*r*this._defaultSize]}_arrowPath(e){if(e.length>2)return e;let t=e[0],n=this._cp2(e,-4,0),r=this._sub(t,n);this._normalize(r);let i=this._rightPerp(r);return[t,n,[t[0]+(i[0]-r[0])*this._defaultSize,t[1]+(i[1]-r[1])*this._defaultSize]]}_arrowLastSeg(e){let t=e[0],n=this._cp2(e,-4,0),r;if(e.length>=3)r=e[e.length-1];else{let e=this._sub(t,n);this._normalize(e);let i=this._rightPerp(e);r=[t[0]+(i[0]-e[0])*this._defaultSize,t[1]+(i[1]-e[1])*this._defaultSize]}return[n,r]}_offsetPath(e,r){let{offsetExecute:i}=o.module,a=i({paths:[e],spatialReference:this._spatialReference.toJSON()},r,{joins:`miter`,miterLimit:4}),[s]=n(t.fromJSONCIM(a));return s?.length?s:null}_processGeom(e){if(!e)return null;let t=[];for(let n of e){let e=n.length>1&&i(n)<this._defaultSize;if(!n||n.length===0||e)continue;let r=n.length,o=n[0];switch(this._rule){case`PerpendicularFromFirstSegment`:{let e=this._cp2(n,0,-1),r=this._cp3(n,e,.5,4),i=[];i.push(r),i.push(this._mid(o,e)),t.push(i);break}case`ReversedFirstSegment`:{let e=this._cp2(n,0,-1);t.push([e,o]);break}case`PerpendicularToSecondSegment`:{if(n.length<3)return[];let e=this._cp2(n,-4,1),r=this._cp3(n,e,.882353,-1.94),i=[];i.push(this._mid(e,r)),i.push(o),t.push(i);break}case`SecondSegmentWithTicks`:{if(n.length<3)return[];let e=this._cp2(n,-4,1),r=this._cp3(n,e,.882353,-1.94),i=this._sub(r,e),a;a=this._crossProduct(i,this._sub(o,e))>0?this._rightPerp(i):this._leftPerp(i);let s=[];s.push([e[0]+(a[0]-i[0])/3,e[1]+(a[1]-i[1])/3]),s.push(e),s.push(r),s.push([r[0]+(a[0]+i[0])/3,r[1]+(a[1]+i[1])/3]),t.push(s);break}case`DoublePerpendicular`:{let e=this._cp2(n,0,-1),r=this._cp3(n,e,.5,3),i=this._mid(o,e),a=this._sub(i,r);this._normalize(a);let s=this._crossProduct(a,this._sub(o,r));this._leftPerpendicular(a);let c=[];c.push(o),c.push([r[0]+a[0]*s,r[1]+a[1]*s]),t.push(c);let l=[];l.push([r[0]-a[0]*s,r[1]-a[1]*s]),l.push(e),t.push(l);break}case`OppositeToFirstSegment`:{let e=this._cp2(n,0,-1),r=this._cp3(n,e,.5,3),i=this._mid(o,e),a=this._sub(i,r);this._normalize(a);let s=this._crossProduct(a,this._sub(o,r));this._leftPerpendicular(a);let c=[];c.push([r[0]+a[0]*s,r[1]+a[1]*s]),c.push([r[0]-a[0]*s,r[1]-a[1]*s]),t.push(c);break}case`TriplePerpendicular`:{let e=this._cp2(n,0,-1),r=this._cp3(n,e,.5,4),i=this._mid(o,e),a=this._sub(i,r);this._normalize(a);let s=this._crossProduct(a,this._sub(o,r));this._leftPerpendicular(a);let c=[];c.push([r[0]+a[0]*s*.8,r[1]+a[1]*s*.8]),c.push([i[0]+(o[0]-i[0])*.8,i[1]+(o[1]-i[1])*.8]),t.push(c),t.push([r,i]);let l=[];l.push([r[0]-a[0]*s*.8,r[1]-a[1]*s*.8]),l.push([i[0]+(e[0]-i[0])*.8,i[1]+(e[1]-i[1])*.8]),t.push(l);break}case`HalfCircleFirstSegment`:{let e=this._cp2(n,0,-1),r=this._cp3(n,e,.5,4),i=this._mid(o,e),a=this._sub(e,o),s=Math.cos(Math.PI/18),c=Math.sin(Math.PI/18),l=Math.sqrt((1+s)/2),u=Math.sqrt((1-s)/2),d=[],f;this._crossProduct(a,this._sub(r,o))>0?(d.push(o),a=this._sub(o,i),f=e):(d.push(e),a=this._sub(e,i),f=o),this._rotateDirect(a,l,u),a[0]/=l,a[1]/=l;for(let e=1;e<=18;e++)d.push(this._add(i,a)),this._rotateDirect(a,s,c);d.push(f),t.push(d);break}case`HalfCircleSecondSegment`:{let e=this._cp2(n,0,-1),r=this._cp3(n,e,1,-1),i=this._sub(o,e);this._normalize(i);let a=this._crossProduct(i,this._sub(r,e))/2;this._leftPerpendicular(i);let s=[e[0]+i[0]*a,e[1]+i[1]*a];i=this._sub(e,s);let c=Math.cos(Math.PI/18),l=Math.sin(Math.PI/18);a>0&&(l=-l);let u=[e];for(let e=1;e<=18;e++)this._rotateDirect(i,c,l),u.push(this._add(s,i));t.push(u);break}case`HalfCircleExtended`:{let e=this._cp2(n,0,-2),i=this._cp3(n,e,1,-1),a;if(r>=4)a=n[3];else{let t=this._sub(o,e);a=this._add(i,t)}let s=this._dist(e,i)/2/.75,c=this._sub(e,o);this._normalize(c,s);let l=this._sub(i,a);this._normalize(l,s);let u=[a,i];t.push(u);let d=[this._clone(i)];this._addBezier3(d,i,this._add(i,l),this._add(e,c),e,4),d.push(o),t.push(d);break}case`OpenCircle`:{let e=this._cp2(n,-2,0),r=this._sub(e,o),i=Math.cos(Math.PI/18),a=-Math.sin(Math.PI/18),s=[e];for(let e=1;e<=33;e++)this._rotateDirect(r,i,a),s.push(this._add(o,r));t.push(s);break}case`CoverageEdgesWithTicks`:{let e=this._cp2(n,0,-1),i;if(r>=3)i=n[2];else{let t=this._sub(e,o),n=this._leftPerp(t);i=[o[0]+n[0]-t[0]*.25,o[1]+n[1]-t[1]*.25]}let a;if(r>=4)a=n[3];else{let t=this._mid(o,e),n=this._sub(o,e);this._normalize(n),this._leftPerpendicular(n);let r=this._crossProduct(n,this._sub(i,t));this._rightPerpendicular(n),a=[i[0]+n[0]*r*2,i[1]+n[1]*r*2]}let s=this._sub(e,o),c,l;c=this._crossProduct(s,this._sub(i,o))>0?this._rightPerp(s):this._leftPerp(s),l=[],l.push(i),l.push(o),l.push([o[0]+(c[0]-s[0])/3,o[1]+(c[1]-s[1])/3]),t.push(l),c=this._crossProduct(s,this._sub(a,e))>0?this._rightPerp(s):this._leftPerp(s),l=[],l.push([e[0]+(c[0]+s[0])/3,e[1]+(c[1]+s[1])/3]),l.push(e),l.push(a),t.push(l);break}case`GapExtentWithDoubleTicks`:{let e=this._cp2(n,0,2),i=this._cp3(n,e,0,1),a;if(r>=4)a=n[3];else{let t=this._sub(e,o);a=this._add(i,t)}this._addAngledTicks(t,o,e,this._mid(i,a)),this._addAngledTicks(t,i,a,this._mid(o,e));break}case`GapExtentMidline`:{let e=this._cp2(n,2,0),i=this._cp3(n,e,0,1),a;if(r>=4)a=n[3];else{let t=this._sub(e,o);a=this._add(i,t)}let s=[];s.push(this._mid(o,i)),s.push(this._mid(e,a)),t.push(s);break}case`Chevron`:{let e=this._cp2(n,-1,-1),i;if(r>=3)i=n[2];else{let t=this._sub(e,o);this._leftPerpendicular(t),i=this._add(o,t)}t.push([e,this._makeCtrlPt(o),i]);break}case`PerpendicularWithArc`:{let e=this._cp2(n,0,-2),i=this._cp3(n,e,.5,-1),a=this._sub(e,o),s=this._norm(a);a[0]/=s,a[1]/=s;let c=this._crossProduct(a,this._sub(i,o)),l=this._dotProduct(a,this._sub(i,o));l<s*.05?l=s*.05:l>s*.95&&(l=s*.95);let u=[o[0]+a[0]*l,o[1]+a[1]*l],d=this._leftPerp(a),f=[];if(f.push([u[0]-d[0]*c,u[1]-d[1]*c]),f.push([u[0]+d[0]*c,u[1]+d[1]*c]),t.push(f),r>=4){let e=n[3],r=this._dotProduct(a,this._sub(e,o));r<s*.1?r=s*.1:r>s*.9&&(r=s*.9);let i=[o[0]+a[0]*r,o[1]+a[1]*r],c=this._crossProduct(a,this._sub(e,o)),l=[];l.push([i[0]-d[0]*c,i[1]-d[1]*c]),l.push([i[0]+d[0]*c,i[1]+d[1]*c]),t.push(l)}let p=[e[0]+d[0]*c,e[1]+d[1]*c];d=this._sub(e,p);let m=Math.cos(Math.PI/18),h=Math.sin(Math.PI/18);c<0&&(h=-h),f=[o,e];for(let e=1;e<=9;e++)this._rotateDirect(d,m,h),f.push(this._add(p,d));t.push(f);break}case`ClosedHalfCircle`:{let e=this._cp2(n,2,0),r=this._mid(o,e),i=this._sub(e,r),a=Math.cos(Math.PI/18),s=Math.sin(Math.PI/18),c=[o,e];for(let e=1;e<=18;e++)this._rotateDirect(i,a,s),c.push(this._add(r,i));t.push(c);break}case`TripleParallelExtended`:{let e=this._cp2(n,0,-2),r=this._cp3(n,e,1,-2),i=this._mid(o,e),s=this._sub(r,e);this._normalize(s);let c=Math.abs(this._crossProduct(s,this._sub(i,e)))/2,l=this._dist(e,r),u=[e,o];u.push([o[0]+s[0]*l*.5,o[1]+s[1]*l*.5]),t.push(u);let d=[];d.push([i[0]-s[0]*c,i[1]-s[1]*c]),d.push([i[0]+s[0]*l*.375,i[1]+s[1]*l*.375]),a(d[d.length-1],1),d.push([i[0]+s[0]*l*.75,i[1]+s[1]*l*.75]),t.push(d);let f=[e,r];t.push(f);break}case`ParallelWithTicks`:{let e=this._cp2(n,3,0),r=this._cp3(n,e,.5,-1),i=this._sub(e,o);this._normalize(i);let a=this._crossProduct(i,this._sub(r,o)),s=this._leftPerp(i);this._addAngledTicks(t,o,e,r),this._addAngledTicks(t,this._add2(o,s[0]*a,s[1]*a),this._add2(e,s[0]*a,s[1]*a),this._mid(o,e));break}case`Parallel`:{let e=this._cp2(n,3,0),r=this._cp3(n,e,.5,-1),i=this._sub(e,o);this._normalize(i);let a=this._leftPerp(i),s=this._crossProduct(i,this._sub(r,o)),c=[o,e];t.push(c),c=[],c.push([o[0]+a[0]*s,o[1]+a[1]*s]),c.push([e[0]+a[0]*s,e[1]+a[1]*s]),t.push(c);break}case`PerpendicularToFirstSegment`:{let e=this._cp2(n,3,0),r=this._cp3(n,e,.5,-1),i=this._mid(o,e),a=this._sub(e,o);this._normalize(a);let s=this._crossProduct(a,this._sub(r,o));this._leftPerpendicular(a);let c=[];c.push([i[0]-a[0]*s*.25,i[1]-a[1]*s*.25]),c.push([i[0]+a[0]*s*1.25,i[1]+a[1]*s*1.25]),t.push(c);break}case`ParallelOffset`:{let e=this._cp2(n,3,0),r=this._cp3(n,e,.5,-1),i=this._sub(e,o);this._normalize(i);let a=this._crossProduct(i,this._sub(r,o));this._leftPerpendicular(i);let s=[];s.push([o[0]-i[0]*a,o[1]-i[1]*a]),s.push([e[0]-i[0]*a,e[1]-i[1]*a]),t.push(s);let c=[];c.push([o[0]+i[0]*a,o[1]+i[1]*a]),c.push([e[0]+i[0]*a,e[1]+i[1]*a]),t.push(c);break}case`OffsetOpposite`:{let e=this._cp2(n,3,0),r=this._cp3(n,e,.5,-1),i=this._sub(e,o);this._normalize(i);let a=this._crossProduct(i,this._sub(r,o));this._leftPerpendicular(i);let s=[];s.push([o[0]-i[0]*a,o[1]-i[1]*a]),s.push([e[0]-i[0]*a,e[1]-i[1]*a]),t.push(s);break}case`OffsetSame`:{let e=this._cp2(n,3,0),r=this._cp3(n,e,.5,-1),i=this._sub(e,o);this._normalize(i);let a=this._crossProduct(i,this._sub(r,o));this._leftPerpendicular(i);let s=[];s.push([o[0]+i[0]*a,o[1]+i[1]*a]),s.push([e[0]+i[0]*a,e[1]+i[1]*a]),t.push(s);break}case`CircleWithArc`:{let e=this._cp2(n,3,0),i=this._cp3(n,e,.5,-1),s,c;if(r>=4)s=n[3],c=this._crossProduct(this._sub(s,e),this._sub(i,e))>0;else{s=e,c=this._crossProduct(this._sub(s,o),this._sub(i,o))>0;let t=24*this._geomUnitsPerPoint,n=this._sub(s,o);this._normalize(n,t);let r=Math.sqrt(2)/2;this._rotateDirect(n,r,c?r:-r),e=this._add(o,n)}let l=this._sub(e,o),u=Math.cos(Math.PI/18),d=Math.sin(Math.PI/18),f=[e];for(let e=1;e<=36;e++)this._rotateDirect(l,u,d),f.push(this._add(o,l));this._add90DegArc(f,e,s,i,c),a(f[f.length-8],1),t.push(f);break}case`DoubleJog`:{let e=this._cp2(n,-3,1),i=this._cp3(n,e,-1,-.5),a;if(r>=4)a=n[3];else{let t=o;o=e,a=i;let n=this._dist(o,t),r=this._dist(a,t),s=30*this._geomUnitsPerPoint;n*.5<s&&(s=n*.5),r*.5<s&&(s=r*.5),e=this._mix(o,s/n,t,(n-s)/n),i=this._mix(a,s/r,t,(r-s)/r)}let s=this._mid(o,e),c=this._mid(a,i),l=this._dist(o,e),u=this._dist(i,a),d=Math.min(l,u)/8;d=Math.min(d,24*this._geomUnitsPerPoint);let f=Math.cos(Math.PI/4),p=this._sub(o,e);this._normalize(p,d),this._crossProduct(p,this._sub(a,e))>0?this._rotateDirect(p,f,-f):this._rotateDirect(p,f,f);let m=[];m.push(e),m.push(this._add(s,p)),m.push(this._sub(s,p)),m.push(o),t.push(m),p=this._sub(a,i),this._normalize(p,d),this._crossProduct(p,this._sub(o,i))<0?this._rotateDirect(p,f,f):this._rotateDirect(p,f,-f),m=[],m.push(i),m.push(this._add(c,p)),m.push(this._sub(c,p)),m.push(a),t.push(m);break}case`PerpendicularOffset`:{let e=this._cp2(n,-4,1),r=this._cp3(n,e,.882353,-1.94),i=this._sub(r,e);this._crossProduct(i,this._sub(o,e))>0?this._rightPerpendicular(i):this._leftPerpendicular(i);let a=[i[0]/8,i[1]/8],s=this._sub(this._mid(e,r),a);t.push([s,o]);break}case`LineExcludingLastSegment`:{let e=this._arrowPath(n),r=[],i=e.length-2;for(;i--;)r.push(e[i]);t.push(r);break}case`MultivertexArrow`:{let e=this._arrowPath(n),r=[];this._addArrow(r,e,!1),t.push(r);break}case`CrossedArrow`:{let e=this._arrowPath(n),r=[];this._addArrow(r,e,!0),t.push(r);break}case`ChevronArrow`:{let[e,r]=this._arrowLastSeg(n),i=10*this._geomUnitsPerPoint,a=this._sub(o,e),s=this._norm(a);this._normalize(a);let c=this._crossProduct(a,this._sub(r,e)),l=this._dotProduct(a,this._sub(r,e));l<s*.05?l=s*.05:l>s*.95-i&&(l=s*.95-i);let u=[e[0]+a[0]*l,e[1]+a[1]*l],d=this._leftPerp(a),f=[];f.push([u[0]+d[0]*c+a[0]*i,u[1]+d[1]*c+a[1]*i]),f.push(o),f.push([u[0]-d[0]*c+a[0]*i,u[1]-d[1]*c+a[1]*i]),t.push(f);break}case`ChevronArrowOffset`:{let[e,r]=this._arrowLastSeg(n),i=this._sub(o,e),a=this._norm(i);this._normalize(i);let s=this._crossProduct(i,this._sub(r,e)),c=this._dotProduct(i,this._sub(r,e));c<a*.05?c=a*.05:c>a*.95&&(c=a*.95);let l=[e[0]+i[0]*c,e[1]+i[1]*c];this._leftPerpendicular(i);let u=[];u.push([l[0]+i[0]*s*.5,l[1]+i[1]*s*.5]),u.push(this._mid(l,o)),u.push([l[0]-i[0]*s*.5,l[1]-i[1]*s*.5]),t.push(u);break}case`PartialFirstSegment`:{let[e,r]=this._arrowLastSeg(n),i=this._sub(o,e),a=this._norm(i);this._normalize(i);let s=this._dotProduct(i,this._sub(r,e));s<a*.05?s=a*.05:s>a*.95&&(s=a*.95);let c=[e[0]+i[0]*s,e[1]+i[1]*s];t.push([e,c]);break}case`Arch`:{let e=this._cp2(n,0,-1),r=this._cp3(n,e,.5,1),i=this._sub(o,e),a=this._mix(r,1,i,.55),s=this._mix(r,1,i,-.55),c=[o];this._addBezier2(c,o,a,r,4),this._addBezier2(c,r,s,e,4),t.push(c);break}case`CurvedParallelTicks`:{let e=this._cp2(n,-4,1),r=this._cp3(n,e,.882353,-1.94),i=this._sub(r,e);this._crossProduct(i,this._sub(o,e))>0?this._rightPerpendicular(i):this._leftPerpendicular(i);let a=[i[0]/8,i[1]/8],s=this._sub(this._mid(e,r),a),c=this._sub(this._mix(e,.75,r,.25),a),l=this._sub(this._mix(e,.25,r,.75),a),u=[e];this._addBezier2(u,e,c,s,3),this._addBezier2(u,s,l,r,3),t.push(u);for(let e=0;e<8;e++){let n=u[e*2+1],r=[this._clone(n)];r.push(this._add(n,[i[0]/4,i[1]/4])),t.push(r)}break}case`Arc90Degrees`:{let e=this._cp2(n,0,-1),r=this._cp3(n,e,.5,1),i=[e];this._add90DegArc(i,e,o,r),t.push(i);break}case`TipWithPerpendicularAndTicks`:{let[e,r]=this._arrowLastSeg(n),i=10*this._geomUnitsPerPoint,a=this._sub(o,e),s=this._norm(a);this._normalize(a);let c=this._crossProduct(a,this._sub(r,e)),l=this._dotProduct(a,this._sub(r,e));l<s*.05?l=s*.05:l>s*.95-i&&(l=s*.95-i);let u=this._leftPerp(a),d=[o[0]-a[0]*i,o[1]-a[1]*i],f=Math.max(s-l-i,i)*.5;c=Math.abs(c);let p=[];p.push([d[0]+u[0]*(c+f)-a[0]*f,d[1]+u[1]*(c+f)-a[1]*f]),p.push([d[0]+u[0]*c,d[1]+u[1]*c]),p.push([d[0]-u[0]*c,d[1]-u[1]*c]),p.push([d[0]-u[0]*(c+f)-a[0]*f,d[1]-u[1]*(c+f)-a[1]*f]),t.push(p),t.push([d,o]);break}case`ConcentricCircles`:{let e=this._cp2(n,1,0),i=this._cp3(n,e,2,0),s=Math.cos(Math.PI/18),c=Math.sin(Math.PI/18),l=this._dist(e,o),u=[l,0],d=[];for(let e=0;e<=36;e++)d.push(this._add(o,u)),this._rotateDirect(u,s,c);if(t.push(d),r>=4){d=[];let e=n[3];l=this._dist(e,o),u=[l,0];for(let e=0;e<=36;e++)d.push(this._add(o,u)),e===0&&(d.push(this._add(o,u)),a(d[1],1)),this._rotateDirect(u,s,c);t.push(d)}d=[],l=this._dist(i,o),u=[l,0];for(let e=0;e<=36;e++)d.push(this._add(o,u)),this._rotateDirect(u,s,c);t.push(d);break}case`DoubleJogArrow`:{o=this._arrowPath(n)[0];let[e,r]=this._arrowLastSeg(n),i=this._sub(o,e),a=this._norm(i);this._normalize(i);let s=Math.abs(this._crossProduct(i,this._sub(r,o))),c=Math.abs(this._dotProduct(i,this._sub(r,o)));c<a*.05?c=a*.05:c>a*.95&&(c=a*.95);let l=Math.max(s,c),u=this._leftPerp(i),d=[],f=[o[0]-i[0]*c*.5+u[0]*s*.5,o[1]-i[1]*c*.5+u[1]*s*.5];d.push([f[0],f[1]]),f[0]+=i[0]*l*.5+u[0]*l*.4,f[1]+=i[1]*l*.5+u[1]*l*.4,d.push([f[0],f[1]]),f[0]-=u[0]*l*.25,f[1]-=u[1]*l*.25,d.push([f[0],f[1]]),f[0]+=i[0]*l*.5+u[0]*l*.4,f[1]+=i[1]*l*.5+u[1]*l*.4,d.push([f[0],f[1]]),t.push(d),d=[],f[0]=o[0]-i[0]*c*.5-u[0]*s*.5,f[1]=o[1]-i[1]*c*.5-u[1]*s*.5,d.push([f[0],f[1]]),f[0]+=i[0]*l*.5-u[0]*l*.4,f[1]+=i[1]*l*.5-u[1]*l*.4,d.push([f[0],f[1]]),f[0]+=u[0]*l*.25,f[1]+=u[1]*l*.25,d.push([f[0],f[1]]),f[0]+=i[0]*l*.5-u[0]*l*.4,f[1]+=i[1]*l*.5-u[1]*l*.4,d.push([f[0],f[1]]),t.push(d);break}case`LinkedChevrons`:{let e=this._cp2(n,-5,0),r=this._cp3(n,e,-.2,1),i=this._sub(o,e);this._normalize(i);let a=this._leftPerp(i),s=Math.abs(this._crossProduct(i,this._sub(r,e)));t.push([e,o]);let c=[];c.push([o[0]-i[0]*s+a[0]*s,o[1]-i[1]*s+a[1]*s]),c.push(o),c.push([o[0]-i[0]*s-a[0]*s,o[1]-i[1]*s-a[1]*s]),t.push(c),this._addDash(t,e,[-i[0]*s+a[0]*s,-i[1]*s+a[1]*s]),this._addDash(t,e,[-i[0]*s-a[0]*s,-i[1]*s-a[1]*s]);break}case`SegmentThenHalfCircle`:{let e=this._cp2(n,2,0),i=this._cp3(n,e,1.5,0),a;a=r>=4?n[3]:this._cp3(n,e,1.25,-.5);let s=this._sub(e,o);this._normalize(s);let c=this._dist(e,i)*.5,l=this._crossProduct(s,this._sub(a,o))>0,u=Math.cos(Math.PI/18),d=Math.sin(Math.PI/18);l&&(d=-d);let f=[o,e];s[0]*=c,s[1]*=c;let p=this._add(e,s);s[0]=-s[0],s[1]=-s[1];for(let e=1;e<=18;e++)this._rotateDirect(s,u,d),f.push(this._add(p,s));t.push(f);break}case`LineWithStraightTicks`:{let e=this._cp2(n,-2,1),r=this._cp3(n,e,-1,-.5),i=this._sub(r,e);this._normalize(i);let a=this._dotProduct(i,this._sub(e,o)),s=this._dotProduct(i,this._sub(r,o)),c=[o];c.push([o[0]+i[0]*a,o[1]+i[1]*a]),c.push(e),t.push(c),c=[o],c.push([o[0]+i[0]*s,o[1]+i[1]*s]),c.push(r),t.push(c);break}case`DoubleCurve`:{let e=this._cp2(n,-5,-1),r=this._cp3(n,e,2,0),i=Math.atan2(1,5),s=Math.cos(i),c=Math.sin(i),l=this._sub(e,o),u=this._dist(o,e);this._normalize(l),this._rotateDirect(l,s,-c);let d=[o];d.push([o[0]+l[0]*u*.5,o[1]+l[1]*u*.5]),a(d[1],1),d.push([o[0]+l[0]*u*.8,o[1]+l[1]*u*.8]),this._addBezier2(d,d[2],[o[0]+l[0]*u,o[1]+l[1]*u],e,3);let f=this._sub(r,e),p=this._dist(e,r);this._normalize(f),this._rotateDirect(f,s,-c),this._addBezier2(d,e,[r[0]-f[0]*p,r[1]-f[1]*p],[r[0]-f[0]*p*.8,r[1]-f[1]*p*.8],3),d.push(r),t.push(d);break}case`ParallelWithTicksByWidth`:{let e=this._cp2(n,0,-1),r=this._cp3(n,e,.5,3),i=this._sub(e,o);this._normalize(i);let a=this._crossProduct(i,this._sub(r,o));this._leftPerpendicular(i),a>0?(this._addAngledTicks(t,o,[o[0]+i[0]*a,o[1]+i[1]*a],e),this._addAngledTicks(t,e,[e[0]+i[0]*a,e[1]+i[1]*a],o)):(this._addAngledTicks(t,[o[0]+i[0]*a,o[1]+i[1]*a],o,e),this._addAngledTicks(t,[e[0]+i[0]*a,e[1]+i[1]*a],o,e));break}case`EnclosingRoundedRectangle`:{let e=this._cp2(n,3,-2),t=[Math.min(o[0],e[0]),Math.max(o[1],e[1])],r=[Math.max(o[0],e[0]),Math.min(o[1],e[1])],i=r[0]-t[0],a=t[1]-r[1],s=Math.min(i,a)/10,c=[];c.push([t[0]+s+(i-s*2)*.75,t[1]]),c.push([r[0]-s,t[1]]),this._add90DegArc(c,[r[0]-s,t[1]],[r[0],t[1]-s],[r[0],t[1]]),c.push([r[0],r[1]+s]),this._add90DegArc(c,[r[0],r[1]+s],[r[0]-s,r[1]],r),c.push([t[0]+s,r[1]]),this._add90DegArc(c,[t[0]+s,r[1]],[t[0],r[1]+s],[t[0],r[1]]),c.push([t[0],t[1]-s]),this._add90DegArc(c,[t[0],t[1]-s],[t[0]+s,t[1]],t),c.push([t[0]+s+(i-s*2)*.75,t[1]]);break}case`ParallelOffsetByValue`:{if(n.length<2||this._width===0)break;let e=this._offsetPath(n,this._width*.5);e&&t.push(e);let r=this._offsetPath(n,-this._width*.5);r&&t.push(r);break}default:t.push(n)}}return t}}function l(e){switch(e){case`ParallelOffsetByValue`:return!0;default:return!1}}export{s as EffectControlMeasureLine};
|
|
2
|
+
import{inchesPerMeter as e}from"../../../core/units.js";import{GeometryCursor as t}from"../../../geometry/GeometryCursor.js";import{collectMultipath as n}from"../../../geometry/geometryCursorCollectUtils.js";import r from"../../../geometry/SpatialReference.js";import{getPathLength as i}from"../../../geometry/support/coordsUtils.js";import{setId as a}from"../CIMCursor.js";import{lazyOffsetOperator as o}from"../CIMEffects.js";class s{static{this.instance=null}static local(){return s.instance===null&&(s.instance=new s),s.instance}execute(e,t,n){return new c(e,t,n)}}class c{constructor(e,t,n){this._defaultPointSize=20,this._inputGeometries=e,this._geomUnitsPerPoint=n.geomUnitsPerPoint??1,this._scale=n?.scale,this._rule=t.rule??`FullGeometry`,this._spatialReference=n?.spatialReference??r.WebMercator,this._width=this._computeWidth(t.width??25),this._defaultSize=this._defaultPointSize*this._geomUnitsPerPoint}next(){let e;for(;e=this._inputGeometries.next();){let r=this._processGeom(n(e));if(r?.length)return t.fromJSONCIM({paths:r})}return null}_computeWidth(t){if(!l(this._rule)||this._scale==null||!this._spatialReference.metersPerUnit)return t*this._geomUnitsPerPoint;let n=this._scale/(96*e*this._spatialReference.metersPerUnit);return t/(this._spatialReference.metersPerUnit*n)}_clone(e){return[e[0],e[1]]}_mid(e,t){return[(e[0]+t[0])/2,(e[1]+t[1])/2]}_mix(e,t,n,r){return[e[0]*t+n[0]*r,e[1]*t+n[1]*r]}_add(e,t){return[e[0]+t[0],e[1]+t[1]]}_add2(e,t,n){return[e[0]+t,e[1]+n]}_sub(e,t){return[e[0]-t[0],e[1]-t[1]]}_dist(e,t){return Math.sqrt((e[0]-t[0])*(e[0]-t[0])+(e[1]-t[1])*(e[1]-t[1]))}_norm(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}_normalize(e,t=1){let n=t/this._norm(e);e[0]*=n,e[1]*=n}_leftPerpendicular(e){let t=-e[1],n=e[0];e[0]=t,e[1]=n}_leftPerp(e){return[-e[1],e[0]]}_rightPerpendicular(e){let t=e[1],n=-e[0];e[0]=t,e[1]=n}_rightPerp(e){return[e[1],-e[0]]}_dotProduct(e,t){return e[0]*t[0]+e[1]*t[1]}_crossProduct(e,t){return e[0]*t[1]-e[1]*t[0]}_rotateDirect(e,t,n){let r=e[0]*t-e[1]*n,i=e[0]*n+e[1]*t;e[0]=r,e[1]=i}_makeCtrlPt(e){let t=[e[0],e[1]];return a(t,1),t}_addAngledTicks(e,t,n,r){let i=this._sub(n,t);this._normalize(i);let a=this._crossProduct(i,this._sub(r,t)),o;o=a>0?this._rightPerp(i):this._leftPerp(i);let s=Math.abs(a)/2,c=[];c.push([t[0]+(o[0]-i[0])*s,t[1]+(o[1]-i[1])*s]),c.push(t),c.push(n),c.push([n[0]+(o[0]+i[0])*s,n[1]+(o[1]+i[1])*s]),e.push(c)}_addBezier2(e,t,n,r,i){if(i--===0){e.push(r);return}let a=this._mid(t,n),o=this._mid(n,r),s=this._mid(a,o);this._addBezier2(e,t,a,s,i),this._addBezier2(e,s,o,r,i)}_addBezier3(e,t,n,r,i,a){if(a--===0){e.push(i);return}let o=this._mid(t,n),s=this._mid(n,r),c=this._mid(r,i),l=this._mid(o,s),u=this._mid(s,c),d=this._mid(l,u);this._addBezier3(e,t,o,l,d,a),this._addBezier3(e,d,u,c,i,a)}_add90DegArc(e,t,n,r,i){let a=i??this._crossProduct(this._sub(n,t),this._sub(r,t))>0,o=this._mid(t,n),s=this._sub(o,t);a?this._leftPerpendicular(s):this._rightPerpendicular(s),o[0]+=s[0],o[1]+=s[1],this._addBezier3(e,t,this._mix(t,.33333,o,.66667),this._mix(n,.33333,o,.66667),n,4)}_addArrow(e,t,n){let r=t[0],i=t[1],a=t[t.length-1],o=this._sub(r,i),s=this._norm(o);this._normalize(o);let c=Math.abs(this._crossProduct(o,this._sub(a,i))),l=this._dotProduct(o,this._sub(a,i));l<s*.05?l=s*.05:l>s*.95&&(l=s*.95);let u=c*.5,d=this._leftPerp(o),f=[i[0]+o[0]*l,i[1]+o[1]*l],p=t.length-1,m=[];m.push(n?[-d[0],-d[1]]:d);let h=[-o[0],-o[1]];for(let e=1;e<p-1;e++){let n=this._sub(t[e+1],t[e]);this._normalize(n);let r=this._dotProduct(n,h),i=this._crossProduct(n,h),a=Math.sqrt((1+r)/2),o=this._sub(n,h);this._normalize(o),o[0]/=a,o[1]/=a,m.push(i<0?[-o[0],-o[1]]:o),h=n}m.push(this._rightPerp(h));for(let n=m.length-1;n>0;n--)e.push([t[n][0]+m[n][0]*u,t[n][1]+m[n][1]*u]);e.push([f[0]+m[0][0]*u,f[1]+m[0][1]*u]),e.push([f[0]+m[0][0]*c,f[1]+m[0][1]*c]),e.push(r),e.push([f[0]-m[0][0]*c,f[1]-m[0][1]*c]),e.push([f[0]-m[0][0]*u,f[1]-m[0][1]*u]);for(let n=1;n<m.length;n++)e.push([t[n][0]-m[n][0]*u,t[n][1]-m[n][1]*u])}_addDash(e,t,n){let r=this._norm(n)/7;this._normalize(n);let i=[];for(let a=0;a<=7;a++)i.push([t[0]+n[0]*a*r,t[1]+n[1]*a*r]),a&1&&(e.push(i),i=[])}_cp2(e,t,n){return e.length>=2?e[1]:this._add2(e[0],t*this._defaultSize,n*this._defaultSize)}_cp3(e,t,n,r){if(e.length>=3)return e[2];let i=this._mix(e[0],1-n,t,n),a=this._sub(t,e[0]);return this._normalize(a),this._rightPerpendicular(a),[i[0]+a[0]*r*this._defaultSize,i[1]+a[1]*r*this._defaultSize]}_arrowPath(e){if(e.length>2)return e;let t=e[0],n=this._cp2(e,-4,0),r=this._sub(t,n);this._normalize(r);let i=this._rightPerp(r);return[t,n,[t[0]+(i[0]-r[0])*this._defaultSize,t[1]+(i[1]-r[1])*this._defaultSize]]}_arrowLastSeg(e){let t=e[0],n=this._cp2(e,-4,0),r;if(e.length>=3)r=e[e.length-1];else{let e=this._sub(t,n);this._normalize(e);let i=this._rightPerp(e);r=[t[0]+(i[0]-e[0])*this._defaultSize,t[1]+(i[1]-e[1])*this._defaultSize]}return[n,r]}_offsetPath(e,r){let{offsetExecute:i}=o.module,a=i({paths:[e],spatialReference:this._spatialReference.toJSON()},r,{joins:`miter`,miterLimit:4}),[s]=n(t.fromJSONCIM(a));return s?.length?s:null}_processGeom(e){if(!e)return null;let t=[];for(let n of e){let e=n.length>1&&i(n)<this._defaultSize;if(!n||n.length===0||e)continue;let r=n.length,o=n[0];switch(this._rule){case`PerpendicularFromFirstSegment`:{let e=this._cp2(n,0,-1),r=this._cp3(n,e,.5,4),i=[];i.push(r),i.push(this._mid(o,e)),t.push(i);break}case`ReversedFirstSegment`:{let e=this._cp2(n,0,-1);t.push([e,o]);break}case`PerpendicularToSecondSegment`:{if(n.length<3)return[];let e=this._cp2(n,-4,1),r=this._cp3(n,e,.882353,-1.94),i=[];i.push(this._mid(e,r)),i.push(o),t.push(i);break}case`SecondSegmentWithTicks`:{if(n.length<3)return[];let e=this._cp2(n,-4,1),r=this._cp3(n,e,.882353,-1.94),i=this._sub(r,e),a;a=this._crossProduct(i,this._sub(o,e))>0?this._rightPerp(i):this._leftPerp(i);let s=[];s.push([e[0]+(a[0]-i[0])/3,e[1]+(a[1]-i[1])/3]),s.push(e),s.push(r),s.push([r[0]+(a[0]+i[0])/3,r[1]+(a[1]+i[1])/3]),t.push(s);break}case`DoublePerpendicular`:{let e=this._cp2(n,0,-1),r=this._cp3(n,e,.5,3),i=this._mid(o,e),a=this._sub(i,r);this._normalize(a);let s=this._crossProduct(a,this._sub(o,r));this._leftPerpendicular(a);let c=[];c.push(o),c.push([r[0]+a[0]*s,r[1]+a[1]*s]),t.push(c);let l=[];l.push([r[0]-a[0]*s,r[1]-a[1]*s]),l.push(e),t.push(l);break}case`OppositeToFirstSegment`:{let e=this._cp2(n,0,-1),r=this._cp3(n,e,.5,3),i=this._mid(o,e),a=this._sub(i,r);this._normalize(a);let s=this._crossProduct(a,this._sub(o,r));this._leftPerpendicular(a);let c=[];c.push([r[0]+a[0]*s,r[1]+a[1]*s]),c.push([r[0]-a[0]*s,r[1]-a[1]*s]),t.push(c);break}case`TriplePerpendicular`:{let e=this._cp2(n,0,-1),r=this._cp3(n,e,.5,4),i=this._mid(o,e),a=this._sub(i,r);this._normalize(a);let s=this._crossProduct(a,this._sub(o,r));this._leftPerpendicular(a);let c=[];c.push([r[0]+a[0]*s*.8,r[1]+a[1]*s*.8]),c.push([i[0]+(o[0]-i[0])*.8,i[1]+(o[1]-i[1])*.8]),t.push(c),t.push([r,i]);let l=[];l.push([r[0]-a[0]*s*.8,r[1]-a[1]*s*.8]),l.push([i[0]+(e[0]-i[0])*.8,i[1]+(e[1]-i[1])*.8]),t.push(l);break}case`HalfCircleFirstSegment`:{let e=this._cp2(n,0,-1),r=this._cp3(n,e,.5,4),i=this._mid(o,e),a=this._sub(e,o),s=Math.cos(Math.PI/18),c=Math.sin(Math.PI/18),l=Math.sqrt((1+s)/2),u=Math.sqrt((1-s)/2),d=[],f;this._crossProduct(a,this._sub(r,o))>0?(d.push(o),a=this._sub(o,i),f=e):(d.push(e),a=this._sub(e,i),f=o),this._rotateDirect(a,l,u),a[0]/=l,a[1]/=l;for(let e=1;e<=18;e++)d.push(this._add(i,a)),this._rotateDirect(a,s,c);d.push(f),t.push(d);break}case`HalfCircleSecondSegment`:{let e=this._cp2(n,0,-1),r=this._cp3(n,e,1,-1),i=this._sub(o,e);this._normalize(i);let a=this._crossProduct(i,this._sub(r,e))/2;this._leftPerpendicular(i);let s=[e[0]+i[0]*a,e[1]+i[1]*a];i=this._sub(e,s);let c=Math.cos(Math.PI/18),l=Math.sin(Math.PI/18);a>0&&(l=-l);let u=[e];for(let e=1;e<=18;e++)this._rotateDirect(i,c,l),u.push(this._add(s,i));t.push(u);break}case`HalfCircleExtended`:{let e=this._cp2(n,0,-2),i=this._cp3(n,e,1,-1),a;if(r>=4)a=n[3];else{let t=this._sub(o,e);a=this._add(i,t)}let s=this._dist(e,i)/2/.75,c=this._sub(e,o);this._normalize(c,s);let l=this._sub(i,a);this._normalize(l,s);let u=[a,i];t.push(u);let d=[this._clone(i)];this._addBezier3(d,i,this._add(i,l),this._add(e,c),e,4),d.push(o),t.push(d);break}case`OpenCircle`:{let e=this._cp2(n,-2,0),r=this._sub(e,o),i=Math.cos(Math.PI/18),a=-Math.sin(Math.PI/18),s=[e];for(let e=1;e<=33;e++)this._rotateDirect(r,i,a),s.push(this._add(o,r));t.push(s);break}case`CoverageEdgesWithTicks`:{let e=this._cp2(n,0,-1),i;if(r>=3)i=n[2];else{let t=this._sub(e,o),n=this._leftPerp(t);i=[o[0]+n[0]-t[0]*.25,o[1]+n[1]-t[1]*.25]}let a;if(r>=4)a=n[3];else{let t=this._mid(o,e),n=this._sub(o,e);this._normalize(n),this._leftPerpendicular(n);let r=this._crossProduct(n,this._sub(i,t));this._rightPerpendicular(n),a=[i[0]+n[0]*r*2,i[1]+n[1]*r*2]}let s=this._sub(e,o),c,l;c=this._crossProduct(s,this._sub(i,o))>0?this._rightPerp(s):this._leftPerp(s),l=[],l.push(i),l.push(o),l.push([o[0]+(c[0]-s[0])/3,o[1]+(c[1]-s[1])/3]),t.push(l),c=this._crossProduct(s,this._sub(a,e))>0?this._rightPerp(s):this._leftPerp(s),l=[],l.push([e[0]+(c[0]+s[0])/3,e[1]+(c[1]+s[1])/3]),l.push(e),l.push(a),t.push(l);break}case`GapExtentWithDoubleTicks`:{let e=this._cp2(n,0,2),i=this._cp3(n,e,0,1),a;if(r>=4)a=n[3];else{let t=this._sub(e,o);a=this._add(i,t)}this._addAngledTicks(t,o,e,this._mid(i,a)),this._addAngledTicks(t,i,a,this._mid(o,e));break}case`GapExtentMidline`:{let e=this._cp2(n,2,0),i=this._cp3(n,e,0,1),a;if(r>=4)a=n[3];else{let t=this._sub(e,o);a=this._add(i,t)}let s=[];s.push(this._mid(o,i)),s.push(this._mid(e,a)),t.push(s);break}case`Chevron`:{let e=this._cp2(n,-1,-1),i;if(r>=3)i=n[2];else{let t=this._sub(e,o);this._leftPerpendicular(t),i=this._add(o,t)}t.push([e,this._makeCtrlPt(o),i]);break}case`PerpendicularWithArc`:{let e=this._cp2(n,0,-2),i=this._cp3(n,e,.5,-1),a=this._sub(e,o),s=this._norm(a);a[0]/=s,a[1]/=s;let c=this._crossProduct(a,this._sub(i,o)),l=this._dotProduct(a,this._sub(i,o));l<s*.05?l=s*.05:l>s*.95&&(l=s*.95);let u=[o[0]+a[0]*l,o[1]+a[1]*l],d=this._leftPerp(a),f=[];if(f.push([u[0]-d[0]*c,u[1]-d[1]*c]),f.push([u[0]+d[0]*c,u[1]+d[1]*c]),t.push(f),r>=4){let e=n[3],r=this._dotProduct(a,this._sub(e,o));r<s*.1?r=s*.1:r>s*.9&&(r=s*.9);let i=[o[0]+a[0]*r,o[1]+a[1]*r],c=this._crossProduct(a,this._sub(e,o)),l=[];l.push([i[0]-d[0]*c,i[1]-d[1]*c]),l.push([i[0]+d[0]*c,i[1]+d[1]*c]),t.push(l)}let p=[e[0]+d[0]*c,e[1]+d[1]*c];d=this._sub(e,p);let m=Math.cos(Math.PI/18),h=Math.sin(Math.PI/18);c<0&&(h=-h),f=[o,e];for(let e=1;e<=9;e++)this._rotateDirect(d,m,h),f.push(this._add(p,d));t.push(f);break}case`ClosedHalfCircle`:{let e=this._cp2(n,2,0),r=this._mid(o,e),i=this._sub(e,r),a=Math.cos(Math.PI/18),s=Math.sin(Math.PI/18),c=[o,e];for(let e=1;e<=18;e++)this._rotateDirect(i,a,s),c.push(this._add(r,i));t.push(c);break}case`TripleParallelExtended`:{let e=this._cp2(n,0,-2),r=this._cp3(n,e,1,-2),i=this._mid(o,e),s=this._sub(r,e);this._normalize(s);let c=Math.abs(this._crossProduct(s,this._sub(i,e)))/2,l=this._dist(e,r),u=[e,o];u.push([o[0]+s[0]*l*.5,o[1]+s[1]*l*.5]),t.push(u);let d=[];d.push([i[0]-s[0]*c,i[1]-s[1]*c]),d.push([i[0]+s[0]*l*.375,i[1]+s[1]*l*.375]),a(d[d.length-1],1),d.push([i[0]+s[0]*l*.75,i[1]+s[1]*l*.75]),t.push(d);let f=[e,r];t.push(f);break}case`ParallelWithTicks`:{let e=this._cp2(n,3,0),r=this._cp3(n,e,.5,-1),i=this._sub(e,o);this._normalize(i);let a=this._crossProduct(i,this._sub(r,o)),s=this._leftPerp(i);this._addAngledTicks(t,o,e,r),this._addAngledTicks(t,this._add2(o,s[0]*a,s[1]*a),this._add2(e,s[0]*a,s[1]*a),this._mid(o,e));break}case`Parallel`:{let e=this._cp2(n,3,0),r=this._cp3(n,e,.5,-1),i=this._sub(e,o);this._normalize(i);let a=this._leftPerp(i),s=this._crossProduct(i,this._sub(r,o)),c=[o,e];t.push(c),c=[],c.push([o[0]+a[0]*s,o[1]+a[1]*s]),c.push([e[0]+a[0]*s,e[1]+a[1]*s]),t.push(c);break}case`PerpendicularToFirstSegment`:{let e=this._cp2(n,3,0),r=this._cp3(n,e,.5,-1),i=this._mid(o,e),a=this._sub(e,o);this._normalize(a);let s=this._crossProduct(a,this._sub(r,o));this._leftPerpendicular(a);let c=[];c.push([i[0]-a[0]*s*.25,i[1]-a[1]*s*.25]),c.push([i[0]+a[0]*s*1.25,i[1]+a[1]*s*1.25]),t.push(c);break}case`ParallelOffset`:{let e=this._cp2(n,3,0),r=this._cp3(n,e,.5,-1),i=this._sub(e,o);this._normalize(i);let a=this._crossProduct(i,this._sub(r,o));this._leftPerpendicular(i);let s=[];s.push([o[0]-i[0]*a,o[1]-i[1]*a]),s.push([e[0]-i[0]*a,e[1]-i[1]*a]),t.push(s);let c=[];c.push([o[0]+i[0]*a,o[1]+i[1]*a]),c.push([e[0]+i[0]*a,e[1]+i[1]*a]),t.push(c);break}case`OffsetOpposite`:{let e=this._cp2(n,3,0),r=this._cp3(n,e,.5,-1),i=this._sub(e,o);this._normalize(i);let a=this._crossProduct(i,this._sub(r,o));this._leftPerpendicular(i);let s=[];s.push([o[0]-i[0]*a,o[1]-i[1]*a]),s.push([e[0]-i[0]*a,e[1]-i[1]*a]),t.push(s);break}case`OffsetSame`:{let e=this._cp2(n,3,0),r=this._cp3(n,e,.5,-1),i=this._sub(e,o);this._normalize(i);let a=this._crossProduct(i,this._sub(r,o));this._leftPerpendicular(i);let s=[];s.push([o[0]+i[0]*a,o[1]+i[1]*a]),s.push([e[0]+i[0]*a,e[1]+i[1]*a]),t.push(s);break}case`CircleWithArc`:{let e=this._cp2(n,3,0),i=this._cp3(n,e,.5,-1),s,c;if(r>=4)s=n[3],c=this._crossProduct(this._sub(s,e),this._sub(i,e))>0;else{s=e,c=this._crossProduct(this._sub(s,o),this._sub(i,o))>0;let t=24*this._geomUnitsPerPoint,n=this._sub(s,o);this._normalize(n,t);let r=Math.sqrt(2)/2;this._rotateDirect(n,r,c?r:-r),e=this._add(o,n)}let l=this._sub(e,o),u=Math.cos(Math.PI/18),d=Math.sin(Math.PI/18),f=[e];for(let e=1;e<=36;e++)this._rotateDirect(l,u,d),f.push(this._add(o,l));this._add90DegArc(f,e,s,i,c),a(f[f.length-8],1),t.push(f);break}case`DoubleJog`:{let e=this._cp2(n,-3,1),i=this._cp3(n,e,-1,-.5),a;if(r>=4)a=n[3];else{let t=o;o=e,a=i;let n=this._dist(o,t),r=this._dist(a,t),s=30*this._geomUnitsPerPoint;n*.5<s&&(s=n*.5),r*.5<s&&(s=r*.5),e=this._mix(o,s/n,t,(n-s)/n),i=this._mix(a,s/r,t,(r-s)/r)}let s=this._mid(o,e),c=this._mid(a,i),l=this._dist(o,e),u=this._dist(i,a),d=Math.min(l,u)/8;d=Math.min(d,24*this._geomUnitsPerPoint);let f=Math.cos(Math.PI/4),p=this._sub(o,e);this._normalize(p,d),this._crossProduct(p,this._sub(a,e))>0?this._rotateDirect(p,f,-f):this._rotateDirect(p,f,f);let m=[];m.push(e),m.push(this._add(s,p)),m.push(this._sub(s,p)),m.push(o),t.push(m),p=this._sub(a,i),this._normalize(p,d),this._crossProduct(p,this._sub(o,i))<0?this._rotateDirect(p,f,f):this._rotateDirect(p,f,-f),m=[],m.push(i),m.push(this._add(c,p)),m.push(this._sub(c,p)),m.push(a),t.push(m);break}case`PerpendicularOffset`:{let e=this._cp2(n,-4,1),r=this._cp3(n,e,.882353,-1.94),i=this._sub(r,e);this._crossProduct(i,this._sub(o,e))>0?this._rightPerpendicular(i):this._leftPerpendicular(i);let a=[i[0]/8,i[1]/8],s=this._sub(this._mid(e,r),a);t.push([s,o]);break}case`LineExcludingLastSegment`:{let e=this._arrowPath(n),r=[],i=e.length-2;for(;i--;)r.push(e[i]);t.push(r);break}case`MultivertexArrow`:{let e=this._arrowPath(n),r=[];this._addArrow(r,e,!1),t.push(r);break}case`CrossedArrow`:{let e=this._arrowPath(n),r=[];this._addArrow(r,e,!0),t.push(r);break}case`ChevronArrow`:{let[e,r]=this._arrowLastSeg(n),i=10*this._geomUnitsPerPoint,a=this._sub(o,e),s=this._norm(a);this._normalize(a);let c=this._crossProduct(a,this._sub(r,e)),l=this._dotProduct(a,this._sub(r,e));l<s*.05?l=s*.05:l>s*.95-i&&(l=s*.95-i);let u=[e[0]+a[0]*l,e[1]+a[1]*l],d=this._leftPerp(a),f=[];f.push([u[0]+d[0]*c+a[0]*i,u[1]+d[1]*c+a[1]*i]),f.push(o),f.push([u[0]-d[0]*c+a[0]*i,u[1]-d[1]*c+a[1]*i]),t.push(f);break}case`ChevronArrowOffset`:{let[e,r]=this._arrowLastSeg(n),i=this._sub(o,e),a=this._norm(i);this._normalize(i);let s=this._crossProduct(i,this._sub(r,e)),c=this._dotProduct(i,this._sub(r,e));c<a*.05?c=a*.05:c>a*.95&&(c=a*.95);let l=[e[0]+i[0]*c,e[1]+i[1]*c];this._leftPerpendicular(i);let u=[];u.push([l[0]+i[0]*s*.5,l[1]+i[1]*s*.5]),u.push(this._mid(l,o)),u.push([l[0]-i[0]*s*.5,l[1]-i[1]*s*.5]),t.push(u);break}case`PartialFirstSegment`:{let[e,r]=this._arrowLastSeg(n),i=this._sub(o,e),a=this._norm(i);this._normalize(i);let s=this._dotProduct(i,this._sub(r,e));s<a*.05?s=a*.05:s>a*.95&&(s=a*.95);let c=[e[0]+i[0]*s,e[1]+i[1]*s];t.push([e,c]);break}case`Arch`:{let e=this._cp2(n,0,-1),r=this._cp3(n,e,.5,1),i=this._sub(o,e),a=this._mix(r,1,i,.55),s=this._mix(r,1,i,-.55),c=[o];this._addBezier2(c,o,a,r,4),this._addBezier2(c,r,s,e,4),t.push(c);break}case`CurvedParallelTicks`:{let e=this._cp2(n,-4,1),r=this._cp3(n,e,.882353,-1.94),i=this._sub(r,e);this._crossProduct(i,this._sub(o,e))>0?this._rightPerpendicular(i):this._leftPerpendicular(i);let a=[i[0]/8,i[1]/8],s=this._sub(this._mid(e,r),a),c=this._sub(this._mix(e,.75,r,.25),a),l=this._sub(this._mix(e,.25,r,.75),a),u=[e];this._addBezier2(u,e,c,s,3),this._addBezier2(u,s,l,r,3),t.push(u);for(let e=0;e<8;e++){let n=u[e*2+1],r=[this._clone(n)];r.push(this._add(n,[i[0]/4,i[1]/4])),t.push(r)}break}case`Arc90Degrees`:{let e=this._cp2(n,0,-1),r=this._cp3(n,e,.5,1),i=[e];this._add90DegArc(i,e,o,r),t.push(i);break}case`TipWithPerpendicularAndTicks`:{let[e,r]=this._arrowLastSeg(n),i=10*this._geomUnitsPerPoint,a=this._sub(o,e),s=this._norm(a);this._normalize(a);let c=this._crossProduct(a,this._sub(r,e)),l=this._dotProduct(a,this._sub(r,e));l<s*.05?l=s*.05:l>s*.95-i&&(l=s*.95-i);let u=this._leftPerp(a),d=[o[0]-a[0]*i,o[1]-a[1]*i],f=Math.max(s-l-i,i)*.5;c=Math.abs(c);let p=[];p.push([d[0]+u[0]*(c+f)-a[0]*f,d[1]+u[1]*(c+f)-a[1]*f]),p.push([d[0]+u[0]*c,d[1]+u[1]*c]),p.push([d[0]-u[0]*c,d[1]-u[1]*c]),p.push([d[0]-u[0]*(c+f)-a[0]*f,d[1]-u[1]*(c+f)-a[1]*f]),t.push(p),t.push([d,o]);break}case`ConcentricCircles`:{let e=this._cp2(n,1,0),i=this._cp3(n,e,2,0),s=Math.cos(Math.PI/18),c=Math.sin(Math.PI/18),l=this._dist(e,o),u=[l,0],d=[];for(let e=0;e<=36;e++)d.push(this._add(o,u)),this._rotateDirect(u,s,c);if(t.push(d),r>=4){d=[];let e=n[3];l=this._dist(e,o),u=[l,0];for(let e=0;e<=36;e++)d.push(this._add(o,u)),e===0&&(d.push(this._add(o,u)),a(d[1],1)),this._rotateDirect(u,s,c);t.push(d)}d=[],l=this._dist(i,o),u=[l,0];for(let e=0;e<=36;e++)d.push(this._add(o,u)),this._rotateDirect(u,s,c);t.push(d);break}case`DoubleJogArrow`:{o=this._arrowPath(n)[0];let[e,r]=this._arrowLastSeg(n),i=this._sub(o,e),a=this._norm(i);this._normalize(i);let s=Math.abs(this._crossProduct(i,this._sub(r,o))),c=Math.abs(this._dotProduct(i,this._sub(r,o)));c<a*.05?c=a*.05:c>a*.95&&(c=a*.95);let l=Math.max(s,c),u=this._leftPerp(i),d=[],f=[o[0]-i[0]*c*.5+u[0]*s*.5,o[1]-i[1]*c*.5+u[1]*s*.5];d.push([f[0],f[1]]),f[0]+=i[0]*l*.5+u[0]*l*.4,f[1]+=i[1]*l*.5+u[1]*l*.4,d.push([f[0],f[1]]),f[0]-=u[0]*l*.25,f[1]-=u[1]*l*.25,d.push([f[0],f[1]]),f[0]+=i[0]*l*.5+u[0]*l*.4,f[1]+=i[1]*l*.5+u[1]*l*.4,d.push([f[0],f[1]]),t.push(d),d=[],f[0]=o[0]-i[0]*c*.5-u[0]*s*.5,f[1]=o[1]-i[1]*c*.5-u[1]*s*.5,d.push([f[0],f[1]]),f[0]+=i[0]*l*.5-u[0]*l*.4,f[1]+=i[1]*l*.5-u[1]*l*.4,d.push([f[0],f[1]]),f[0]+=u[0]*l*.25,f[1]+=u[1]*l*.25,d.push([f[0],f[1]]),f[0]+=i[0]*l*.5-u[0]*l*.4,f[1]+=i[1]*l*.5-u[1]*l*.4,d.push([f[0],f[1]]),t.push(d);break}case`LinkedChevrons`:{let e=this._cp2(n,-5,0),r=this._cp3(n,e,-.2,1),i=this._sub(o,e);this._normalize(i);let a=this._leftPerp(i),s=Math.abs(this._crossProduct(i,this._sub(r,e)));t.push([e,o]);let c=[];c.push([o[0]-i[0]*s+a[0]*s,o[1]-i[1]*s+a[1]*s]),c.push(o),c.push([o[0]-i[0]*s-a[0]*s,o[1]-i[1]*s-a[1]*s]),t.push(c),this._addDash(t,e,[-i[0]*s+a[0]*s,-i[1]*s+a[1]*s]),this._addDash(t,e,[-i[0]*s-a[0]*s,-i[1]*s-a[1]*s]);break}case`SegmentThenHalfCircle`:{let e=this._cp2(n,2,0),i=this._cp3(n,e,1.5,0),a;a=r>=4?n[3]:this._cp3(n,e,1.25,-.5);let s=this._sub(e,o);this._normalize(s);let c=this._dist(e,i)*.5,l=this._crossProduct(s,this._sub(a,o))>0,u=Math.cos(Math.PI/18),d=Math.sin(Math.PI/18);l&&(d=-d);let f=[o,e];s[0]*=c,s[1]*=c;let p=this._add(e,s);s[0]=-s[0],s[1]=-s[1];for(let e=1;e<=18;e++)this._rotateDirect(s,u,d),f.push(this._add(p,s));t.push(f);break}case`LineWithStraightTicks`:{let e=this._cp2(n,-2,1),r=this._cp3(n,e,-1,-.5),i=this._sub(r,e);this._normalize(i);let a=this._dotProduct(i,this._sub(e,o)),s=this._dotProduct(i,this._sub(r,o)),c=[o];c.push([o[0]+i[0]*a,o[1]+i[1]*a]),c.push(e),t.push(c),c=[o],c.push([o[0]+i[0]*s,o[1]+i[1]*s]),c.push(r),t.push(c);break}case`DoubleCurve`:{let e=this._cp2(n,-5,-1),r=this._cp3(n,e,2,0),i=Math.atan2(1,5),s=Math.cos(i),c=Math.sin(i),l=this._sub(e,o),u=this._dist(o,e);this._normalize(l),this._rotateDirect(l,s,-c);let d=[o];d.push([o[0]+l[0]*u*.5,o[1]+l[1]*u*.5]),a(d[1],1),d.push([o[0]+l[0]*u*.8,o[1]+l[1]*u*.8]),this._addBezier2(d,d[2],[o[0]+l[0]*u,o[1]+l[1]*u],e,3);let f=this._sub(r,e),p=this._dist(e,r);this._normalize(f),this._rotateDirect(f,s,-c),this._addBezier2(d,e,[r[0]-f[0]*p,r[1]-f[1]*p],[r[0]-f[0]*p*.8,r[1]-f[1]*p*.8],3),d.push(r),t.push(d);break}case`ParallelWithTicksByWidth`:{let e=this._cp2(n,0,-1),r=this._cp3(n,e,.5,3),i=this._sub(e,o);this._normalize(i);let a=this._crossProduct(i,this._sub(r,o));this._leftPerpendicular(i),a>0?(this._addAngledTicks(t,o,[o[0]+i[0]*a,o[1]+i[1]*a],e),this._addAngledTicks(t,e,[e[0]+i[0]*a,e[1]+i[1]*a],o)):(this._addAngledTicks(t,[o[0]+i[0]*a,o[1]+i[1]*a],o,e),this._addAngledTicks(t,[e[0]+i[0]*a,e[1]+i[1]*a],o,e));break}case`EnclosingRoundedRectangle`:{let e=this._cp2(n,3,-2),t=[Math.min(o[0],e[0]),Math.max(o[1],e[1])],r=[Math.max(o[0],e[0]),Math.min(o[1],e[1])],i=r[0]-t[0],a=t[1]-r[1],s=Math.min(i,a)/10,c=[];c.push([t[0]+s+(i-s*2)*.75,t[1]]),c.push([r[0]-s,t[1]]),this._add90DegArc(c,[r[0]-s,t[1]],[r[0],t[1]-s],[r[0],t[1]]),c.push([r[0],r[1]+s]),this._add90DegArc(c,[r[0],r[1]+s],[r[0]-s,r[1]],r),c.push([t[0]+s,r[1]]),this._add90DegArc(c,[t[0]+s,r[1]],[t[0],r[1]+s],[t[0],r[1]]),c.push([t[0],t[1]-s]),this._add90DegArc(c,[t[0],t[1]-s],[t[0]+s,t[1]],t),c.push([t[0]+s+(i-s*2)*.75,t[1]]);break}case`ParallelOffsetByValue`:{if(n.length<2||this._width===0)break;let e=this._offsetPath(n,this._width*.5);e&&t.push(e);let r=this._offsetPath(n,-this._width*.5);r&&t.push(r);break}default:t.push(n)}}return t}}function l(e){return e===`ParallelOffsetByValue`}export{s as EffectControlMeasureLine};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../../core/RandomLCG.js";import{Placement as t}from"../CIMPlacements.js";const n=1e-6;class r{static{this.instance=null}static local(){return r.instance===null&&(r.instance=new r),r.instance}execute(e,t,n,r){return new i(e,t,n,r)}}class i{constructor(n,r,i,a){if(this._xMin=0,this._xMax=0,this._yMin=0,this._yMax=0,this._currentX=0,this._currentY=0,this._accelerationMap=null,this._testInsidePolygon=!1,this._verticalSubdivision=!0,this._stepX=Math.abs(r.stepX??16)*i,this._stepY=Math.abs(r.stepY??16)*i,this._stepX=Math.round(this._stepX*128)/128,this._stepY=Math.round(this._stepY*128)/128,this._stepX!==0&&this._stepY!==0){if(this._gridType=r.gridType??`Fixed`,this._gridType===`Random`){let t=r.seed??13;this._randomLCG=new e(t
|
|
2
|
+
import e from"../../../core/RandomLCG.js";import{Placement as t}from"../CIMPlacements.js";const n=1e-6;class r{static{this.instance=null}static local(){return r.instance===null&&(r.instance=new r),r.instance}execute(e,t,n,r){return new i(e,t,n,r)}}class i{constructor(n,r,i,a){if(this._xMin=0,this._xMax=0,this._yMin=0,this._yMax=0,this._currentX=0,this._currentY=0,this._accelerationMap=null,this._testInsidePolygon=!1,this._verticalSubdivision=!0,this._stepX=Math.abs(r.stepX??16)*i,this._stepY=Math.abs(r.stepY??16)*i,this._stepX=Math.round(this._stepX*128)/128,this._stepY=Math.round(this._stepY*128)/128,this._stepX!==0&&this._stepY!==0){if(this._gridType=r.gridType??`Fixed`,this._gridType===`Random`){let t=r.seed??13;this._randomLCG=new e(+t),this._randomness=(r.randomness??100)/100,this._gridAngle=0,this._shiftOddRows=!1,this._cosAngle=1,this._sinAngle=0,this._offsetX=0,this._offsetY=0,this._buildRandomValues()}else{if(this._randomness=0,this._gridAngle=r.gridAngle??0,this._shiftOddRows=r.shiftOddRows??!1,this._offsetX=(r.offsetX??0)*i,this._offsetY=(r.offsetY??0)*i,this._cosAngle=Math.cos(this._gridAngle/180*Math.PI),this._sinAngle=-Math.sin(this._gridAngle/180*Math.PI),this._stepX){if(this._offsetX<0)for(;this._offsetX<-.5*this._stepX;)this._offsetX+=this._stepX;else for(;this._offsetX>=.5*this._stepX;)this._offsetX-=this._stepX}if(this._stepY){if(this._offsetY<0)for(;this._offsetY<-.5*this._stepY;)this._offsetY+=this._stepY;else for(;this._offsetY>=.5*this._stepY;)this._offsetY-=this._stepY}}if(this._graphicOriginX=0,this._graphicOriginY=0,a!=null){let[e,t,n,r]=a.split(`/`,4),i=parseFloat(e),o=parseFloat(t),s=parseFloat(n),c=parseFloat(r);this._graphicOriginX=-(c*2**i+s)*512,this._graphicOriginY=o*512,this._testInsidePolygon=!0}this._internalPlacement=new t,this._calculateMinMax(n),this._geometryCursor=n}}next(){return this._geometryCursor?this._nextInside():null}_buildRandomValues(){if(!i._randValues){i._randValues=[];for(let e=0;e<24;e++)for(let e=0;e<24;e++)i._randValues.push(this._randomLCG.getFloat()),i._randValues.push(this._randomLCG.getFloat())}}_calculateMinMax(e){this._xMin=0,this._xMax=0,this._yMin=0,this._yMax=0;let t,n,r,i,a,o,s,c,l,u,d,f,p,m;s=c=p=d=Number.MAX_VALUE,l=u=m=f=-Number.MAX_VALUE;let h=this._cosAngle!==1;for(e.reset();e.nextPath();)for(;e.nextPoint();)o=e.x,a=e.y,t=o-this._graphicOriginX-this._offsetX,n=a-this._graphicOriginY-this._offsetY,h?(r=this._cosAngle*t-this._sinAngle*n,i=this._sinAngle*t+this._cosAngle*n):(r=t,i=n),s=Math.min(s,r),l=Math.max(l,r),c=Math.min(c,i),u=Math.max(u,i),d=Math.min(d,a),f=Math.max(f,a),p=Math.min(p,o),m=Math.max(m,o);d=d===Number.MAX_VALUE?-512-this._stepY:d,f=f===-Number.MAX_VALUE?this._stepY:f,p=p===Number.MAX_VALUE?-this._stepX:p,m=m===-Number.MAX_VALUE?512+this._stepX:m;let g=f-d,_=m-p;if(this._verticalSubdivision=g>=_,this._polygonMin=this._verticalSubdivision?d:p,this._testInsidePolygon){let e=0-this._graphicOriginX-this._offsetX-this._stepX,t=512-this._graphicOriginX-this._offsetX+this._stepX,n=-512-this._graphicOriginY-this._offsetY-this._stepY,r=0-this._graphicOriginY-this._offsetY+this._stepY;if(h){let i=[[e,n],[e,r],[t,n],[t,r]];e=n=Number.MAX_VALUE,t=r=-Number.MAX_VALUE;for(let a of i){let i=this._cosAngle*a[0]-this._sinAngle*a[1],o=this._sinAngle*a[0]+this._cosAngle*a[1];e=Math.min(e,i),t=Math.max(t,i),n=Math.min(n,o),r=Math.max(r,o)}}s=s===Number.MAX_VALUE?e:Math.max(s,e),c=c===Number.MAX_VALUE?n:Math.max(c,n),l=l===-Number.MAX_VALUE?t:Math.min(l,t),u=u===-Number.MAX_VALUE?r:Math.min(u,r)}this._xMin=Math.round(s/this._stepX),this._xMax=Math.round(l/this._stepX),this._yMin=Math.round(c/this._stepY),this._yMax=Math.round(u/this._stepY),this._currentX=this._xMax+1,this._currentY=this._yMin-1,this._buildAccelerationMap(e,p,m,d,f)}_buildAccelerationMap(e,t,n,r,i){e.reset();let a=new Map,s=this._verticalSubdivision,c=s?i-r:n-t,l=Math.ceil(c/10);if(l<=1)return;let u=Math.floor(c/l);l++,this._delta=u;let d,f,p,m,h,g,_,v,y,b,x;for(s?(y=-512-2*this._stepY,b=2*this._stepY,x=r):(y=-2*this._stepX,b=512+2*this._stepX,x=t);e.nextPath();)if(!(e.pathSize<2)&&e.nextPoint())for(d=e.x,f=e.y;e.nextPoint();d=p,f=m){if(p=e.x,m=e.y,s){if(f===m||f<y&&m<y||f>b&&m>b)continue;h=Math.min(f,m),g=Math.max(f,m)}else{if(d===p||d<y&&p<y||d>b&&p>b)continue;h=Math.min(d,p),g=Math.max(d,p)}for(;h<g;)_=Math.floor((h-x)/u),o(_,d,f,p,m,a),h+=u;v=Math.floor((g-x)/u),v>_&&o(v,d,f,p,m,a)}this._accelerationMap=a}_nextInside(){for(;;){if(this._currentX>this._xMax){if(this._currentY++,this._currentY>this._yMax)return null;this._currentX=this._xMin,this._shiftOddRows&&this._currentY%2&&this._currentX--}let e=this._currentX*this._stepX+this._offsetX;this._shiftOddRows&&this._currentY%2&&(e+=.5*this._stepX);let t=this._currentY*this._stepY+this._offsetY;this._currentX++;let n,r;if(this._gridType===`Random`){let a=(this._currentX%24+24)%24,o=(this._currentY%24+24)%24;n=this._graphicOriginX+e+this._stepX*this._randomness*(.5-i._randValues[o*24+a])*2/3,r=this._graphicOriginY+t+this._stepY*this._randomness*(.5-i._randValues[o*24+a+1])*2/3}else n=this._graphicOriginX+this._cosAngle*e+this._sinAngle*t,r=this._graphicOriginY-this._sinAngle*e+this._cosAngle*t;if(!this._testInsidePolygon||this._isInsidePolygon(n,r,this._geometryCursor))return this._internalPlacement.setTranslate(n,r),this._internalPlacement}}_isInsidePolygon(e,t,r){if(this._accelerationMap==null)return a(e,t,r);e+=n,t+=n;let i=this._verticalSubdivision,o=Math.floor(((i?t:e)-this._polygonMin)/this._delta),s=this._accelerationMap.get(o);if(!s)return!1;let c=0,l,u,d;for(let n of s){if(l=n[0],u=n[1],i){if(l[1]>t==u[1]>t)continue;d=(u[0]-l[0])*(t-l[1])-(u[1]-l[1])*(e-l[0])}else{if(l[0]>e==u[0]>e)continue;d=(u[1]-l[1])*(e-l[0])-(u[0]-l[0])*(t-l[1])}d>0?c++:c--}return c!==0}}function a(e,t,r){let i=0,a,o,s,c;for(e+=n,t+=n,r.reset();r.nextPath();)if(r.nextPoint())for(a=r.x,o=r.y;r.nextPoint();a=s,o=c)s=r.x,c=r.y,o>t!=c>t&&((s-a)*(t-o)-(c-o)*(e-a)>0?i++:i--);return i!==0}function o(e,t,n,r,i,a){let o=a.get(e);o||(o=[],a.set(e,o)),o.push([[t,n],[r,i]])}export{r as PlacementInsidePolygon};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{EuclideanDistanceTransform as e}from"../../core/EuclideanDistanceTransform.js";import{packFloatRGBA as t}from"../../core/floatRGBA.js";import n from"../../core/Logger.js";import{nextPowerOfTwo as r}from"../../core/mathUtils.js";import{gradientTextureExternalPadding as i}from"../../views/2d/engine/webgl/definitions.js";import{dashSdfRasterizationScale as a,dashSdfDistanceNormalization as o,dashRadius as s}from"./constants.js";import{defaultCIMValues as c}from"./defaultCIMValues.js";const l=()=>n.getLogger(`esri.symbols.cim.rasterizingUtils`),u=e=>e===`vertical`||e===`horizontal`||e===`cross`||e===`esriSFSCross`||e===`esriSFSVertical`||e===`esriSFSHorizontal`;function d(t,n,r,i){let a=n*r,o=new Float64Array(a),s=!1;for(let e=0;e<a;e++){let n=t[4*e+3]/255;s||=n>0,o[e]=n===0?Number.MAX_VALUE:n===1?0:(1-n)*(1-n)}let c=new Uint8Array(a*4);if(!s)return c;new e(Math.max(n,r)).compute(o,n,r);for(let e=0;e<a;e++){let t=Math.min(Math.max(i+.5-o[e],0),1);c[4*e]=255*t,c[4*e+1]=255*t,c[4*e+2]=255*t,c[4*e+3]=255*t}return c}function f(n,r,i,a){let o=r*i,s=new Float64Array(o),c=new Float64Array(o),l=!1;for(let e=0;e<o;e++){let t=n[4*e+3]/255;if(l||=t>0,t===0)s[e]=Number.MAX_VALUE,c[e]=0;else if(t===1)s[e]=0,c[e]=Number.MAX_VALUE;else{let n=.5-t;s[e]=n>0?n*n:0,c[e]=n<0?n*n:0}}let u=new Uint8Array(o*4),d=Math.max(Math.ceil(a)+1,1);if(!l)return{image:u,encodingRadius:d};let f=new e(Math.max(r,i));f.compute(s,r,i),f.compute(c,r,i);for(let e=0;e<o;e++){let n=s[e]-c[e]-a,r=Math.min(Math.max(.5-n/(2*d),0),1);t(r,u,4*e)}return{image:u,encodingRadius:d}}function p(e,t,n,r=128){let i=new Map,a=(e,t,n,r)=>{let a=`${e},${t}`,o=i.get(a),s=[[e,t],[n,r]];o?o.push(s):i.set(a,[s])},o=(i,a)=>i>=0&&i<t&&a>=0&&a<n&&e[4*(a*t+i)+3]>=r;for(let e=0;e<n;e++)for(let n=0;n<t;n++)o(n,e)&&(o(n,e-1)||a(n,e,n+1,e),o(n+1,e)||a(n+1,e,n+1,e+1),o(n,e+1)||a(n+1,e+1,n,e+1),o(n-1,e)||a(n,e+1,n,e));let s=[];for(;i.size>0;){let e=i.entries().next();if(e.done)break;let[t,n]=e.value,r=n.pop();if(!r){i.delete(t);continue}n.length===0&&i.delete(t);let a=[r[0],r[1]],o=r[0],c=r[1];for(;c[0]!==o[0]||c[1]!==o[1];){let e=`${c[0]},${c[1]}`,t=i.get(e);if(!t)break;let n=t.pop();if(!n){i.delete(e);break}t.length===0&&i.delete(e),c=n[1],a.push(c)}a.length>=4&&c[0]===o[0]&&c[1]===o[1]&&s.push(a)}return s}function m(e,t){let n=new Uint8Array(e.length);for(let r=0;r<e.length;r+=4){let i=e[r+3]*t[r+3]/65025;n[r]=e[r]*i,n[r+1]=e[r+1]*i,n[r+2]=e[r+2]*i,n[r+3]=255*i}return n}function h(e,t,n){let i=t.style,a=r(Math.ceil(n)),o=u(i)?a*8:a*16,s=a*2;e.width=o,e.height=o;let c=e.getContext(`2d`);c.strokeStyle=`#ffffff`,c.lineWidth=a,c.beginPath(),(i===`vertical`||i===`cross`||i===`esriSFSCross`||i===`esriSFSVertical`)&&(c.moveTo(o/2,-s),c.lineTo(o/2,o+s)),(i===`horizontal`||i===`cross`||i===`esriSFSCross`||i===`esriSFSHorizontal`)&&(c.moveTo(-s,o/2),c.lineTo(o+s,o/2)),(i===`backward-diagonal`||i===`diagonal-cross`||i===`esriSFSDiagonalCross`||i===`esriSFSBackwardDiagonal`)&&(c.moveTo(-s,-s),c.lineTo(o+s,o+s),c.moveTo(o-s,-s),c.lineTo(o+s,s),c.moveTo(-s,o-s),c.lineTo(s,o+s)),(i===`forward-diagonal`||i===`diagonal-cross`||i===`esriSFSForwardDiagonal`||i===`esriSFSDiagonalCross`)&&(c.moveTo(o+s,-s),c.lineTo(-s,o+s),c.moveTo(s,-s),c.lineTo(-s,s),c.moveTo(o+s,o-s),c.lineTo(o-s,o+s)),c.stroke();let l=c.getImageData(0,0,e.width,e.height),d=new Uint8Array(l.data),f;for(let e=0;e<d.length;e+=4)f=d[e+3]/255,d[e]=d[e]*f,d[e+1]=d[e+1]*f,d[e+2]=d[e+2]*f;return[d,e.width,e.height,a]}function g(e){e.length%2==1&&(e=[...e,...e]);let n=0,r=e.length-1;for(;n<e.length&&e[n]===0;)n++;for(;r>=0&&e[r]===0;)r--;let i=0,s=[];for(let t=n;t<=r;t++)e[t]===0?i++:i===0?s.push(e[t]):i&1?(s[s.length-1]+=e[t],i=0):(s.push(e[t]),i=0);if(i=n+e.length-1-r,e=s,e.length<=1)return e.length===0||n%2==0?[new Uint8Array,0,1]:[new Uint8Array([255,255,255,255]),1,1];let c=e.reduce((e,t)=>e+t,0),l=Math.round(c*a),u
|
|
2
|
+
import{EuclideanDistanceTransform as e}from"../../core/EuclideanDistanceTransform.js";import{packFloatRGBA as t}from"../../core/floatRGBA.js";import n from"../../core/Logger.js";import{nextPowerOfTwo as r}from"../../core/mathUtils.js";import{gradientTextureExternalPadding as i}from"../../views/2d/engine/webgl/definitions.js";import{dashSdfRasterizationScale as a,dashSdfDistanceNormalization as o,dashRadius as s}from"./constants.js";import{defaultCIMValues as c}from"./defaultCIMValues.js";const l=()=>n.getLogger(`esri.symbols.cim.rasterizingUtils`),u=e=>e===`vertical`||e===`horizontal`||e===`cross`||e===`esriSFSCross`||e===`esriSFSVertical`||e===`esriSFSHorizontal`;function d(t,n,r,i){let a=n*r,o=new Float64Array(a),s=!1;for(let e=0;e<a;e++){let n=t[4*e+3]/255;s||=n>0,o[e]=n===0?Number.MAX_VALUE:n===1?0:(1-n)*(1-n)}let c=new Uint8Array(a*4);if(!s)return c;new e(Math.max(n,r)).compute(o,n,r);for(let e=0;e<a;e++){let t=Math.min(Math.max(i+.5-o[e],0),1);c[4*e]=255*t,c[4*e+1]=255*t,c[4*e+2]=255*t,c[4*e+3]=255*t}return c}function f(n,r,i,a){let o=r*i,s=new Float64Array(o),c=new Float64Array(o),l=!1;for(let e=0;e<o;e++){let t=n[4*e+3]/255;if(l||=t>0,t===0)s[e]=Number.MAX_VALUE,c[e]=0;else if(t===1)s[e]=0,c[e]=Number.MAX_VALUE;else{let n=.5-t;s[e]=n>0?n*n:0,c[e]=n<0?n*n:0}}let u=new Uint8Array(o*4),d=Math.max(Math.ceil(a)+1,1);if(!l)return{image:u,encodingRadius:d};let f=new e(Math.max(r,i));f.compute(s,r,i),f.compute(c,r,i);for(let e=0;e<o;e++){let n=s[e]-c[e]-a,r=Math.min(Math.max(.5-n/(2*d),0),1);t(r,u,4*e)}return{image:u,encodingRadius:d}}function p(e,t,n,r=128){let i=new Map,a=(e,t,n,r)=>{let a=`${e},${t}`,o=i.get(a),s=[[e,t],[n,r]];o?o.push(s):i.set(a,[s])},o=(i,a)=>i>=0&&i<t&&a>=0&&a<n&&e[4*(a*t+i)+3]>=r;for(let e=0;e<n;e++)for(let n=0;n<t;n++)o(n,e)&&(o(n,e-1)||a(n,e,n+1,e),o(n+1,e)||a(n+1,e,n+1,e+1),o(n,e+1)||a(n+1,e+1,n,e+1),o(n-1,e)||a(n,e+1,n,e));let s=[];for(;i.size>0;){let e=i.entries().next();if(e.done)break;let[t,n]=e.value,r=n.pop();if(!r){i.delete(t);continue}n.length===0&&i.delete(t);let a=[r[0],r[1]],o=r[0],c=r[1];for(;c[0]!==o[0]||c[1]!==o[1];){let e=`${c[0]},${c[1]}`,t=i.get(e);if(!t)break;let n=t.pop();if(!n){i.delete(e);break}t.length===0&&i.delete(e),c=n[1],a.push(c)}a.length>=4&&c[0]===o[0]&&c[1]===o[1]&&s.push(a)}return s}function m(e,t){let n=new Uint8Array(e.length);for(let r=0;r<e.length;r+=4){let i=e[r+3]*t[r+3]/65025;n[r]=e[r]*i,n[r+1]=e[r+1]*i,n[r+2]=e[r+2]*i,n[r+3]=255*i}return n}function h(e,t,n){let i=t.style,a=r(Math.ceil(n)),o=u(i)?a*8:a*16,s=a*2;e.width=o,e.height=o;let c=e.getContext(`2d`);c.strokeStyle=`#ffffff`,c.lineWidth=a,c.beginPath(),(i===`vertical`||i===`cross`||i===`esriSFSCross`||i===`esriSFSVertical`)&&(c.moveTo(o/2,-s),c.lineTo(o/2,o+s)),(i===`horizontal`||i===`cross`||i===`esriSFSCross`||i===`esriSFSHorizontal`)&&(c.moveTo(-s,o/2),c.lineTo(o+s,o/2)),(i===`backward-diagonal`||i===`diagonal-cross`||i===`esriSFSDiagonalCross`||i===`esriSFSBackwardDiagonal`)&&(c.moveTo(-s,-s),c.lineTo(o+s,o+s),c.moveTo(o-s,-s),c.lineTo(o+s,s),c.moveTo(-s,o-s),c.lineTo(s,o+s)),(i===`forward-diagonal`||i===`diagonal-cross`||i===`esriSFSForwardDiagonal`||i===`esriSFSDiagonalCross`)&&(c.moveTo(o+s,-s),c.lineTo(-s,o+s),c.moveTo(s,-s),c.lineTo(-s,s),c.moveTo(o+s,o-s),c.lineTo(o-s,o+s)),c.stroke();let l=c.getImageData(0,0,e.width,e.height),d=new Uint8Array(l.data),f;for(let e=0;e<d.length;e+=4)f=d[e+3]/255,d[e]=d[e]*f,d[e+1]=d[e+1]*f,d[e+2]=d[e+2]*f;return[d,e.width,e.height,a]}function g(e){e.length%2==1&&(e=[...e,...e]);let n=0,r=e.length-1;for(;n<e.length&&e[n]===0;)n++;for(;r>=0&&e[r]===0;)r--;let i=0,s=[];for(let t=n;t<=r;t++)e[t]===0?i++:i===0?s.push(e[t]):i&1?(s[s.length-1]+=e[t],i=0):(s.push(e[t]),i=0);if(i=n+e.length-1-r,e=s,e.length<=1)return e.length===0||n%2==0?[new Uint8Array,0,1]:[new Uint8Array([255,255,255,255]),1,1];let c=e.reduce((e,t)=>e+t,0),l=Math.round(c*a),u=+l,d=new Float32Array(u),f=0,p=0,m=.5,h=n%2==0,g=i%2==1;for(let t=0;t<e.length;t++){let n=e[t];for(f=p,p+=n*a,t===0&&g&&(f-=e[e.length-1]*a),t===e.length-1&&g&&(p+=e[0]*a);m<=p&&m-.5<u;){let e=m-.5,t=Math.min(Math.abs(m-f),Math.abs(m-p));d[e]=h?-t:t,m++}h=!h}let _=d.length,v=new Uint8Array(_*4);for(let e=0;e<_;++e){let n=d[e]/a/o*.5+.5;t(n,v,4*e)}return[v,l,1]}function _(e,n){e??=[];let r=n===`Butt`,i=n===`Square`,a=!r&&!i;e.length%2==1&&(e=[...e,...e]);let o=s,c=o*2,l=0;for(let t of e)l+=t;let u=Math.round(l*o),d=u*c,f=new Float32Array(d),p=.5*o,m=0,h=0,g=.5,_=!0;for(let t of e){for(m=h,h+=t*o;g<=h;){let e=.5;for(;e<c;){let t=(e-.5)*u+g-.5,n=a?(e-o)*(e-o):Math.abs(e-o);f[t]=_?r?Math.max(Math.max(m+p-g,n),Math.max(g-h+p,n)):n:a?Math.min((g-m)*(g-m)+n,(g-h)*(g-h)+n):i?Math.min(Math.max(g-m,n),Math.max(h-g,n)):Math.min(Math.max(g-m+p,n),Math.max(h+p-g,n)),e++}g++}_=!_}let v=f.length,y=new Uint8Array(v*4);for(let e=0;e<v;++e){let n=(a?Math.sqrt(f[e]):f[e])/o;t(n,y,4*e)}return[y,u,c]}function v(e,t){let{colorRamp:n,gradientType:r}=t,i=n.type===`CIMFixedColorRamp`,a=t.interval||c.CIMGradientFill.interval,o=x(n);return i&&(o=S(o,a)),r===`Discrete`||i?w(e,o,a):C(e,o)}let y;function b(e,t){let{colorRamp:n,gradientType:r}=t,i=x(n),a=n.type===`CIMFixedColorRamp`;if(r===`Continuous`&&!a)return T(e,i);let o=t.interval??c.CIMGradientFill.interval;if(a)return T(e,S(i,o));let s=[];y??=document.createElement(`canvas`),E(y,i,o,1,0);let l=y.getContext(`2d`).getImageData(0,0,o,1).data;for(let e=0,t=0;e<o;e++,t=e*4){let n=[l[t+0],l[t+1],l[t+2],l[t+3]];s.push({offset:e/o,color:n}),s.push({offset:(e+1)/o,color:n})}return T(e,s)}function x(e){let t=[];switch(e.type){case`CIMPolarContinuousColorRamp`:case`CIMLinearContinuousColorRamp`:{e.type===`CIMPolarContinuousColorRamp`&&l().warnOnce(`CIMPolarContinuousColorRamp is currently unsupported. Falling back to CIMLinearContinuousColorRamp.`);let n=e;t.push({offset:0,color:[n.fromColor[0],n.fromColor[1],n.fromColor[2],n.fromColor[3]/255]}),t.push({offset:1,color:[n.toColor[0],n.toColor[1],n.toColor[2],n.toColor[3]/255]});break}case`CIMFixedColorRamp`:{let n=e,r=1/(n.colors.length-1),i=0;for(let e of n.colors)t.push({offset:i,color:[e[0],e[1],e[2],e[3]/255]}),i+=r;break}case`CIMMultipartColorRamp`:{let n=e,r=n.weights.reduce((e,t)=>e+t,0),i=0;for(let e=0;e<n.colorRamps.length;e++){let a=n.colorRamps[e],o=n.weights[e],s=x(a);for(let e of s)t.push({offset:(i+e.offset*o)/r,color:e.color});i+=o}break}default:l().error(`Color ramp "${e.type}" currently unsupported.`)}return t}function S(e,t){let n=[],r=(e.length-1)/(t-1);for(let i=0;i<t;i++){let a=e[Math.round(i*r)].color;n.push({offset:i/t,color:a}),n.push({offset:(i+1)/t,color:a})}return n}function C(e,t){return E(e,t,32,1,i),D(e)}function w(e,t,n){return E(e,t,n,1,i),D(e)}function T(e,t,n=0){for(let{offset:r,color:i}of t)e.addColorStop(Math.min(Math.max(r,n),1-n),`rgba(${i[0]}, ${i[1]}, ${i[2]}, ${i[3]})`)}function E(e,t,n,r,i){let a=n+2*i;e.width=a,e.height=r;let o=(i+1)/a,s=e.getContext(`2d`,{willReadFrequently:!0});if(t.length>0){let e=s.createLinearGradient(0,0,a,r);T(e,t,o),s.fillStyle=e}else s.fillStyle=`rgba(128, 128, 128, 1)`;s.fillRect(0,0,a,r)}function D(e){let{width:t,height:n}=e,r=e.getContext(`2d`).getImageData(0,0,t,n),i=new Uint8Array(r.data);for(let e=0;e<i.length;e+=4){let t=i[e+3]/255;i[e]*=t,i[e+1]*=t,i[e+2]*=t}return[i,t,n]}function O(e){let t=e[0]?.[0]?.[0]??0,n=e[0]?.[0]?.[1]??0,r={ymin:n,xmin:t,ymax:n,xmax:t,width:0,height:0};for(let t=0;t<e.length;t++){let n=e[t];for(let e=0;e<n.length;e++){let t=n[e][0],i=n[e][1];t<r.xmin&&(r.xmin=t),t>r.xmax&&(r.xmax=t),i<r.ymin&&(r.ymin=i),i>r.ymax&&(r.ymax=i)}}return r.width=Math.abs(r.xmax-r.xmin),r.height=Math.abs(r.ymax-r.ymin),r}function k(e,t){let n=O(e),r=n.width===0?1:n.width,i=n.height===0?1:n.height,a=[];for(let o=0;o<e.length;o++){let s=e[o],c=[];for(let e=0;e<s.length;e++){let a=Math.round(s[e][0]-n.xmin),o=Math.round(s[e][1]-n.ymin);if(a=t.xmin+a*t.width/r,o=t.ymin+o*t.height/i,isNaN(a)||isNaN(o))throw Error(`Scaled shape has NaN values`);c.push([a,o])}a.push(c)}return a}function A(e,t,n){let r=[];for(let i=0;i<e.length;i++){let a=e[i],o=[];for(let e=0;e<a.length;e++){let r=a[e][0]+t,i=a[e][1]+n;if(isNaN(r)||isNaN(i))throw Error(`Scaled shape has NaN values`);o.push([r,i])}r.push(o)}return r}export{b as addColorStops,m as applyAlphaMask,p as createAlphaMaskRings,d as createHaloImage,f as createHaloSDF,_ as rasterizeDash,g as rasterizeDash1D,h as rasterizeFillStyle,v as rasterizeGradient,k as scale,A as translate};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../core/Accessor.js";import{property as n,subclass as r}from"../../core/accessorSupport/decorators.js";import{set as i,subtract as a,copy as o}from"../../core/libs/gl-matrix-2/math/vec2.js";import{create as s}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import{watch as c,sync as l}from"../../core/reactiveUtils.js";import{addPadding as u}from"./viewpointUtils.js";import d from"./ViewState.js";var f,p;let m=f=class extends t{constructor(){super(...arguments),this.left=0,this.top=0,this.right=0,this.bottom=0}clone(){return new f({left:this.left,top:this.top,right:this.right,bottom:this.bottom})}};e([n()],m.prototype,`left`,void 0),e([n()],m.prototype,`top`,void 0),e([n()],m.prototype,`right`,void 0),e([n()],m.prototype,`bottom`,void 0),m=f=e([r(`esri.views.2d.PaddedViewState.Padding`)],m);let h=p=class extends d{constructor(e){super(e),this.paddedViewState=new d,this._updateContent=(()=>{let e=s();return()=>{let t=this._get(`size`),n=this._get(`padding`);if(!t||!n)return;let r=this.paddedViewState;i(e,n.left+n.right,n.top+n.bottom),a(e,t,e),o(r.size,e);let s=r.viewpoint;s&&(this.viewpoint=s)}})(),this.addHandles(c(()=>[this.size,this.padding],()=>this._updateContent(),l)),this.padding=new m,this.size=[0,0]}get padding(){return this._get(`padding`)}set padding(e){this._set(`padding`,e||new m)}set viewpoint(e){if(e){this.paddedViewState.viewpoint=e;let t=e,n=this._get(`padding`);n&&(t=u(e.clone(),e,this._get(`size`),n));let{targetGeometry:r,rotation:i,scale:a}=t,{x:o,y:s,spatialReference:c}=r,l=this._viewpoint2D;l.center[0]=o,l.center[1]=s,l.rotation=i,l.scale=a,l.spatialReference=c,this._update()}}clone(){return new p({padding:this.padding.clone(),size:this.size.slice(),viewpoint:this.paddedViewState.viewpoint.clone(),pixelRatio:this.pixelRatio})}};e([n()],h.prototype,`paddedViewState`,void 0),e([n({type:m})],h.prototype,`padding`,null),e([n()],h.prototype,`viewpoint`,null),h=p=e([r(`esri.views.2d.PaddedViewState`)],h);const g=h;export{g as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../core/Accessor.js";import{property as n,subclass as r}from"../../core/accessorSupport/decorators.js";import{set as i,subtract as a,copy as o}from"../../core/libs/gl-matrix-2/math/vec2.js";import{create as s}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import{watch as c,sync as l}from"../../core/reactiveUtils.js";import{addPadding as u}from"./viewpointUtils.js";import d from"./ViewState.js";var f,p;let m=f=class extends t{constructor(){super(...arguments),this.left=0,this.top=0,this.right=0,this.bottom=0}clone(){return new f({left:this.left,top:this.top,right:this.right,bottom:this.bottom})}};e([n()],m.prototype,`left`,void 0),e([n()],m.prototype,`top`,void 0),e([n()],m.prototype,`right`,void 0),e([n()],m.prototype,`bottom`,void 0),m=f=e([r(`esri.views.2d.PaddedViewState.Padding`)],m);let h=p=class extends d{constructor(e){super(e),this.paddedViewState=new d,this.isGlobal=!1,this._updateContent=(()=>{let e=s();return()=>{let t=this._get(`size`),n=this._get(`padding`);if(!t||!n)return;let r=this.paddedViewState;i(e,n.left+n.right,n.top+n.bottom),a(e,t,e),o(r.size,e);let s=r.viewpoint;s&&(this.viewpoint=s)}})(),this.addHandles(c(()=>[this.size,this.padding],()=>this._updateContent(),l)),this.padding=new m,this.size=[0,0]}get padding(){return this._get(`padding`)}set padding(e){this._set(`padding`,e||new m)}set viewpoint(e){if(e){this.paddedViewState.viewpoint=e;let t=e,n=this._get(`padding`);n&&(t=u(e.clone(),e,this._get(`size`),n));let{targetGeometry:r,rotation:i,scale:a}=t,{x:o,y:s,spatialReference:c}=r,l=this._viewpoint2D;l.center[0]=o,l.center[1]=s,l.rotation=i,l.scale=a,l.spatialReference=c,this._update()}}clone(){return new p({padding:this.padding.clone(),size:this.size.slice(),viewpoint:this.paddedViewState.viewpoint.clone(),pixelRatio:this.pixelRatio})}};e([n()],h.prototype,`paddedViewState`,void 0),e([n({type:m})],h.prototype,`padding`,null),e([n()],h.prototype,`viewpoint`,null),h=p=e([r(`esri.views.2d.PaddedViewState`)],h);const g=h;export{g as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../../../../core/ArrayPool.js";import{e as t}from"../../../../../chunks/earcut.js";import{triangulateF32 as n}from"../../../../../geometry/libtess.js";import{Point as r}from"../../../../../geometry/support/TileClipper.js";import i from"./BaseBucket.js";class a extends i{constructor(e,t,n,r,i,a,o){super(e,t,n),this.type=1,this._patternMap=new Map,this._fillVertexBuffer=r,this._fillIndexBuffer=i,this._outlineVertexBuffer=a,this._outlineIndexBuffer=o}get fillIndexStart(){return this._fillIndexStart}get fillIndexCount(){return this._fillIndexCount}get outlineIndexStart(){return this._outlineIndexStart}get outlineIndexCount(){return this._outlineIndexCount}getResources(e,t,n){let r=this.layer,i=this.zoom,a=r.getPaintProperty(`fill-pattern`);if(a){if(!a.isDataDriven)t(a.getValue(i),!0);else for(let e of this._features)t(a.getValue(i,e),!0)}}processFeatures(e){this._fillIndexStart=this._fillIndexBuffer.index*3,this._fillIndexCount=0,this._outlineIndexStart=this._outlineIndexBuffer.index*3,this._outlineIndexCount=0;let t=this.layer,n=this.zoom,{fillMaterial:r,outlineMaterial:i,hasDataDrivenFill:a,hasDataDrivenOutline:o}=t;e&&e.setExtent(this.layerExtent);let s=t.getPaintProperty(`fill-pattern`),c=s?.isDataDriven,l=!s&&t.getPaintValue(`fill-antialias`,n);if(t.outlineUsesFillColor){if(l&&!t.hasDataDrivenOpacity){let e=t.getPaintValue(`fill-opacity`,n),r=t.getPaintValue(`fill-opacity`,n+1);e<1&&r<1&&(l=!1)}if(l&&!t.hasDataDrivenColor){let e=t.getPaintValue(`fill-color`,n),r=t.getPaintValue(`fill-color`,n+1);e[3]<1&&r[3]<1&&(l=!1)}}let u=this._features,d=e?.validateTessellation;if(c){let a=[];for(let c of u){let u=s.getValue(n,c),d=this._spriteInfo[u];if(!d?.rect)continue;let f=r.encodeAttributes(c,n,t,d),p=l&&o?i.encodeAttributes(c,n,t):[],m=c.getGeometry(e);a.push({ddFillAttributes:f,ddOutlineAttributes:p,page:d.page,geometry:m}),a.sort((e,t)=>e.page-t.page)}for(let{ddFillAttributes:e,ddOutlineAttributes:n,page:r,geometry:i}of a)this._processFeature(i,l,t.outlineUsesFillColor,e,n,d,r)}else for(let s of u){let c=a?r.encodeAttributes(s,n,t):null,u=l&&o?i.encodeAttributes(s,n,t):null,f=s.getGeometry(e);this._processFeature(f,l,t.outlineUsesFillColor,c,u,d)}}serialize(){let e=10;e+=this.layerUIDs.length,e+=this._fillVertexBuffer.array.length,e+=this._fillIndexBuffer.array.length,e+=this._outlineVertexBuffer.array.length,e+=this._outlineIndexBuffer.array.length,e+=this._patternMap.size*3+1;let t=new Uint32Array(e),n=new Int32Array(t.buffer),r=0;t[r++]=this.type,t[r++]=this.layerUIDs.length;for(let e=0;e<this.layerUIDs.length;e++)t[r++]=this.layerUIDs[e];t[r++]=this._fillIndexStart,t[r++]=this._fillIndexCount,t[r++]=this._outlineIndexStart,t[r++]=this._outlineIndexCount;let i=this._patternMap,a=i.size;if(t[r++]=a,a>0)for(let[e,[n,a]]of i)t[r++]=e,t[r++]=n,t[r++]=a;t[r++]=this._fillVertexBuffer.array.length;for(let e=0;e<this._fillVertexBuffer.array.length;e++)n[r++]=this._fillVertexBuffer.array[e];t[r++]=this._fillIndexBuffer.array.length;for(let e=0;e<this._fillIndexBuffer.array.length;e++)t[r++]=this._fillIndexBuffer.array[e];t[r++]=this._outlineVertexBuffer.array.length;for(let e=0;e<this._outlineVertexBuffer.array.length;e++)n[r++]=this._outlineVertexBuffer.array[e];t[r++]=this._outlineIndexBuffer.array.length;for(let e=0;e<this._outlineIndexBuffer.array.length;e++)t[r++]=this._outlineIndexBuffer.array[e];return t.buffer}_processFeature(e,t,n,r,i,o,s){if(!e)return;let c=e.length,l=!i||i.length===0;if(t&&(!n||l))for(let t=0;t<c;t++)this._processOutline(e[t],i);let u;for(let t=0;t<c;t++){let n=a._area(e[t]);n>32?(u!==void 0&&this._processFill(e,u,r,o,s),u=[t]):n<-32&&u!==void 0&&u.push(t)}u!==void 0&&this._processFill(e,u,r,o,s)}_processOutline(e,t){let n=this._outlineVertexBuffer,i=this._outlineIndexBuffer,a=i.index,o,s,c,l=new r(0,0),u=new r(0,0),d=new r(0,0),f=-1,p=-1,m=-1,h=-1,g=-1,_=!1,v=e.length;if(v<2)return;let y=e[0],b=e[v-1];for(;v&&b.isEqual(y);)--v,b=e[v-1];if(!(v
|
|
2
|
+
import e from"../../../../../core/ArrayPool.js";import{e as t}from"../../../../../chunks/earcut.js";import{triangulateF32 as n}from"../../../../../geometry/libtess.js";import{Point as r}from"../../../../../geometry/support/TileClipper.js";import i from"./BaseBucket.js";class a extends i{constructor(e,t,n,r,i,a,o){super(e,t,n),this.type=1,this._patternMap=new Map,this._fillVertexBuffer=r,this._fillIndexBuffer=i,this._outlineVertexBuffer=a,this._outlineIndexBuffer=o}get fillIndexStart(){return this._fillIndexStart}get fillIndexCount(){return this._fillIndexCount}get outlineIndexStart(){return this._outlineIndexStart}get outlineIndexCount(){return this._outlineIndexCount}getResources(e,t,n){let r=this.layer,i=this.zoom,a=r.getPaintProperty(`fill-pattern`);if(a){if(!a.isDataDriven)t(a.getValue(i),!0);else for(let e of this._features)t(a.getValue(i,e),!0)}}processFeatures(e){this._fillIndexStart=this._fillIndexBuffer.index*3,this._fillIndexCount=0,this._outlineIndexStart=this._outlineIndexBuffer.index*3,this._outlineIndexCount=0;let t=this.layer,n=this.zoom,{fillMaterial:r,outlineMaterial:i,hasDataDrivenFill:a,hasDataDrivenOutline:o}=t;e&&e.setExtent(this.layerExtent);let s=t.getPaintProperty(`fill-pattern`),c=s?.isDataDriven,l=!s&&t.getPaintValue(`fill-antialias`,n);if(t.outlineUsesFillColor){if(l&&!t.hasDataDrivenOpacity){let e=t.getPaintValue(`fill-opacity`,n),r=t.getPaintValue(`fill-opacity`,n+1);e<1&&r<1&&(l=!1)}if(l&&!t.hasDataDrivenColor){let e=t.getPaintValue(`fill-color`,n),r=t.getPaintValue(`fill-color`,n+1);e[3]<1&&r[3]<1&&(l=!1)}}let u=this._features,d=e?.validateTessellation;if(c){let a=[];for(let c of u){let u=s.getValue(n,c),d=this._spriteInfo[u];if(!d?.rect)continue;let f=r.encodeAttributes(c,n,t,d),p=l&&o?i.encodeAttributes(c,n,t):[],m=c.getGeometry(e);a.push({ddFillAttributes:f,ddOutlineAttributes:p,page:d.page,geometry:m}),a.sort((e,t)=>e.page-t.page)}for(let{ddFillAttributes:e,ddOutlineAttributes:n,page:r,geometry:i}of a)this._processFeature(i,l,t.outlineUsesFillColor,e,n,d,r)}else for(let s of u){let c=a?r.encodeAttributes(s,n,t):null,u=l&&o?i.encodeAttributes(s,n,t):null,f=s.getGeometry(e);this._processFeature(f,l,t.outlineUsesFillColor,c,u,d)}}serialize(){let e=10;e+=this.layerUIDs.length,e+=this._fillVertexBuffer.array.length,e+=this._fillIndexBuffer.array.length,e+=this._outlineVertexBuffer.array.length,e+=this._outlineIndexBuffer.array.length,e+=this._patternMap.size*3+1;let t=new Uint32Array(e),n=new Int32Array(t.buffer),r=0;t[r++]=this.type,t[r++]=this.layerUIDs.length;for(let e=0;e<this.layerUIDs.length;e++)t[r++]=this.layerUIDs[e];t[r++]=this._fillIndexStart,t[r++]=this._fillIndexCount,t[r++]=this._outlineIndexStart,t[r++]=this._outlineIndexCount;let i=this._patternMap,a=i.size;if(t[r++]=a,a>0)for(let[e,[n,a]]of i)t[r++]=e,t[r++]=n,t[r++]=a;t[r++]=this._fillVertexBuffer.array.length;for(let e=0;e<this._fillVertexBuffer.array.length;e++)n[r++]=this._fillVertexBuffer.array[e];t[r++]=this._fillIndexBuffer.array.length;for(let e=0;e<this._fillIndexBuffer.array.length;e++)t[r++]=this._fillIndexBuffer.array[e];t[r++]=this._outlineVertexBuffer.array.length;for(let e=0;e<this._outlineVertexBuffer.array.length;e++)n[r++]=this._outlineVertexBuffer.array[e];t[r++]=this._outlineIndexBuffer.array.length;for(let e=0;e<this._outlineIndexBuffer.array.length;e++)t[r++]=this._outlineIndexBuffer.array[e];return t.buffer}_processFeature(e,t,n,r,i,o,s){if(!e)return;let c=e.length,l=!i||i.length===0;if(t&&(!n||l))for(let t=0;t<c;t++)this._processOutline(e[t],i);let u;for(let t=0;t<c;t++){let n=a._area(e[t]);n>32?(u!==void 0&&this._processFill(e,u,r,o,s),u=[t]):n<-32&&u!==void 0&&u.push(t)}u!==void 0&&this._processFill(e,u,r,o,s)}_processOutline(e,t){let n=this._outlineVertexBuffer,i=this._outlineIndexBuffer,a=i.index,o,s,c,l=new r(0,0),u=new r(0,0),d=new r(0,0),f=-1,p=-1,m=-1,h=-1,g=-1,_=!1,v=e.length;if(v<2)return;let y=e[0],b=e[v-1];for(;v&&b.isEqual(y);)--v,b=e[v-1];if(!(+v<2)){for(let r=0;r<v;++r){r===0?(o=e[v-1],s=e[0],c=e[1],l.assignSub(s,o),l.normalize(),l.rightPerpendicular()):(o=s,s=c,c=r===v-1?e[0]:e[r+1],l.assign(u));let a=this._isClipEdge(o,s);h===-1&&(_=a),u.assignSub(c,s),u.normalize(),u.rightPerpendicular();let y=l.x*u.y-l.y*u.x;d.assignAdd(l,u),d.normalize();let b=-d.x*-l.x+-d.y*-l.y,x=Math.abs(b===0?1:1/b);x>8&&(x=8),y>=0?(m=n.add(s.x,s.y,l.x,l.y,0,1,t),h===-1&&(h=m),f>=0&&p>=0&&m>=0&&!a&&i.add(f,p,m),p=n.add(s.x,s.y,x*-d.x,x*-d.y,0,-1,t),g===-1&&(g=p),f>=0&&p>=0&&m>=0&&!a&&i.add(f,p,m),f=p,p=m,m=n.add(s.x,s.y,d.x,d.y,0,1,t),f>=0&&p>=0&&m>=0&&!a&&i.add(f,p,m),p=n.add(s.x,s.y,u.x,u.y,0,1,t),f>=0&&p>=0&&m>=0&&!a&&i.add(f,p,m)):(m=n.add(s.x,s.y,x*d.x,x*d.y,0,1,t),h===-1&&(h=m),f>=0&&p>=0&&m>=0&&!a&&i.add(f,p,m),p=n.add(s.x,s.y,-l.x,-l.y,0,-1,t),g===-1&&(g=p),f>=0&&p>=0&&m>=0&&!a&&i.add(f,p,m),f=p,p=m,m=n.add(s.x,s.y,-d.x,-d.y,0,-1,t),f>=0&&p>=0&&m>=0&&!a&&i.add(f,p,m),f=n.add(s.x,s.y,-u.x,-u.y,0,-1,t),f>=0&&p>=0&&m>=0&&!a&&i.add(f,p,m))}f>=0&&p>=0&&h>=0&&!_&&i.add(f,p,h),f>=0&&h>=0&&g>=0&&!_&&i.add(f,g,h),this._outlineIndexCount+=3*(i.index-a)}}_processFill(r,i,a,o,s){o=!0;let c=i.length,l;c>1&&(l=[]);let u=0;for(let e of i)u!==0&&l.push(u),u+=r[e].length;let d=u*2,f=e.acquire();for(let e of i){let t=r[e],n=t.length;for(let e=0;e<n;++e)f.push(t[e].x,t[e].y)}let p=t(f,l,2);if(o&&t.deviation(f,l,2,p)>0){let e=i.map(e=>r[e].length),{buffer:t,vertexCount:o}=n(f,e);if(o>0){let e=this._fillVertexBuffer.index;for(let e=0;e<o;e++)this._fillVertexBuffer.add(t[2*e],t[2*e+1],a);for(let t=0;t<o;t+=3){let n=e+t;this._fillIndexBuffer.add(n,n+1,n+2)}if(s!==void 0){let e=this._patternMap,t=e.get(s);t?t[1]+=o:e.set(s,[this._fillIndexStart+this._fillIndexCount,o])}this._fillIndexCount+=o}}else{let e=p.length;if(e>0){let t=this._fillVertexBuffer.index,n=0;for(;n<d;)this._fillVertexBuffer.add(f[n++],f[n++],a);let r=0;for(;r<e;)this._fillIndexBuffer.add(t+p[r++],t+p[r++],t+p[r++]);if(s!==void 0){let t=this._patternMap,n=t.get(s);n?n[1]+=e:t.set(s,[this._fillIndexStart+this._fillIndexCount,e])}this._fillIndexCount+=e}}e.release(f)}_isClipEdge(e,t){return e.x===t.x?e.x<=-64||e.x>=4160:e.y===t.y?e.y<=-64||e.y>=4160:!1}static _area(e){let t=0,n=e.length-1;for(let r=0;r<n;r++)t+=(e[r].x-e[r+1].x)*(e[r].y+e[r+1].y);return t+=(e[n].x-e[0].x)*(e[n].y+e[0].y),t*.5}}export{a as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
const e=512,t=4096,n=8,r
|
|
2
|
+
const e=512,t=4096,n=8,r=.125;export{r as tileCoordinateScale,n as tilePixelRatio,e as tileSizeInPixels,t as tileSizeInTileUnits};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{getScaleForResolution as e}from"../../../../../geometry/support/scaleUtils.js";import{equals as t,getInfo as n}from"../../../../../geometry/support/spatialReferenceUtils.js";import{project as r}from"../../../../../geometry/support/webMercatorUtils.js";import i from"../../../../../layers/support/TileInfo.js";import a from"../../../tiling/TileInfoViewPOT.js";function o(t,r=22){let a=n(t),o=t.isWGS84
|
|
2
|
+
import{getScaleForResolution as e}from"../../../../../geometry/support/scaleUtils.js";import{equals as t,getInfo as n}from"../../../../../geometry/support/spatialReferenceUtils.js";import{project as r}from"../../../../../geometry/support/webMercatorUtils.js";import i from"../../../../../layers/support/TileInfo.js";import a from"../../../tiling/TileInfoViewPOT.js";function o(t,r=22){let a=n(t),o=t.isWGS84?.703125:78271.51696400007,s=t.isWGS84?e(o,t):295828763.7957775;return i.fromJSON({rows:512,cols:512,dpi:96,format:`pbf`,origin:{x:a.origin[0],y:a.origin[1]},spatialReference:t.toJSON(),lods:Array.from({length:r+1},(e,t)=>({level:t,resolution:o/2**t,scale:s/2**t}))})}function s(e,n){return t(e.tileInfo?.spatialReference,n)||l(e)&&(n.isWGS84||n.isWebMercator)}function c(e,n){let i=l(e)&&s(e,n)?o(n,e.tileInfo.lods.length-1):e.tileInfo,c=t(e.spatialReference,i.spatialReference)?e.fullExtent:r(e.fullExtent,i.spatialReference);return c&&i.spatialReference.isWebMercator&&e.spatialReference.isWGS84&&(c.ymin=Math.max(c.ymin,-i.origin.y),c.ymax=Math.min(c.ymax,i.origin.y)),new a(i,c)}function l(e){let t=Object.values(e.sourceNameToSource);return t.length>0&&t.every(e=>e.type===`geojson`)}export{o as createTileInfo,c as createTileInfoView,s as supportsSpatialReference};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{HighlightTechnique as e}from"../shaderGraph/techniques/utility/HighlightTechnique.js";import{Effect as t}from"./Effect.js";import n from"./highlight/HighlightSurfaces.js";class r extends t{constructor(){super(...arguments),this.defines=[`highlight`],this._hlTechnique=new e,this._width=void 0,this._height=void 0,this._hlSurfaces=new n,this._adjustedWidth=void 0,this._adjustedHeight=void 0,this._highlightWidth=void 0,this._highlightHeight=void 0}dispose(){this._hlSurfaces?.dispose(),this._hlTechnique.shutdown(),this._boundFBO=null}bind(e){let{context:t,painter:n}=e,{width:r,height:i}=t.getViewport(),a=n.getFbos().effect0;this.setup(e,r,i),t.bindFramebuffer(a),t.setColorMask(!0,!0,!0,!0),t.setClearColor(0,0,0,0),t.clear(16384)}unbind(){}setup({context:e},t,n){this._width=t,this._height=n;let r=t%4,i=n%4;t+=r<2?-r:4-r,n+=i<2?-i:4-i,this._adjustedWidth=t,this._adjustedHeight=n,this._boundFBO=e.boundFramebuffer;let a=Math.round(t
|
|
2
|
+
import{HighlightTechnique as e}from"../shaderGraph/techniques/utility/HighlightTechnique.js";import{Effect as t}from"./Effect.js";import n from"./highlight/HighlightSurfaces.js";class r extends t{constructor(){super(...arguments),this.defines=[`highlight`],this._hlTechnique=new e,this._width=void 0,this._height=void 0,this._hlSurfaces=new n,this._adjustedWidth=void 0,this._adjustedHeight=void 0,this._highlightWidth=void 0,this._highlightHeight=void 0}dispose(){this._hlSurfaces?.dispose(),this._hlTechnique.shutdown(),this._boundFBO=null}bind(e){let{context:t,painter:n}=e,{width:r,height:i}=t.getViewport(),a=n.getFbos().effect0;this.setup(e,r,i),t.bindFramebuffer(a),t.setColorMask(!0,!0,!0,!0),t.setClearColor(0,0,0,0),t.clear(16384)}unbind(){}setup({context:e},t,n){this._width=t,this._height=n;let r=t%4,i=n%4;t+=r<2?-r:4-r,n+=i<2?-i:4-i,this._adjustedWidth=t,this._adjustedHeight=n,this._boundFBO=e.boundFramebuffer;let a=Math.round(+t),o=Math.round(+n);this._highlightWidth=a,this._highlightHeight=o,this._hlSurfaces.setup(e,a,o)}draw(e){let{context:t,passOptions:n}=e,r=n.activeGradient,i=t.boundFramebuffer,a=[0,0,+this._adjustedWidth,+this._adjustedHeight];if(i?.colorTexture==null)throw Error(`InternalError: Highlight source framebuffer is missing a color texture`);t.bindFramebuffer(this._hlSurfaces.sharedBlur1Fbo),t.setViewport(...a),t.setColorMask(!0,!0,!0,!0),t.setClearColor(0,0,0,0),t.clear(16384),this._hlTechnique.render(e,{sourceTexture:i.colorTexture,maskFbo:this._hlSurfaces.sharedBlur1Fbo,maskTexture:this._hlSurfaces.sharedBlur1Tex,partialMapFbo:this._hlSurfaces.sharedBlur2Fbo,partialMapTexture:this._hlSurfaces.sharedBlur2Tex,highlightWidth:this._highlightWidth,highlightHeight:this._highlightHeight,highlightViewport:a,outputTarget:this._boundFBO,outputViewport:[0,0,this._width,this._height],gradient:r}),this._boundFBO=null}}export{r as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
function e(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e}function t(e,t){return Math.sqrt(e*e+t*t)}function n(e){let n=t(e[0],e[1]);e[0]/=n,e[1]/=n}function r(e,n){let r=e[0],i=n[0],a=e[1],o=n[1];return t(r-i,a-o)}function i(e,t,n){let r=t,i=n,a=1/0;for(let o of e)for(let e=0;e<o.length;e++){let s=o[e],c=o[e+1];if(!c){let e=t-s[0],o=n-s[1],c=e*e+o*o;c<a&&(r=s[0],i=s[1],a=c);continue}let l=c[0]-s[0],u=c[1]-s[1],d=l*l+u*u,f=d===0?0:Math.max(0,Math.min(1,((t-s[0])*l+(n-s[1])*u)/d)),p=s[0]+f*l,m=s[1]+f*u,h=t-p,g=n-m,_=h*h+g*g;_<a&&(r=p,i=m,a=_)}return[r,i]}function a(e,t){return e[t+1]}function o(e){return e.length-1}function s(e){let t=0;for(let n=0;n<o(e);n++)t+=c(e,n);return t}function c(e,t,n=1){let[r,i]=a(e,t);return[r,i]=[Math.round(r),Math.round(i)],Math.sqrt(r*r+i*i)*n}class l{constructor(e,t,n,r,i){this._segments=e,this._index=t,this._distance=n,this._xStart=r,this._yStart=i,this._done=!1}static create(e){return new l(e,0,0,e[0][0],e[0][1])}clone(){return new l(this._segments,this._index,this._distance,this.xStart,this.yStart)}equals(e){return this._index===e._index||e._index===this._index-1&&(this._distance===0||e._distance===1)||e._index===this._index+1&&(this._distance===1||e._distance===0)}leq(e){return this._index<e._index||this._index===e._index&&this._distance<=e._distance}geq(e){return this._index>e._index||this._index===e._index&&this._distance>=e._distance}get _segment(){return this._segments[this._index+1]}get angle(){let e=this.dy,t=-this.dx,n=(0*e+-1*t)/
|
|
2
|
+
function e(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e}function t(e,t){return Math.sqrt(e*e+t*t)}function n(e){let n=t(e[0],e[1]);e[0]/=n,e[1]/=n}function r(e,n){let r=e[0],i=n[0],a=e[1],o=n[1];return t(r-i,a-o)}function i(e,t,n){let r=t,i=n,a=1/0;for(let o of e)for(let e=0;e<o.length;e++){let s=o[e],c=o[e+1];if(!c){let e=t-s[0],o=n-s[1],c=e*e+o*o;c<a&&(r=s[0],i=s[1],a=c);continue}let l=c[0]-s[0],u=c[1]-s[1],d=l*l+u*u,f=d===0?0:Math.max(0,Math.min(1,((t-s[0])*l+(n-s[1])*u)/d)),p=s[0]+f*l,m=s[1]+f*u,h=t-p,g=n-m,_=h*h+g*g;_<a&&(r=p,i=m,a=_)}return[r,i]}function a(e,t){return e[t+1]}function o(e){return e.length-1}function s(e){let t=0;for(let n=0;n<o(e);n++)t+=c(e,n);return t}function c(e,t,n=1){let[r,i]=a(e,t);return[r,i]=[Math.round(r),Math.round(i)],Math.sqrt(r*r+i*i)*n}class l{constructor(e,t,n,r,i){this._segments=e,this._index=t,this._distance=n,this._xStart=r,this._yStart=i,this._done=!1}static create(e){return new l(e,0,0,e[0][0],e[0][1])}clone(){return new l(this._segments,this._index,this._distance,this.xStart,this.yStart)}equals(e){return this._index===e._index||e._index===this._index-1&&(this._distance===0||e._distance===1)||e._index===this._index+1&&(this._distance===1||e._distance===0)}leq(e){return this._index<e._index||this._index===e._index&&this._distance<=e._distance}geq(e){return this._index>e._index||this._index===e._index&&this._distance>=e._distance}get _segment(){return this._segments[this._index+1]}get angle(){let e=this.dy,t=-this.dx,n=(0*e+-1*t)/this.length,r=Math.acos(n);return e>0&&(r=2*Math.PI-r),r}get xStart(){return this._xStart}get yStart(){return this._yStart}get x(){return this.xStart+this.distance*this.dx}get y(){return this.yStart+this.distance*this.dy}get dx(){return this._segment[0]}get dy(){return this._segment[1]}get xMidpoint(){return this.xStart+.5*this.dx}get yMidpoint(){return this.yStart+.5*this.dy}get xEnd(){return this.xStart+this.dx}get yEnd(){return this.yStart+this.dy}get length(){let{dx:e,dy:t}=this;return Math.sqrt(e*e+t*t)}get remainingLength(){return this.length*(1-this._distance)}get backwardLength(){return this.length*this._distance}get distance(){return this._distance}get done(){return this._done}hasPrev(){return this._index-1>=0}hasNext(){return this._index+1<o(this._segments)}next(){return this.hasNext()?(this._xStart+=this.dx,this._yStart+=this.dy,this._distance=0,this._index+=1,this):null}prev(){return this.hasPrev()?(--this._index,this._xStart-=this.dx,this._yStart-=this.dy,this._distance=1,this):(this._done=!0,null)}_seekBackwards(e,t){let n=this.backwardLength;if(e<=n)return this._distance=(n-e)/this.length,this;let r=this.backwardLength;for(;this.prev();){if(r+this.length>e)return this._seekBackwards(e-r);r+=this.length}return this._distance=0,t?this:null}seek(e,t=!1){if(e<0)return this._seekBackwards(Math.abs(e),t);if(e<=this.remainingLength)return this._distance=(this.backwardLength+e)/this.length,this;let n=this.remainingLength;for(;this.next();){if(n+this.length>e)return this.seek(e-n,t);n+=this.length}return this._distance=1,t?this:null}}function u(e,t,n,r=!0){let i=s(e);if(i===0)return;let a=l.create(e),o=i/2;if(!r){a.seek(o),n(a.clone(),0,o+0*t,i);return}let c=Math.max((i-t)/2,0),u=Math.floor(c/t),d=o-u*t;a.seek(d);for(let e=-u;e<=u;e++)n(a.clone(),e,o+e*t,i),a.seek(t)}function d(e,t){let n=t;for(let t=0;t<e.length;t++){let r=e[t];f(r,n);let i=[];i.push(r[0]);for(let e=1;e<r.length;e++){let[t,n]=r[e-1],[a,o]=r[e],s=a-t,c=o-n;i.push([s,c])}e[t]=i,r=i}return e}function f(t,i){let a=1e-6;if(i<=0)return;let o=t.length;if(o<3)return;let s=[],c=0;s.push(0);for(let e=1;e<o;e++)c+=r(t[e],t[e-1]),s.push(c);i=Math.min(i,.2*c);let l=[];l.push(t[0][0]),l.push(t[0][1]);let u=t[o-1][0],d=t[o-1][1],f=e([0,0],t[0],t[1]);n(f),t[0][0]+=i*f[0],t[0][1]+=i*f[1],e(f,t[o-1],t[o-2]),n(f),t[o-1][0]+=i*f[0],t[o-1][1]+=i*f[1];for(let e=1;e<o;e++)s[e]+=i;s[o-1]+=i;let p=.5*i;for(let e=1;e<o-1;e++){let n=0,r=0,c=0;for(let o=e-1;o>=0&&!(s[o+1]<s[e]-p);o--){let l=p+s[o+1]-s[e],u=s[o+1]-s[o],d=s[e]-s[o]<p?1:l/u;if(Math.abs(d)<a)break;let f=d*d,m=d*l-.5*f*u,h=d*u/i,g=t[o+1],_=t[o][0]-g[0],v=t[o][1]-g[1];n+=h/m*(g[0]*d*l+.5*f*(l*_-u*g[0])-f*d*u*_/3),r+=h/m*(g[1]*d*l+.5*f*(l*v-u*g[1])-f*d*u*v/3),c+=h}for(let l=e+1;l<o&&!(s[l-1]>s[e]+p);l++){let o=p-s[l-1]+s[e],u=s[l]-s[l-1],d=s[l]-s[e]<p?1:o/u;if(Math.abs(d)<a)break;let f=d*d,m=d*o-.5*f*u,h=d*u/i,g=t[l-1],_=t[l][0]-g[0],v=t[l][1]-g[1];n+=h/m*(g[0]*d*o+.5*f*(o*_-u*g[0])-f*d*u*_/3),r+=h/m*(g[1]*d*o+.5*f*(o*v-u*g[1])-f*d*u*v/3),c+=h}l.push(n/c),l.push(r/c)}l.push(u),l.push(d);for(let e=0,n=0;e<o;e++)t[e][0]=l[n++],t[e][1]=l[n++]}export{l as SegmentCursor,i as closestPointOnPaths,u as pathDivide,s as pathLength,a as segmentAt,o as segmentCount,c as segmentLength,d as smoothPaths};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{fromRotation as e,multiply as t,translate as n,rotate as r}from"../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as i}from"../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as a,set as o}from"../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as s}from"../../../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{pt2px as c}from"../../../../../../core/screenUtils.js";import{getXAnchorDirection as l,getYAnchorDirection as u}from"../../alignmentUtils.js";import d from"../../collisions/BoundingBox.js";import{magicLabelLineHeight as f}from"../../definitions.js";import p from"../../Rect.js";const m=Math.PI/180;class h{static fromGlyph(e,t,n,r,i){let{mosaicItem:a,rect:o,shaping:s,code:c}=n,l=a.rect;return new h({width:c===0?o.width:l.width*r,height:c===0?o.height:l.height*r,x:r*(e+s.xOffset+o.left),y:r*(t+s.yOffset-o.top),textureKey:a.textureKey,texcoords:{topLeft:[l.x,l.y],topRight:[l.x+l.width,l.y],bottomLeft:[l.x,l.y+l.height],bottomRight:[l.x+l.width,l.y+l.height]},fontSize:i?.fontSize,color:i?.color})}constructor(e){this._rotationT=i(),this._transform=i(),this._angle=0,this._bounds=null,this.width=e.width,this.height=e.height,this.x=e.x,this.y=e.y,this.textureKey=e.textureKey,this.texcoords=e.texcoords,this.fontSize=e.fontSize,this.color=e.color}set angle(t){this._angle=t,e(this._rotationT,-t),this._offsets=this._bounds=null}get angle(){return this._angle}get offsets(){if(!this._offsets){let{x:n,y:r,width:o,height:s}=this,c=e(i(),-this.angle),l=t(i(),c,this._transform);this._offsets={topLeft:a([0,0],[n,r],l),topRight:a([0,0],[n+o,r],l),bottomLeft:a([0,0],[n,r+s],l),bottomRight:a([0,0],[n+o,r+s],l)}}return this._offsets}get bounds(){if(this.width<=0)return null;if(!this._bounds){let e=this.offsets,t=1/0,n=1/0,r=-1/0,i=-1/0;for(let[a,o]of[e.topLeft,e.topRight,e.bottomLeft,e.bottomRight])t=Math.min(t,a),n=Math.min(n,o),r=Math.max(r,a),i=Math.max(i,o);let a=r-t,o=i-n,s=t+a/2,c=n+o/2;this._bounds=new d(s,c,a,o)}return this._bounds}setTransform(e){this._transform=e,this._offsets=null}}const g=(e,t)=>({code:0,mosaicItem:{rect:new p(0,0,11,8),sdf:!0,page:0,textureKey:t},rect:{height:4,width:e,left:0,top:0},shaping:{xOffset:0,yOffset:0,xAdvance:0,yAdvance:0}});function _(e){return e===`underline`?c(2):0}function v(e,t,n,r,i){switch(e){case`underline`:return(n??i?.baseline??22)+4+_(e)/t;case`line-through`:return r??i?.midline??16;default:return 0}}function y(e,t){return e.forEach(e=>a(e,e,t)),{topLeft:e[0],topRight:e[1],bottomLeft:e[2],bottomRight:e[3]}}class b{constructor(e,t,n,r){this._rotation=0,this._decorate(e,t,n,r),this.glyphs=e,this.bounds=this._createBounds(e),this.isMultiline=t.length>1,this._hasRotation=n.angle!==0,this._transform=this._createGlyphTransform(this.bounds,n),this._borderLineSizePx=n.borderLineSizePx,(n.borderLineSizePx||n.hasBackground)&&([this.bounds,this.textBox]=this.shapeBackground(this._transform));for(let t of e)t.setTransform(this._transform)}setRotation(n){if(n===0&&this._rotation===0)return;this._rotation=n;let r=this._transform,a=e(i(),n);t(r,a,r);for(let e of this.glyphs)e.setTransform(this._transform)}_decorate(e,t,n,r){if(!n.decoration||n.decoration===`none`||!e.length)return;let i=n.scale,a=e[0].textureKey;for(let o of t){let t=o.scale??i,s=v(n.decoration,t,o.baseline,o.midline,r),c=o.startX*t,l=o.startY*t,u=(o.width+o.glyphWidthEnd)*t;e.push(h.fromGlyph(c,l+s*t,g(u,a),1))}}shapeBackground(e){let t=(1.5+(this._borderLineSizePx||0))/2,n=this._borderLineSizePx?t:0,{xmin:r,ymin:i,xmax:a,ymax:o,x:s,y:c,width:l,height:u}=this.bounds,f=[r-8,i-8],p=[a+8,i-8],m=[r-8,o+8],h=[a+8,o+8],g=y([[f[0]-t,f[1]-t],[p[0]+t,p[1]-t],[f[0]+n,f[1]+n],[p[0]-n,p[1]+n]],e),_=y([[m[0]+n,m[1]-n],[h[0]-n,h[1]-n],[m[0]-t,m[1]+t],[h[0]+t,h[1]+t]],e),v=y([[f[0]-t,f[1]-t],[f[0]+n,f[1]+n],[m[0]-t,m[1]+t],[m[0]+n,m[1]-n]],e),b=y([[p[0]-n,p[1]+n],[p[0]+t,p[1]-t],[h[0]-n,h[1]-n],[h[0]+t,h[1]+t]],e),x={main:y([f,p,m,h],e),top:g,bot:_,left:v,right:b};return[new d(s,c,l+t*2,u+t*2),x]}get boundsT(){let e=this.bounds,t=o(s(),e.x,e.y);if(a(t,t,this._transform),this._hasRotation){let n=Math.max(e.width,e.height);return new d(t[0],t[1],n,n)}return new d(t[0],t[1],e.width,e.height)}_createBounds(e){let t=1/0,n=1/0,r=0,i=0;for(let a of e)t=Math.min(t,a.offsets.topLeft[0]),n=Math.min(n,a.offsets.topLeft[1]),r=Math.max(r,a.offsets.bottomRight[0]),i=Math.max(i,a.offsets.bottomRight[1]);let a=r-t,o=i-n,s=t+a/2,c=n+o/2;return new d(s,c,a,o)}_createGlyphTransform(e,t){let a=m*t.angle,c=i(),l=s();return n(c,c,o(l,t.xOffset,-t.yOffset)),t.useCIMAngleBehavior?r(c,c,a):(n(c,c,o(l,e.x,e.y)),r(c,c,a),n(c,c,o(l,-e.x,-e.y))),c}}class x{constructor(e,t,n,r,i,a){this.glyphWidthEnd=0,this.startX=0,this.startY=0,this.endsParagraph=!1,this.start=Math.max(0,Math.min(t,n)),this.end=Math.max(0,Math.max(t,n)),this.end<e.length&&(this.glyphWidthEnd=e[this.end].rect.width),this.width=r,this.yMin=i,this.yMax=a}}const S=e=>e===10,C=e=>e===32;function w(e,t,n){let r=[],i=1/n.scale,a=n.maxLineWidth*i,o=e.length,s=0,c=0,l=0,u=s,d=u,f=0,p=1/0,m=0;for(;s!==o;){let{code:t,rect:n,shaping:i}=e[s],o=Math.abs(n.top);if(!S(t)&&!C(t)&&(p=Math.min(p,o),m=Math.max(m,o+n.height)),S(t)){if(s!==0){let t=new x(e,u,s-1,c,p===1/0?0:p,m);t.endsParagraph=!0,r.push(t),p=1/0,m=0}c=0,u=s+1,d=s+1,l=0}else if(C(t))d=s+1,l=0,f=i.xAdvance,c+=i.xAdvance;else if(c>a){if(d!==u){let t=d-2;c-=f,r.push(new x(e,u,t,c-l,p,m)),p=1/0,m=0,u=d,c=l}else r.push(new x(e,u,s-1,c,p,m)),p=1/0,m=0,u=s,d=s,c=0;c+=i.xAdvance,l+=i.xAdvance}else c+=i.xAdvance,l+=i.xAdvance;s+=1}let h=new x(e,u,s-1,c,p,m);return h.start>=0&&h.end<e.length&&r.push(h),r}function T(e,t){let n=0;for(let t=0;t<e.length;t++){let{width:r}=e[t];n=Math.max(r,n)}let r=t.decoration===`underline`?4:0,i=e[0].yMin;return{x:0,y:i,height:e[e.length-1].yMax+t.lineHeight*(e.length-1)+r-i,width:n}}function E(e,t,n){let r=0;for(let i=t;i<n;i++)C(e[i].code)&&!S(e[i+1].code)&&r++;return r}function D(e,t){let n=t.scale,r=[],i=e.sdfPadding,{faceInfo:a,glyphs:o,isRightToLeft:s}=e,c=t.horizontalAlignment===`justify`||t.horizontalAlignment===`Justify`,d=w(o,!1,t),f=d.length?T(d,t):{y:0,height:0,width:0},p=c?s?1:-1:l(t.horizontalAlignment),m=u(t.verticalAlignment),g=+(m===2),_=g?0:m-1,v=a?.baseline??22,y=d.length>1,x=g?y?-f.y-f.height:-v:-f.y+_*(f.height/2),D=0,O=0;for(let e=0;e<d.length;e++){if(s&&e===O)for(D=e,O=e+1;O<d.length&&!d[O-1].endsParagraph;)O++;let{start:a,end:l,width:u}=d[e],m=c&&e<d.length-1?E(o,a,l):0,g=m>0?(f.width-u)/m:0,_=g>0?f.width:u,v=(p+1)*-1*(_/2)-i,y=(s?D+O-1-e:e)*t.lineHeight+x-i;d[e].startX=v,d[e].startY=y;for(let e=a;e<=l;e++){let t=o[e];if(S(t.code))continue;let i=h.fromGlyph(v,y,t,n);v+=t.shaping.xAdvance,g>0&&C(t.code)&&(v+=g),r.push(i)}}return new b(r,d,t,a)}function O(e,t){let n=t.scale,{faceInfo:r,glyphs:i}=e,a=i.reduce((e,t)=>Math.max(e,t.rect.height),0),o=i.filter(e=>!S(e.code)&&e.mosaicItem.textureKey).map(e=>h.fromGlyph(-e.rect.width/2,-a,e,n));return new b(o,[],t,r)}function k(e,t){return e.type===`glyphs`?D(e,t):j(e,t)}function A(e,t){return e.type===`glyphs`?O(e,t):M(e,t)}function j(e,t){let n=N(e,t),r=P(n,t),i=r.length?I(r):{width:0},a=[],o=t.decoration===`underline`?`none`:t.decoration,s=t.horizontalAlignment===`justify`||t.horizontalAlignment===`Justify`,c=s?-1:l(t.horizontalAlignment),d=u(t.verticalAlignment),f=d===2,p=r.length?r[0].yMin:0,m=r.length?L(r[r.length-1]):0,g=m-p,_=f?r.length>1?-m:-(r[0]?.baseline??0):d===1?-p:d===-1?-m:-(p+g/2);for(let e=0;e<r.length;e++){let t=r[e],o=s&&e<r.length-1?R(n,t.start,t.end):0,l=o>0?(i.width-t.width)/o:0,u=l>0?i.width:t.width,d=(c+1)*-1*(u/2),f=t.startY+_,p=null;t.startX=d,t.startY=f;for(let e=t.start;e<=t.end;e++){let r=n[e],{glyph:i,scale:o,fontSize:s}=r,c=d;if(S(i.code)){p=z(a,p,f,t.baseline);continue}r.decoration===`underline`?(p&&p.underlineOffset!==r.underlineOffset||p&&!B(p.color,r.color))&&(p=z(a,p,f,t.baseline)):p=z(a,p,f,t.baseline);let u=f+t.baseline-r.baseline;a.push(h.fromGlyph(d/o,u/o,i,o,{fontSize:s,color:r.color})),d+=r.xAdvance,r.decoration===`underline`&&(p??={startX:c,endX:d,glyphWidthEnd:i.rect.width*o,textureKey:i.mosaicItem.textureKey,underlineOffset:r.underlineOffset,color:r.color},p.endX=d,p.glyphWidthEnd=i.rect.width*o,p.textureKey=p.textureKey??i.mosaicItem.textureKey),l>0&&C(i.code)&&(d+=l,p&&(p.endX=d))}z(a,p,f,t.baseline)}return new b(a,r,{...t,decoration:o})}function M(e,t){let n=N(e,t),r=n.reduce((e,t)=>Math.max(e,t.glyph.rect.height*t.scale),0),i=n.filter(e=>!S(e.glyph.code)&&e.glyph.mosaicItem.textureKey).map(e=>h.fromGlyph(-e.glyph.rect.width/2,-r/e.scale,e.glyph,e.scale,{fontSize:e.fontSize,color:e.color}));return new b(i,[],t)}function N(e,t){let n=t.lineHeightRatio??1,r=[];for(let t of e.runs){let e=c(t.fontSize),i=e/t.glyphs.sdfSize,a=f/24*e*n,o=(t.glyphs.faceInfo?.baseline??22)*i,s=(t.glyphs.faceInfo?.midline??16)*i,l=4*i+_(t.decoration),u=1+(t.characterSpacing??0);for(let n of t.glyphs.glyphs){let c=n.shaping.xAdvance*i,d=Math.abs(n.rect.top)*i,f=d+n.rect.height*i;r.push({glyph:n,scale:i,fontSize:e,decoration:t.decoration,underlineOffset:l,color:t.color,xAdvance:!S(n.code)&&!C(n.code)?c*u:c,top:d,bottom:f,lineHeight:a,baseline:o,midline:s})}}return r}function P(e,t){let n=[],r=t.maxLineWidth,i=0,a=0,o=0,s=0,c=0,l=0;for(;i<e.length;){let t=e[i],{glyph:u}=t;if(S(u.code))i!==0&&n.push({width:a,start:s,end:i-1,glyphWidthEnd:e[i-1]?.glyph.rect.width*e[i-1]?.scale||0,yMin:0,yMax:0,lineHeight:0,baseline:0,midline:0,startX:0,startY:0,scale:1}),a=0,s=i+1,c=s,o=0,l=0;else if(C(u.code))c=i+1,o=0,l=t.xAdvance,a+=t.xAdvance;else if(a>r){if(c!==s){let t=c-2;a-=l,n.push({width:a-o,start:s,end:t,glyphWidthEnd:e[t]?.glyph.rect.width*e[t]?.scale||0,yMin:0,yMax:0,lineHeight:0,baseline:0,midline:0,startX:0,startY:0,scale:1}),s=c,a=o}else n.push({width:a,start:s,end:i-1,glyphWidthEnd:e[i-1]?.glyph.rect.width*e[i-1]?.scale||0,yMin:0,yMax:0,lineHeight:0,baseline:0,midline:0,startX:0,startY:0,scale:1}),s=i,c=i,a=0;a+=t.xAdvance,o+=t.xAdvance}else a+=t.xAdvance,o+=t.xAdvance;i++}if(s<e.length){let t=e.length-1;n.push({width:a,start:s,end:t,glyphWidthEnd:e[t]?.glyph.rect.width*e[t]?.scale||0,yMin:0,yMax:0,lineHeight:0,baseline:0,midline:0,startX:0,startY:0,scale:1})}return F(e,n)}function F(e,t){for(let n=0;n<t.length;n++){let r=t[n],i=0,a=1/0,o=0,s=0;for(let t=r.start;t<=r.end;t++){let n=e[t];n.decoration===`underline`&&(s=Math.max(s,n.underlineOffset)),S(n.glyph.code)||C(n.glyph.code)||(i=Math.max(i,n.baseline),o=Math.max(o,n.lineHeight))}let c=1/0,l=-1/0;for(let t=r.start;t<=r.end;t++){let n=e[t];S(n.glyph.code)||C(n.glyph.code)||(c=Math.min(c,i-n.baseline+n.top),l=Math.max(l,i-n.baseline+n.bottom),a=Math.min(a,i-n.baseline+n.midline))}s>0&&(l=Math.max(l,i+s)),r.baseline=i,r.midline=a===1/0?i:a,r.lineHeight=Math.max(o,l),r.yMin=c===1/0?0:c,r.yMax=l===-1/0?0:l,r.startY=n>0?t[n-1].startY+t[n-1].lineHeight:0}return t}function I(e){let t=0;for(let n of e)t=Math.max(n.width+n.glyphWidthEnd,t);let n=e[0].yMin;return{x:0,y:n,height:L(e[e.length-1])-n,width:t}}function L(e){return e.startY+e.lineHeight}function R(e,t,n){let r=0;for(let i=t;i<n;i++)C(e[i].glyph.code)&&!S(e[i+1].glyph.code)&&r++;return r}function z(e,t,n,r){return t&&e.push(h.fromGlyph(t.startX,n+r+t.underlineOffset,g(t.endX-t.startX+t.glyphWidthEnd,t.textureKey),1,{color:t.color})),null}function B(e,t){return e===t||!!e&&!!t&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}export{h as ShapedGlyph,b as ShapingInfo,D as shapeGlyphs,O as shapeGlyphsForMultipoint,j as shapeRichText,M as shapeRichTextForMultipoint,k as shapeTextResource,A as shapeTextResourceForMultipoint};
|
|
2
|
+
import{fromRotation as e,multiply as t,translate as n,rotate as r}from"../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as i}from"../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as a,set as o}from"../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as s}from"../../../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{pt2px as c}from"../../../../../../core/screenUtils.js";import{getXAnchorDirection as l,getYAnchorDirection as u}from"../../alignmentUtils.js";import d from"../../collisions/BoundingBox.js";import{magicLabelLineHeight as f}from"../../definitions.js";import p from"../../Rect.js";const m=Math.PI/180;class h{static fromGlyph(e,t,n,r,i){let{mosaicItem:a,rect:o,shaping:s,code:c}=n,l=a.rect;return new h({width:c===0?o.width:l.width*r,height:c===0?o.height:l.height*r,x:r*(e+s.xOffset+o.left),y:r*(t+s.yOffset-o.top),textureKey:a.textureKey,texcoords:{topLeft:[l.x,l.y],topRight:[l.x+l.width,l.y],bottomLeft:[l.x,l.y+l.height],bottomRight:[l.x+l.width,l.y+l.height]},fontSize:i?.fontSize,color:i?.color})}constructor(e){this._rotationT=i(),this._transform=i(),this._angle=0,this._bounds=null,this.width=e.width,this.height=e.height,this.x=e.x,this.y=e.y,this.textureKey=e.textureKey,this.texcoords=e.texcoords,this.fontSize=e.fontSize,this.color=e.color}set angle(t){this._angle=t,e(this._rotationT,-t),this._offsets=this._bounds=null}get angle(){return this._angle}get offsets(){if(!this._offsets){let{x:n,y:r,width:o,height:s}=this,c=e(i(),-this.angle),l=t(i(),c,this._transform);this._offsets={topLeft:a([0,0],[n,r],l),topRight:a([0,0],[n+o,r],l),bottomLeft:a([0,0],[n,r+s],l),bottomRight:a([0,0],[n+o,r+s],l)}}return this._offsets}get bounds(){if(this.width<=0)return null;if(!this._bounds){let e=this.offsets,t=1/0,n=1/0,r=-1/0,i=-1/0;for(let[a,o]of[e.topLeft,e.topRight,e.bottomLeft,e.bottomRight])t=Math.min(t,a),n=Math.min(n,o),r=Math.max(r,a),i=Math.max(i,o);let a=r-t,o=i-n,s=t+a/2,c=n+o/2;this._bounds=new d(s,c,a,o)}return this._bounds}setTransform(e){this._transform=e,this._offsets=null}}const g=(e,t)=>({code:0,mosaicItem:{rect:new p(0,0,11,8),sdf:!0,page:0,textureKey:t},rect:{height:4,width:e,left:0,top:0},shaping:{xOffset:0,yOffset:0,xAdvance:0,yAdvance:0}});function _(e){return e===`underline`?c(2):0}function v(e,t,n,r,i){switch(e){case`underline`:return(n??i?.baseline??22)+4+_(e)/t;case`line-through`:return r??i?.midline??16;default:return 0}}function y(e,t){return e.forEach(e=>a(e,e,t)),{topLeft:e[0],topRight:e[1],bottomLeft:e[2],bottomRight:e[3]}}class b{constructor(e,t,n,r){this._rotation=0,this._decorate(e,t,n,r),this.glyphs=e,this.bounds=this._createBounds(e),this.isMultiline=t.length>1,this._hasRotation=n.angle!==0,this._transform=this._createGlyphTransform(this.bounds,n),this._borderLineSizePx=n.borderLineSizePx,(n.borderLineSizePx||n.hasBackground)&&([this.bounds,this.textBox]=this.shapeBackground(this._transform));for(let t of e)t.setTransform(this._transform)}setRotation(n){if(n===0&&this._rotation===0)return;this._rotation=n;let r=this._transform,a=e(i(),n);t(r,a,r);for(let e of this.glyphs)e.setTransform(this._transform)}_decorate(e,t,n,r){if(!n.decoration||n.decoration===`none`||!e.length)return;let i=n.scale,a=e[0].textureKey;for(let o of t){let t=o.scale??i,s=v(n.decoration,t,o.baseline,o.midline,r),c=o.startX*t,l=o.startY*t,u=(o.width+o.glyphWidthEnd)*t;e.push(h.fromGlyph(c,l+s*t,g(u,a),1))}}shapeBackground(e){let t=(1.5+(this._borderLineSizePx||0))/2,n=this._borderLineSizePx?t:0,{xmin:r,ymin:i,xmax:a,ymax:o,x:s,y:c,width:l,height:u}=this.bounds,f=[r-8,i-8],p=[a+8,i-8],m=[r-8,o+8],h=[a+8,o+8],g=y([[f[0]-t,f[1]-t],[p[0]+t,p[1]-t],[f[0]+n,f[1]+n],[p[0]-n,p[1]+n]],e),_=y([[m[0]+n,m[1]-n],[h[0]-n,h[1]-n],[m[0]-t,m[1]+t],[h[0]+t,h[1]+t]],e),v=y([[f[0]-t,f[1]-t],[f[0]+n,f[1]+n],[m[0]-t,m[1]+t],[m[0]+n,m[1]-n]],e),b=y([[p[0]-n,p[1]+n],[p[0]+t,p[1]-t],[h[0]-n,h[1]-n],[h[0]+t,h[1]+t]],e),x={main:y([f,p,m,h],e),top:g,bot:_,left:v,right:b};return[new d(s,c,l+t*2,u+t*2),x]}get boundsT(){let e=this.bounds,t=o(s(),e.x,e.y);if(a(t,t,this._transform),this._hasRotation){let n=Math.max(e.width,e.height);return new d(t[0],t[1],n,n)}return new d(t[0],t[1],e.width,e.height)}_createBounds(e){let t=1/0,n=1/0,r=0,i=0;for(let a of e)t=Math.min(t,a.offsets.topLeft[0]),n=Math.min(n,a.offsets.topLeft[1]),r=Math.max(r,a.offsets.bottomRight[0]),i=Math.max(i,a.offsets.bottomRight[1]);let a=r-t,o=i-n,s=t+a/2,c=n+o/2;return new d(s,c,a,o)}_createGlyphTransform(e,t){let a=m*t.angle,c=i(),l=s();return n(c,c,o(l,t.xOffset,-t.yOffset)),t.useCIMAngleBehavior?r(c,c,a):(n(c,c,o(l,e.x,e.y)),r(c,c,a),n(c,c,o(l,-e.x,-e.y))),c}}class x{constructor(e,t,n,r,i,a){this.glyphWidthEnd=0,this.startX=0,this.startY=0,this.endsParagraph=!1,this.start=Math.max(0,Math.min(t,n)),this.end=Math.max(0,Math.max(t,n)),this.end<e.length&&(this.glyphWidthEnd=e[this.end].rect.width),this.width=r,this.yMin=i,this.yMax=a}}const S=e=>e===10,C=e=>e===32;function w(e,t,n){let r=[],i=1/n.scale,a=n.maxLineWidth*i,o=e.length,s=0,c=0,l=0,u=s,d=u,f=0,p=1/0,m=0;for(;s!==o;){let{code:t,rect:n,shaping:i}=e[s],o=Math.abs(n.top);if(!S(t)&&!C(t)&&(p=Math.min(p,o),m=Math.max(m,o+n.height)),S(t)){if(s!==0){let t=new x(e,u,s-1,c,p===1/0?0:p,m);t.endsParagraph=!0,r.push(t),p=1/0,m=0}c=0,u=s+1,d=s+1,l=0}else if(C(t))d=s+1,l=0,f=i.xAdvance,c+=i.xAdvance;else if(c>a){if(d!==u){let t=d-2;c-=f,r.push(new x(e,u,t,c-l,p,m)),p=1/0,m=0,u=d,c=l}else r.push(new x(e,u,s-1,c,p,m)),p=1/0,m=0,u=s,d=s,c=0;c+=i.xAdvance,l+=i.xAdvance}else c+=i.xAdvance,l+=i.xAdvance;s+=1}let h=new x(e,u,s-1,c,p,m);return h.start>=0&&h.end<e.length&&r.push(h),r}function T(e,t){let n=0;for(let t=0;t<e.length;t++){let{width:r}=e[t];n=Math.max(r,n)}let r=t.decoration===`underline`?4:0,i=e[0].yMin;return{x:0,y:i,height:e[e.length-1].yMax+t.lineHeight*(e.length-1)+r-i,width:n}}function E(e,t,n){let r=0;for(let i=t;i<n;i++)C(e[i].code)&&!S(e[i+1].code)&&r++;return r}function D(e,t){let n=t.scale,r=[],i=e.sdfPadding,{faceInfo:a,glyphs:o,isRightToLeft:s}=e,c=t.horizontalAlignment===`justify`||t.horizontalAlignment===`Justify`,d=w(o,!1,t),f=d.length?T(d,t):{y:0,height:0,width:0},p=c?s?1:-1:l(t.horizontalAlignment),m=u(t.verticalAlignment),g=+(m===2),_=g?0:m-1,v=a?.baseline??22,y=d.length>1,x=g?y?-f.y-f.height:-v:-f.y+_*(f.height/2),D=0,O=0;for(let e=0;e<d.length;e++){if(s&&e===O)for(D=e,O=e+1;O<d.length&&!d[O-1].endsParagraph;)O++;let{start:a,end:l,width:u}=d[e],m=c&&e<d.length-1?E(o,a,l):0,g=m>0?(f.width-u)/m:0,_=g>0?f.width:u,v=(p+1)*-1*(_/2)-i,y=(s?D+O-1-e:e)*t.lineHeight+x-i;d[e].startX=v,d[e].startY=y;for(let e=a;e<=l;e++){let t=o[e];if(S(t.code))continue;let i=h.fromGlyph(v,y,t,n);v+=t.shaping.xAdvance,g>0&&C(t.code)&&(v+=g),r.push(i)}}return new b(r,d,t,a)}function O(e,t){let n=t.scale,{faceInfo:r,glyphs:i}=e,a=i.reduce((e,t)=>Math.max(e,t.rect.height),0),o=i.filter(e=>e.mosaicItem.textureKey).map(e=>h.fromGlyph(-e.rect.width/2,-a,e,n));return new b(o,[],t,r)}function k(e,t){return e.type===`glyphs`?D(e,t):j(e,t)}function A(e,t){return e.type===`glyphs`?O(e,t):M(e,t)}function j(e,t){let n=N(e,t),r=P(n,t),i=r.length?I(r):{width:0},a=[],o=t.decoration===`underline`?`none`:t.decoration,s=t.horizontalAlignment===`justify`||t.horizontalAlignment===`Justify`,c=s?-1:l(t.horizontalAlignment),d=u(t.verticalAlignment),f=d===2,p=r.length?r[0].yMin:0,m=r.length?L(r[r.length-1]):0,g=m-p,_=f?r.length>1?-m:-(r[0]?.baseline??0):d===1?-p:d===-1?-m:-(p+g/2);for(let e=0;e<r.length;e++){let t=r[e],o=s&&e<r.length-1?R(n,t.start,t.end):0,l=o>0?(i.width-t.width)/o:0,u=l>0?i.width:t.width,d=(c+1)*-1*(u/2),f=t.startY+_,p=null;t.startX=d,t.startY=f;for(let e=t.start;e<=t.end;e++){let r=n[e],{glyph:i,scale:o,fontSize:s}=r,c=d;if(S(i.code)){p=z(a,p,f,t.baseline);continue}r.decoration===`underline`?(p&&p.underlineOffset!==r.underlineOffset||p&&!B(p.color,r.color))&&(p=z(a,p,f,t.baseline)):p=z(a,p,f,t.baseline);let u=f+t.baseline-r.baseline;a.push(h.fromGlyph(d/o,u/o,i,o,{fontSize:s,color:r.color})),d+=r.xAdvance,r.decoration===`underline`&&(p??={startX:c,endX:d,glyphWidthEnd:i.rect.width*o,textureKey:i.mosaicItem.textureKey,underlineOffset:r.underlineOffset,color:r.color},p.endX=d,p.glyphWidthEnd=i.rect.width*o,p.textureKey=p.textureKey??i.mosaicItem.textureKey),l>0&&C(i.code)&&(d+=l,p&&(p.endX=d))}z(a,p,f,t.baseline)}return new b(a,r,{...t,decoration:o})}function M(e,t){let n=N(e,t),r=n.reduce((e,t)=>Math.max(e,t.glyph.rect.height*t.scale),0),i=n.filter(e=>e.glyph.mosaicItem.textureKey).map(e=>h.fromGlyph(-e.glyph.rect.width/2,-r/e.scale,e.glyph,e.scale,{fontSize:e.fontSize,color:e.color}));return new b(i,[],t)}function N(e,t){let n=t.lineHeightRatio??1,r=[];for(let t of e.runs){let e=c(t.fontSize),i=e/t.glyphs.sdfSize,a=f/24*e*n,o=(t.glyphs.faceInfo?.baseline??22)*i,s=(t.glyphs.faceInfo?.midline??16)*i,l=4*i+_(t.decoration),u=1+(t.characterSpacing??0);for(let n of t.glyphs.glyphs){let c=n.shaping.xAdvance*i,d=Math.abs(n.rect.top)*i,f=d+n.rect.height*i;r.push({glyph:n,scale:i,fontSize:e,decoration:t.decoration,underlineOffset:l,color:t.color,xAdvance:!S(n.code)&&!C(n.code)?c*u:c,top:d,bottom:f,lineHeight:a,baseline:o,midline:s})}}return r}function P(e,t){let n=[],r=t.maxLineWidth,i=0,a=0,o=0,s=0,c=0,l=0;for(;i<e.length;){let t=e[i],{glyph:u}=t;if(S(u.code))i!==0&&n.push({width:a,start:s,end:i-1,glyphWidthEnd:e[i-1]?.glyph.rect.width*e[i-1]?.scale||0,yMin:0,yMax:0,lineHeight:0,baseline:0,midline:0,startX:0,startY:0,scale:1}),a=0,s=i+1,c=s,o=0,l=0;else if(C(u.code))c=i+1,o=0,l=t.xAdvance,a+=t.xAdvance;else if(a>r){if(c!==s){let t=c-2;a-=l,n.push({width:a-o,start:s,end:t,glyphWidthEnd:e[t]?.glyph.rect.width*e[t]?.scale||0,yMin:0,yMax:0,lineHeight:0,baseline:0,midline:0,startX:0,startY:0,scale:1}),s=c,a=o}else n.push({width:a,start:s,end:i-1,glyphWidthEnd:e[i-1]?.glyph.rect.width*e[i-1]?.scale||0,yMin:0,yMax:0,lineHeight:0,baseline:0,midline:0,startX:0,startY:0,scale:1}),s=i,c=i,a=0;a+=t.xAdvance,o+=t.xAdvance}else a+=t.xAdvance,o+=t.xAdvance;i++}if(s<e.length){let t=e.length-1;n.push({width:a,start:s,end:t,glyphWidthEnd:e[t]?.glyph.rect.width*e[t]?.scale||0,yMin:0,yMax:0,lineHeight:0,baseline:0,midline:0,startX:0,startY:0,scale:1})}return F(e,n)}function F(e,t){for(let n=0;n<t.length;n++){let r=t[n],i=0,a=1/0,o=0,s=0;for(let t=r.start;t<=r.end;t++){let n=e[t];n.decoration===`underline`&&(s=Math.max(s,n.underlineOffset)),S(n.glyph.code)||C(n.glyph.code)||(i=Math.max(i,n.baseline),o=Math.max(o,n.lineHeight))}let c=1/0,l=-1/0;for(let t=r.start;t<=r.end;t++){let n=e[t];S(n.glyph.code)||C(n.glyph.code)||(c=Math.min(c,i-n.baseline+n.top),l=Math.max(l,i-n.baseline+n.bottom),a=Math.min(a,i-n.baseline+n.midline))}s>0&&(l=Math.max(l,i+s)),r.baseline=i,r.midline=a===1/0?i:a,r.lineHeight=Math.max(o,l),r.yMin=c===1/0?0:c,r.yMax=l===-1/0?0:l,r.startY=n>0?t[n-1].startY+t[n-1].lineHeight:0}return t}function I(e){let t=0;for(let n of e)t=Math.max(n.width+n.glyphWidthEnd,t);let n=e[0].yMin;return{x:0,y:n,height:L(e[e.length-1])-n,width:t}}function L(e){return e.startY+e.lineHeight}function R(e,t,n){let r=0;for(let i=t;i<n;i++)C(e[i].glyph.code)&&!S(e[i+1].glyph.code)&&r++;return r}function z(e,t,n,r){return t&&e.push(h.fromGlyph(t.startX,n+r+t.underlineOffset,g(t.endX-t.startX+t.glyphWidthEnd,t.textureKey),1,{color:t.color})),null}function B(e,t){return e===t||!!e&&!!t&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}export{h as ShapedGlyph,b as ShapingInfo,D as shapeGlyphs,O as shapeGlyphsForMultipoint,j as shapeRichText,M as shapeRichTextForMultipoint,k as shapeTextResource,A as shapeTextResourceForMultipoint};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
const e=3.14159265359/180,t=3.14159265359/128,n=180/3.141592654,r=1/8,i=1,a=1,o=1.1,s=1,c
|
|
2
|
+
const e=3.14159265359/180,t=3.14159265359/128,n=180/3.141592654,r=1/8,i=1,a=1,o=1.1,s=1,c=.25,l=1/8,u=.2,d=8,f=1e-5,p=.05,m=2,h=0,g=1,_=2,v=3,y=1e-30,b=1,x=4,S=7,C=0,w=2,T=3,E=0,D=2,O=2,k=3,A=0,j=3,M=16777216,N=1.1,P=16,F=128,I=1,L=0,R=1,z=2;export{g as attrVvColor,_ as attrVvOpacity,v as attrVvRotation,h as attrVvSize,D as bitsetFillRandomPatternOffset,x as bitsetGenericConsiderAlphaOnly,S as bitsetGenericLabelInstance,b as bitsetGenericLockColor,k as bitsetLineIsSdf,O as bitsetLineScaleDash,C as bitsetMarkerAlignmentMap,w as bitsetMarkerOutlineAllowColorOverride,T as bitsetMarkerScaleSymbolsProportionally,I as bitsetOutlineUsesColorVV,A as bitsetTextIsBackground,j as bitsetTextIsMapAligned,E as bitsetTypeFillOutline,t as c256ToRad,e as cDegToRad,n as cRadToDeg,R as candidateHit,f as epsilon,p as epsilonHitTest,c as extrudeScalePlacementPadding,i as fillPositionPrecision,N as magnifierBarrelFactor,m as maxFilterCount,M as maxRepresentableInt,y as nanMagicNumber,L as noHit,l as offsetPrecision,u as outlineScale,P as packPrecision,d as placementPadding,r as positionPrecision,F as signedToUnsignedByte,a as softEdgeRatio,s as thinLineHalfWidth,o as thinLineWidthFactor,z as trueHit};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e,__param as t}from"tslib";import{labelU16ZoomPrecisionFactor as n,labelPlacementOffsetPadding as r,packDegreesU8 as i}from"../../../definitions.js";import{Vec4 as a,Vec2 as o,Float as s,Sampler2D as c,mod as l,floor as u,step as d,and as f,lessThan as p,greaterThanEqual as m,Vec3 as h,Mat3 as g,equal as _,ifElse as v,greaterThan as y,Bool as b,texture2D as x,smoothstep as S,Int as C,bitRShift as w,bitAnd as T}from"../../graph/glsl.js";import{location as E,option as D,uniform as O,texture as k,define as A,input as j,ComputeVertexInput as M}from"../../GraphShaderModule.js";import{FeatureVertexInput as N,AFeatureShader as ee,FeatureFragmentInput as te}from"../shaders/AFeatureShader.js";import{bitsetTextIsBackground as P,bitsetTextIsMapAligned as F,noHit as I,trueHit as ne}from"../shaders/constants.js";import{isPointHittest as re,distPointTriangle as ie,isRectHittest as ae,hittestRect as L,isPolygonHittest as R,hittestLabelPolygon as z,hittestPolygon as B}from"../shaders/hittestUtils.js";import{MosaicInfo as V}from"../shaders/MosaicInfo.js";import{getBit as H}from"../shaders/utils.js";import{VisualVariableColor as U}from"../shaders/VisualVariableColor.js";import{VisualVariableOpacity as W}from"../shaders/VisualVariableOpacity.js";import{VisualVariableRotation as G}from"../shaders/VisualVariableRotation.js";import{VisualVariableSizeMinMaxValue as K}from"../shaders/VisualVariableSizeMinMaxValue.js";import{VisualVariableSizeScaleStops as q}from"../shaders/VisualVariableSizeScaleStops.js";import{VisualVariableSizeStops as oe}from"../shaders/VisualVariableSizeStops.js";import{VisualVariableSizeUnitValue as se}from"../shaders/VisualVariableSizeUnitValue.js";import{getVisualVariableSize as J,getVisualVariableRotation as Y}from"../shaders/vvUtils.js";const ce=1/i;class X extends N{}e([E(3,a)],X.prototype,`color`,void 0),e([E(4,o)],X.prototype,`offset`,void 0),e([E(5,o)],X.prototype,`textureUV`,void 0),e([E(6,a)],X.prototype,`fontAndReferenceSize`,void 0),e([E(7,a)],X.prototype,`outlineColor`,void 0),e([E(8,a)],X.prototype,`haloColor`,void 0),e([E(9,o)],X.prototype,`outlineAndHaloSize`,void 0),e([E(10,o)],X.prototype,`zoomRange`,void 0),e([E(11,s)],X.prototype,`clipAngle`,void 0),e([E(12,a)],X.prototype,`referenceSymbol`,void 0);class Z extends M{}e([E(13,o)],Z.prototype,`offsetNextVertex1`,void 0),e([E(14,o)],Z.prototype,`offsetNextVertex2`,void 0);class Q extends te{}class $ extends ee{constructor(){super(...arguments),this.type=`TextShader`,this.computeAttributes={offset:[`offsetNextVertex1`,`offsetNextVertex2`]},this.textRenderPassType=0,this.isBackgroundPass=!1,this.isLabel=!1}clipLabel(e,t){let{clipAngle:r,zoomRange:i}=e,a=r.multiply(ce),o=l(a.subtract(this.view.getRotation()),new s(360)),c=new s(0),h=n,g=u(this.tileInfo.currentZoom.multiply(h)).divide(h),_=i.x,v=i.y,y=new s(1).subtract(d(_,g)).multiply(2),b=new s(f(m(o,new s(90)),p(o,new s(270)))).multiply(2),x=new s(2).multiply(new s(1).subtract(d(g,v)));return c=c.add(t.multiply(y)),c=c.add(t.multiply(b)),c=c.add(x),c=c.add(new s(2).multiply(this.getLabelHidden(e.id,e.bitset))),c}vertex(e,t){let n=H(e.bitset,P),i=new s(1).subtract(n),c=this.getFeatureId(e.id,e.bitset),l=e.fontAndReferenceSize[0],u=e.fontAndReferenceSize[1],d=e.fontAndReferenceSize[2],f=e.fontAndReferenceSize[3],p=l.divide(d),m=this.textRenderPassType===1?e.outlineColor:this.textRenderPassType===2?e.haloColor:this._getVertexColor(e,c),x=this.getCalloutTransform(this.isAnchoredLabel(e.bitset)).multiply(new h(this.getLabelTextPos(e.pos,e.id,e.bitset),1)).xy,S=e.offset,C=new s(1),w=g.identity(),T=new o(0);if(this.isLabel){if(!e.referenceSymbol)throw Error(`InternalError: Optional attribute 'referenceSymbol' expected for labels`);let t=e.referenceSymbol,n=t.xy,i=t.z,a=this._unpackDirection(t.w),o=this.getLabelReferenceSymbolVVOffset(e.id),l=_(o.x,new s(0)).and(_(o.y,new s(0))),u=v(l,J(this,c,i).divide(2),i.divide(2)),d=a.multiply(u.add(r)).add(o);T=n.add(d),S=S.add(T)}else C=J(this,c,u).divide(u),l=l.multiply(C),p=p.multiply(C),S=S.multiply(C),w=Y(this,c),S=w.multiply(new h(S,0)).xy;let E=H(e.bitset,F),D=this._getViewRotationMatrix(E).multiply(new h(S,0)).multiply(this.tileInfo.scaleFactor).xy,O=this.isLabel?this.clipLabel(e,E):this.clip(e.id,e.bitset,e.zoomRange);O=this.isBackgroundPass?O.add(i.multiply(2)):O.add(n.multiply(2));let k=new s(0);if(this.textRenderPassType===1&&(O=O.add(v(_(e.outlineAndHaloSize.x,new s(0)),new s(2),new s(0))),k=new s(e.outlineAndHaloSize.x).divide(p).divide(f)),this.textRenderPassType===2){let t=e.outlineAndHaloSize.x,n=new s(e.outlineAndHaloSize.y);O=O.add(v(_(n,new s(0)),new s(2),new s(0))),k=n.add(t).divide(p).divide(f)}let A=this.isLabel?y(O,new s(1)):new b(!1),j=new a(x.add(D),O,1),M=e.textureUV.divide(this.mosaicInfo.size),N=new s(.105).multiply(d).divide(l).divide(this.view.pixelRatio);return{glPosition:j,color:m,size:p,textureUV:M,antialiasingWidth:N,outlineDistanceOffset:k,...this.maybeRunHittest(e,t,{vvSizeAdjustment:C,vvRotation:w,labelOffset:T,labelClipped:A,scaleFactor:this.tileInfo.scaleFactor})}}_getViewRotationMatrix(e){let t=this.view.getDisplayViewMat3(),n=this.view.displayMat3,r=new s(1).subtract(e);return t.multiply(e).add(n.multiply(r))}_getHittestAlignmentMatrix(e){let t=this.tile.getTileMat3(this.view),n=this.view.viewMat3.multiply(t),r=t,i=new s(1).subtract(e);return n.multiply(e).add(r.multiply(i))}fragment(e){let t=new s(
|
|
2
|
+
import{__decorate as e,__param as t}from"tslib";import{labelU16ZoomPrecisionFactor as n,labelPlacementOffsetPadding as r,packDegreesU8 as i}from"../../../definitions.js";import{Vec4 as a,Vec2 as o,Float as s,Sampler2D as c,mod as l,floor as u,step as d,and as f,lessThan as p,greaterThanEqual as m,Vec3 as h,Mat3 as g,equal as _,ifElse as v,greaterThan as y,Bool as b,texture2D as x,smoothstep as S,Int as C,bitRShift as w,bitAnd as T}from"../../graph/glsl.js";import{location as E,option as D,uniform as O,texture as k,define as A,input as j,ComputeVertexInput as M}from"../../GraphShaderModule.js";import{FeatureVertexInput as N,AFeatureShader as ee,FeatureFragmentInput as te}from"../shaders/AFeatureShader.js";import{bitsetTextIsBackground as P,bitsetTextIsMapAligned as F,noHit as I,trueHit as ne}from"../shaders/constants.js";import{isPointHittest as re,distPointTriangle as ie,isRectHittest as ae,hittestRect as L,isPolygonHittest as R,hittestLabelPolygon as z,hittestPolygon as B}from"../shaders/hittestUtils.js";import{MosaicInfo as V}from"../shaders/MosaicInfo.js";import{getBit as H}from"../shaders/utils.js";import{VisualVariableColor as U}from"../shaders/VisualVariableColor.js";import{VisualVariableOpacity as W}from"../shaders/VisualVariableOpacity.js";import{VisualVariableRotation as G}from"../shaders/VisualVariableRotation.js";import{VisualVariableSizeMinMaxValue as K}from"../shaders/VisualVariableSizeMinMaxValue.js";import{VisualVariableSizeScaleStops as q}from"../shaders/VisualVariableSizeScaleStops.js";import{VisualVariableSizeStops as oe}from"../shaders/VisualVariableSizeStops.js";import{VisualVariableSizeUnitValue as se}from"../shaders/VisualVariableSizeUnitValue.js";import{getVisualVariableSize as J,getVisualVariableRotation as Y}from"../shaders/vvUtils.js";const ce=1/i;class X extends N{}e([E(3,a)],X.prototype,`color`,void 0),e([E(4,o)],X.prototype,`offset`,void 0),e([E(5,o)],X.prototype,`textureUV`,void 0),e([E(6,a)],X.prototype,`fontAndReferenceSize`,void 0),e([E(7,a)],X.prototype,`outlineColor`,void 0),e([E(8,a)],X.prototype,`haloColor`,void 0),e([E(9,o)],X.prototype,`outlineAndHaloSize`,void 0),e([E(10,o)],X.prototype,`zoomRange`,void 0),e([E(11,s)],X.prototype,`clipAngle`,void 0),e([E(12,a)],X.prototype,`referenceSymbol`,void 0);class Z extends M{}e([E(13,o)],Z.prototype,`offsetNextVertex1`,void 0),e([E(14,o)],Z.prototype,`offsetNextVertex2`,void 0);class Q extends te{}class $ extends ee{constructor(){super(...arguments),this.type=`TextShader`,this.computeAttributes={offset:[`offsetNextVertex1`,`offsetNextVertex2`]},this.textRenderPassType=0,this.isBackgroundPass=!1,this.isLabel=!1}clipLabel(e,t){let{clipAngle:r,zoomRange:i}=e,a=r.multiply(ce),o=l(a.subtract(this.view.getRotation()),new s(360)),c=new s(0),h=n,g=u(this.tileInfo.currentZoom.multiply(h)).divide(h),_=i.x,v=i.y,y=new s(1).subtract(d(_,g)).multiply(2),b=new s(f(m(o,new s(90)),p(o,new s(270)))).multiply(2),x=new s(2).multiply(new s(1).subtract(d(g,v)));return c=c.add(t.multiply(y)),c=c.add(t.multiply(b)),c=c.add(x),c=c.add(new s(2).multiply(this.getLabelHidden(e.id,e.bitset))),c}vertex(e,t){let n=H(e.bitset,P),i=new s(1).subtract(n),c=this.getFeatureId(e.id,e.bitset),l=e.fontAndReferenceSize[0],u=e.fontAndReferenceSize[1],d=e.fontAndReferenceSize[2],f=e.fontAndReferenceSize[3],p=l.divide(d),m=this.textRenderPassType===1?e.outlineColor:this.textRenderPassType===2?e.haloColor:this._getVertexColor(e,c),x=this.getCalloutTransform(this.isAnchoredLabel(e.bitset)).multiply(new h(this.getLabelTextPos(e.pos,e.id,e.bitset),1)).xy,S=e.offset,C=new s(1),w=g.identity(),T=new o(0);if(this.isLabel){if(!e.referenceSymbol)throw Error(`InternalError: Optional attribute 'referenceSymbol' expected for labels`);let t=e.referenceSymbol,n=t.xy,i=t.z,a=this._unpackDirection(t.w),o=this.getLabelReferenceSymbolVVOffset(e.id),l=_(o.x,new s(0)).and(_(o.y,new s(0))),u=v(l,J(this,c,i).divide(2),i.divide(2)),d=a.multiply(u.add(r)).add(o);T=n.add(d),S=S.add(T)}else C=J(this,c,u).divide(u),l=l.multiply(C),p=p.multiply(C),S=S.multiply(C),w=Y(this,c),S=w.multiply(new h(S,0)).xy;let E=H(e.bitset,F),D=this._getViewRotationMatrix(E).multiply(new h(S,0)).multiply(this.tileInfo.scaleFactor).xy,O=this.isLabel?this.clipLabel(e,E):this.clip(e.id,e.bitset,e.zoomRange);O=this.isBackgroundPass?O.add(i.multiply(2)):O.add(n.multiply(2));let k=new s(0);if(this.textRenderPassType===1&&(O=O.add(v(_(e.outlineAndHaloSize.x,new s(0)),new s(2),new s(0))),k=new s(e.outlineAndHaloSize.x).divide(p).divide(f)),this.textRenderPassType===2){let t=e.outlineAndHaloSize.x,n=new s(e.outlineAndHaloSize.y);O=O.add(v(_(n,new s(0)),new s(2),new s(0))),k=n.add(t).divide(p).divide(f)}let A=this.isLabel?y(O,new s(1)):new b(!1),j=new a(x.add(D),O,1),M=e.textureUV.divide(this.mosaicInfo.size),N=new s(.105).multiply(d).divide(l).divide(this.view.pixelRatio);return{glPosition:j,color:m,size:p,textureUV:M,antialiasingWidth:N,outlineDistanceOffset:k,...this.maybeRunHittest(e,t,{vvSizeAdjustment:C,vvRotation:w,labelOffset:T,labelClipped:A,scaleFactor:this.tileInfo.scaleFactor})}}_getViewRotationMatrix(e){let t=this.view.getDisplayViewMat3(),n=this.view.displayMat3,r=new s(1).subtract(e);return t.multiply(e).add(n.multiply(r))}_getHittestAlignmentMatrix(e){let t=this.tile.getTileMat3(this.view),n=this.view.viewMat3.multiply(t),r=t,i=new s(1).subtract(e);return n.multiply(e).add(r.multiply(i))}fragment(e){let t=new s(.25),n=new s(1).subtract(t),r=x(this.mosaicTexture,e.textureUV).a,i=n.subtract(e.outlineDistanceOffset);this.highlight&&(i=i.divide(2));let a=e.antialiasingWidth,o=S(i.subtract(a),i.add(a),r);return this.getFragmentOutput(e.color.multiply(o),e)}computeHittestTriangle(e,t,{vvSizeAdjustment:n,vvRotation:r,labelOffset:i,scaleFactor:a}){let o,s,c;this.isLabel?(o=new h(e.offset.multiply(a).add(i),0),s=new h(t.offsetNextVertex1.multiply(a).add(i),0),c=new h(t.offsetNextVertex2.multiply(a).add(i),0)):(o=r.multiply(new h(e.offset.multiply(a).multiply(n),0)),s=r.multiply(new h(t.offsetNextVertex1.multiply(a).multiply(n),0)),c=r.multiply(new h(t.offsetNextVertex2.multiply(a).multiply(n),0)));let l=this.tile.getViewScreenMat3(this.view).multiply(new h(e.pos,1)),u=H(e.bitset,F),d=this._getHittestAlignmentMatrix(u);return{pos0:l.add(d.multiply(o)).xy,pos1:l.add(d.multiply(s)).xy,pos2:l.add(d.multiply(c)).xy}}hittest(e,t,n){let{vvSizeAdjustment:r,vvRotation:i,labelOffset:a,labelClipped:o,scaleFactor:c}=n,{pos0:l,pos1:u,pos2:d}=this.computeHittestTriangle(e,t,{vvSizeAdjustment:r,vvRotation:i,labelOffset:a,scaleFactor:c}),f={pos0:l,pos1:u,pos2:d},p=this.isLabel?o:new b(!1);return v(p,new s(I),()=>v(re(this.hittestRequest),()=>{let e=ie(this.hittestRequest.position,l,u,d);return v(y(e,this.hittestRequest.distance),new s(I),new s(ne))},()=>v(ae(this.hittestRequest),L(f,this.hittestRequest.rect.xy,this.hittestRequest.rect.zw),v(R(this.hittestRequest),this.isLabel?z(f,this.hittestRequest.viewSize,this.hittestMaskTexture):B(f,this.hittestRequest.viewSize,this.hittestMaskTexture),new s(I)))))}_unpackDirection(e){let t=new C(e),n=w(t,new C(2)),r=T(t,new C(3));return new o(new s(n).subtract(1),new s(r).subtract(1))}_getVertexColor(e,t){let n=e.color;if(this.visualVariableColor){let r=this.getColorValue(t);n=this.visualVariableColor.getColor(r,e.color,new b(!1))}if(this.visualVariableOpacity){let e=this.getOpacityValue(t),r=this.visualVariableOpacity.getOpacity(e);n=n.multiply(r)}return n}}e([D(U)],$.prototype,`visualVariableColor`,void 0),e([D(W)],$.prototype,`visualVariableOpacity`,void 0),e([D(G)],$.prototype,`visualVariableRotation`,void 0),e([D(K)],$.prototype,`visualVariableSizeMinMaxValue`,void 0),e([D(q)],$.prototype,`visualVariableSizeScaleStops`,void 0),e([D(oe)],$.prototype,`visualVariableSizeStops`,void 0),e([D(se)],$.prototype,`visualVariableSizeUnitValue`,void 0),e([O(V)],$.prototype,`mosaicInfo`,void 0),e([k(c)],$.prototype,`mosaicTexture`,void 0),e([A],$.prototype,`textRenderPassType`,void 0),e([A],$.prototype,`isBackgroundPass`,void 0),e([A],$.prototype,`isLabel`,void 0),e([t(0,j(X)),t(1,j(Z))],$.prototype,`vertex`,null),e([t(0,j(Q))],$.prototype,`fragment`,null);export{Q as TextFragmentInput,$ as TextShader,X as TextVertexInput};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../Color.js";import{property as n,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{destroyMaybe as i}from"../../../../core/maybe.js";import{watch as a}from"../../../../core/reactiveUtils.js";import{project as o,initializeProjection as s}from"../../../../geometry/projectionUtils.js";import{isValid as c}from"../../../../geometry/support/spatialReferenceUtils.js";import l from"../../../../Graphic.js";import u from"../../../../layers/GraphicsLayer.js";import d from"../../../../symbols/CIMSymbol.js";import{applyCIMSymbolColor as f}from"../../../../symbols/support/cimSymbolUtils.js";import{EditGeometryOperations as p}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{InteractiveToolBase as m}from"../../../interactive/InteractiveToolBase.js";import{KeyBindings as h,mediaKeys as g}from"../../../interactive/keybindings.js";import{DragManipulation as _}from"./manipulations/DragManipulation.js";const v=new t(`#009af2`);let y=class extends m{constructor(e){super(e),this._isOpacityToggled=!1,this._factor=1,this._initialControlPoints=null,this._graphicsLayer=new u({internal:!0,listMode:`hide`,visible:!1,effect:`drop-shadow(0px, 0px, 3px)`,title:`ControlPointsTransformationTool layer`}),this._undoStack=[],this._redoStack=[],this._sharedUndoStack=[],this._sharedRedoStack=[],this._highlightHandle=null,this.activeHandle=0,this.editSourcePoints=!1,this.type=`reshape`}initialize(){this._initialize()}destroy(){let{map:e}=this.view;this._controlPointManipulations.forEach(e=>e.destroy()),this._controlPointEditGeometryOperations.forEach(e=>e.destroy()),e.removeMany([this._graphicsLayer]),this._graphicsLayer.removeAll(),this._graphicsLayer=i(this._graphicsLayer),this._georeference=null,this._controlPointGraphics=null,this._controlPointManipulations=null,this._graphicsLayer=null,this._controlPointEditGeometryOperations=null,this._undoStack=null,this._redoStack=null,this._initialControlPoints=null,this._sharedUndoStack=null,this._sharedRedoStack=null}get _hasValidSpatialReference(){return c(this.view.spatialReference)}onActivate(){this.visible=!0}onDeactivate(){this.visible=!1}onShow(){this._graphicsLayer.visible=!0}onHide(){this._graphicsLayer.visible=!1}canUndo(){let e=this._undoStack[this._undoStack.length-1];return e!=null&&this._controlPointEditGeometryOperations[e].canUndo}canRedo(){let e=this._redoStack[this._redoStack.length-1];return e!=null&&this._controlPointEditGeometryOperations[e].canRedo}undo(){if(this._undoStack.length>0){let e=this._undoStack.pop();this._controlPointEditGeometryOperations[e].undo(),this.updateGraphics(),this._redoStack.push(e)}}redo(){if(this._redoStack.length>0){let e=this._redoStack.pop();this._controlPointEditGeometryOperations[e].redo(),this.updateGraphics(),this._undoStack.push(e)}}refresh(){let{mediaElement:e}=this;if(e.georeference==null)return;let t=e.georeference;t.type===`control-points`&&t.coords!=null&&(this._georeference=t,this._georeference.controlPoints.forEach(({mapPoint:e},t)=>{let n=this._controlPointEditGeometryOperations[t],r=n.data.parts[0].vertices[0];n.setVertexPosition(r,n.data.coordinateHelper.pointToVector(e)),this._controlPointGraphics[t].geometry=n.data.geometry}))}reset(){this._georeference.controlPoints=this._initialControlPoints,this.refresh(),this._sharedUndoStack.length=0,this._sharedRedoStack.length=0}updateGraphics(){let e=this._georeference,t=e.controlPoints,n=t[0].mapPoint.spatialReference,r=this._hasValidSpatialReference;this._georeference.controlPoints=this._controlPointEditGeometryOperations.map((i,a)=>{let s=i.data.geometry;return this._controlPointGraphics[a].geometry=s,{mapPoint:o(s,n),sourcePoint:r&&!this.editSourcePoints?t[a].sourcePoint:e.toSource(s)}})}updateActiveHandle(e){if(this.activeHandle===e)return;let t=this._controlPointGraphics[this.activeHandle].symbol.clone();f(t,this.view.effectiveTheme.accentColor),this._controlPointGraphics[this.activeHandle].symbol=t;let n=this._controlPointGraphics[e].symbol.clone();f(n,v),this._controlPointGraphics[e].symbol=n,this.activeHandle=e,this.view.surface===document.activeElement&&this.highlightActiveHandle()}async highlightActiveHandle(){this.removeHighlightActiveHandle();let e=await this.view.whenLayerView(this._graphicsLayer);this._highlightHandle=e.highlight(this._controlPointGraphics[this.activeHandle])}removeHighlightActiveHandle(){this._highlightHandle&&this._highlightHandle.remove()}setSharedUndoStack(e){this._sharedUndoStack=e}setSharedRedoStack(e){this._sharedRedoStack=e}async _initialize(){let{view:e,mediaElement:t}=this;if(t.georeference==null)return;let n=t.georeference;if(n.type!==`control-points`||n.coords==null)return;this._georeference=n,this._initialControlPoints=this._georeference.controlPoints,e.map.addMany([this._graphicsLayer]),e.focus(),this.visible=!1,this.finishToolCreation(),await this._loadProjectionEngine(),this._controlPointEditGeometryOperations=this._georeference.controlPoints.map(({mapPoint:t})=>p.fromGeometry(o(t,e.spatialReference),2)),this._controlPointGraphics=this._controlPointEditGeometryOperations.map((e,t)=>new l({symbol:new d({data:{type:`CIMSymbolReference`,symbol:{type:`CIMPointSymbol`,symbolLayers:[{type:`CIMVectorMarker`,enable:!0,colorLocked:!0,anchorPoint:{x:0,y:-15.75},anchorPointUnits:`Absolute`,dominantSizeAxis3D:`Y`,size:9,billboardMode3D:`FaceNearPlane`,frame:{xmin:0,ymin:0,xmax:84.3,ymax:84.3},markerGraphics:[{type:`CIMMarkerGraphic`,geometry:{rings:[[[83.2,32.5],[84.3,40.7],[83.8,48.9],[81.7,56.9],[78.1,64.3],[73,70.9],[66.9,76.4],[59.7,80.5],[51.9,83.2],[43.7,84.3],[35.4,83.8],[27.4,81.7],[20,78],[13.4,73],[7.9,66.8],[3.8,59.7],[1.1,51.9],[0,43.7],[.5,35.4],[2.6,27.4],[6.3,20],[11.3,13.4],[17.5,7.9],[24.7,3.8],[32.5,1.1],[39.8,.1],[47.1,.3],[54.3,1.8],[61.1,4.5],[67.4,8.4],[72.9,13.3],[77.4,19.1],[80.9,25.5],[83.2,32.5]]]},symbol:{type:`CIMPolygonSymbol`,symbolLayers:[{type:`CIMSolidFill`,enable:!0,color:[255,255,255,255]}]}}],scaleSymbolsProportionally:!0,respectFrame:!0,clippingPath:{type:`CIMClippingPath`,clippingType:`Intersect`,path:{rings:[[[0,0],[84.3,0],[84.3,84.3],[0,84.3],[0,0]]]}},rotation:0},{type:`CIMVectorMarker`,enable:!0,anchorPoint:{x:0,y:-11.25},anchorPointUnits:`Absolute`,dominantSizeAxis3D:`Y`,size:22.5,billboardMode3D:`FaceNearPlane`,frame:{xmin:0,ymin:0,xmax:197.7,ymax:294.7},markerGraphics:[{type:`CIMMarkerGraphic`,geometry:{rings:[[[98.9,0],[119.4,23.2],[139.4,49.3],[156.8,75.2],[171.2,100.8],[182.4,125.3],[190.6,148.8],[195.7,171.4],[197.7,192.9],[197.7,195.8],[197.7,200.3],[197.6,202.5],[197.5,204.8],[197.3,207.1],[197,209.4],[196.7,211.7],[196.4,214.1],[196,216.4],[195.5,218.7],[195,221.1],[194.4,223.4],[193.7,225.8],[193,228.1],[192.2,230.5],[191.4,232.8],[190.5,235.1],[189.5,237.5],[188.5,239.7],[187.4,242],[186.2,244.3],[185,246.5],[183.7,248.7],[182.4,250.9],[181,253.1],[179.5,255.2],[178,257.3],[176.4,259.4],[174.7,261.4],[173.1,263.3],[171.3,265.3],[169.5,267.2],[167.7,269],[165.8,270.8],[163.9,272.5],[161.9,274.2],[159.9,275.8],[157.8,277.4],[155.7,278.9],[153.6,280.4],[151.4,281.7],[149.2,283.1],[147,284.4],[144.8,285.6],[142.5,286.7],[140.3,287.8],[138,288.8],[135.7,289.8],[133.4,290.7],[131,291.5],[128.7,292.3],[126.4,293],[124,293.6],[121.7,294.2],[119.4,294.7],[117,295.2],[114.7,295.6],[112.4,296],[110.1,296.3],[107.8,296.5],[105.5,296.7],[103.3,296.8],[101.1,296.9],[98.8,296.9],[83.1,295.7],[67.8,292],[53.3,285.9],[39.9,277.5],[28.1,267.2],[18,255.1],[10,241.5],[4.2,226.9],[.9,211.5],[0,195.8],[.1,192.9],[2.1,171.4],[7.2,148.8],[15.4,125.3],[26.6,100.8],[41,75.2],[58.4,49.3],[78.4,23.2],[98.9,0]]]},symbol:{type:`CIMPolygonSymbol`,symbolLayers:[{type:`CIMSolidFill`,enable:!0,color:t===this.activeHandle?v.toArray():this.view.effectiveTheme.accentColor.toArray()}]}}],scaleSymbolsProportionally:!0,respectFrame:!0,clippingPath:{type:`CIMClippingPath`,clippingType:`Intersect`,path:{rings:[[[0,0],[197.7,0],[197.7,294.7],[0,294.7],[0,0]]]}},rotation:0}],haloSize:1,scaleX:1,angleAlignment:`Display`,angle:0}}}),geometry:e.data.geometry})),this._graphicsLayer.graphics.addMany([...this._controlPointGraphics]),this._controlPointManipulations=this._controlPointGraphics.map(t=>new _({tool:this,view:e,graphic:t})),this.addHandles([...this._controlPointManipulations.map((e,t)=>e.createDragPipeline(this._getInfo.bind(this,t),(e,n)=>{e.action===`start`&&(this._undoStack.push(t),this._redoStack=[],this._sharedUndoStack.push({tool:this,operation:n}),this._sharedRedoStack.length=0),this.updateGraphics()})),a(()=>this.view.scale,()=>this.active?this.updateGraphics():null)]),this._controlPointManipulations.forEach((e,t)=>{e.forEachManipulator(e=>{this.addHandles([e.events.on([`click`,`grab-changed`],e=>this.updateActiveHandle(t))])})});let r=new h;r.add(g.toggleOpacity,()=>{e.activeTool===this&&(t.opacity*=this._isOpacityToggled?2:.5,this._isOpacityToggled=!this._isOpacityToggled)}),r.addToggle(g.factorModifier,t=>{e.activeTool===this&&(this._factor=t.type===`key-down`?10:1)}),r.add(g.moveUp,()=>{e.activeTool===this&&this._move(0,this._factor)}),r.add(g.moveDown,()=>{e.activeTool===this&&this._move(0,-this._factor)}),r.add(g.moveLeft,()=>{e.activeTool===this&&this._move(-this._factor,0)}),r.add(g.moveRight,()=>{e.activeTool===this&&this._move(this._factor,0)}),this.addHandles([r.register(e)])}async _loadProjectionEngine(){let e=this._georeference.controlPoints[0].mapPoint;return s(e.spatialReference,this.view.spatialReference)}_getInfo(e){return{editGeometryOperations:this._controlPointEditGeometryOperations[e],constraints:this._hasValidSpatialReference?null:{xmin:0,ymin:0,xmax:this._georeference.width,ymax:this._georeference.height}}}_move(e,t){let n=this._controlPointEditGeometryOperations[this.activeHandle].move(e*this.view.resolution,t*this.view.resolution,0,0);this._sharedUndoStack.push({tool:this,operation:n}),this._sharedRedoStack.length=0,this.updateGraphics()}};e([n()],y.prototype,`_hasValidSpatialReference`,null),e([n()],y.prototype,`activeHandle`,void 0),e([n()],y.prototype,`editSourcePoints`,void 0),e([n({constructOnly:!0,nonNullable:!0})],y.prototype,`mediaElement`,void 0),e([n({readOnly:!0})],y.prototype,`type`,void 0),e([n({constructOnly:!0})],y.prototype,`view`,void 0),y=e([r(`esri.views.2d.interactive.editingTools.ControlPointsTransformTool`)],y);export{y as ControlPointsTransformTool};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../Color.js";import{property as n,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{destroyMaybe as i}from"../../../../core/maybe.js";import{watch as a}from"../../../../core/reactiveUtils.js";import{project as o,initializeProjection as s}from"../../../../geometry/projectionUtils.js";import{isValid as c}from"../../../../geometry/support/spatialReferenceUtils.js";import l from"../../../../Graphic.js";import u from"../../../../layers/GraphicsLayer.js";import d from"../../../../symbols/CIMSymbol.js";import{applyCIMSymbolColor as f}from"../../../../symbols/support/cimSymbolUtils.js";import{EditGeometryOperations as p}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{InteractiveToolBase as m}from"../../../interactive/InteractiveToolBase.js";import{KeyBindings as h,mediaKeys as g}from"../../../interactive/keybindings.js";import{DragManipulation as _}from"./manipulations/DragManipulation.js";const v=new t(`#009af2`);let y=class extends m{constructor(e){super(e),this._isOpacityToggled=!1,this._factor=1,this._initialControlPoints=null,this._graphicsLayer=new u({internal:!0,listMode:`hide`,visible:!1,effect:`drop-shadow(0px, 0px, 3px)`,title:`ControlPointsTransformationTool layer`}),this._undoStack=[],this._redoStack=[],this._sharedUndoStack=[],this._sharedRedoStack=[],this._highlightHandle=null,this.activeHandle=0,this.editSourcePoints=!1,this.type=`reshape`}initialize(){this._initialize()}destroy(){let{map:e}=this.view;this._controlPointManipulations.forEach(e=>e.destroy()),this._controlPointEditGeometryOperations.forEach(e=>e.destroy()),e.removeMany([this._graphicsLayer]),this._graphicsLayer.removeAll(),this._graphicsLayer=i(this._graphicsLayer),this._georeference=null,this._controlPointGraphics=null,this._controlPointManipulations=null,this._graphicsLayer=null,this._controlPointEditGeometryOperations=null,this._undoStack=null,this._redoStack=null,this._initialControlPoints=null,this._sharedUndoStack=null,this._sharedRedoStack=null}get _hasValidSpatialReference(){return c(this.view.spatialReference)}onActivate(){this.visible=!0}onDeactivate(){this.visible=!1}onShow(){this._graphicsLayer.visible=!0}onHide(){this._graphicsLayer.visible=!1}canUndo(){let e=this._undoStack[this._undoStack.length-1];return e!=null&&this._controlPointEditGeometryOperations[e].canUndo}canRedo(){let e=this._redoStack[this._redoStack.length-1];return e!=null&&this._controlPointEditGeometryOperations[e].canRedo}undo(){if(this._undoStack.length>0){let e=this._undoStack.pop();this._controlPointEditGeometryOperations[e].undo(),this.updateGraphics(),this._redoStack.push(e)}}redo(){if(this._redoStack.length>0){let e=this._redoStack.pop();this._controlPointEditGeometryOperations[e].redo(),this.updateGraphics(),this._undoStack.push(e)}}refresh(){let{mediaElement:e}=this;if(e.georeference==null)return;let t=e.georeference;t.type===`control-points`&&t.coords!=null&&(this._georeference=t,this._georeference.controlPoints.forEach(({mapPoint:e},t)=>{let n=this._controlPointEditGeometryOperations[t],r=n.data.parts[0].vertices[0];n.setVertexPosition(r,n.data.coordinateHelper.pointToVector(e)),this._controlPointGraphics[t].geometry=n.data.geometry}))}reset(){this._georeference.controlPoints=this._initialControlPoints,this.refresh(),this._sharedUndoStack.length=0,this._sharedRedoStack.length=0}updateGraphics(){let e=this._georeference,t=e.controlPoints,n=t[0].mapPoint.spatialReference,r=this._hasValidSpatialReference;this._georeference.controlPoints=this._controlPointEditGeometryOperations.map((i,a)=>{let s=i.data.geometry;return this._controlPointGraphics[a].geometry=s,{mapPoint:o(s,n),sourcePoint:r&&!this.editSourcePoints?t[a].sourcePoint:e.toSource(s)}})}updateActiveHandle(e){if(this.activeHandle===e)return;let t=this._controlPointGraphics[this.activeHandle].symbol.clone();f(t,this.view.effectiveTheme.accentColor),this._controlPointGraphics[this.activeHandle].symbol=t;let n=this._controlPointGraphics[e].symbol.clone();f(n,v),this._controlPointGraphics[e].symbol=n,this.activeHandle=e,this.view.surface===document.activeElement&&this.highlightActiveHandle()}async highlightActiveHandle(){this.removeHighlightActiveHandle();let e=await this.view.whenLayerView(this._graphicsLayer);this._highlightHandle=e.highlight(this._controlPointGraphics[this.activeHandle])}removeHighlightActiveHandle(){this._highlightHandle&&this._highlightHandle.remove()}setSharedUndoStack(e){this._sharedUndoStack=e}setSharedRedoStack(e){this._sharedRedoStack=e}async _initialize(){let{view:e,mediaElement:t}=this;if(t.georeference==null)return;let n=t.georeference;if(n.type!==`control-points`||n.coords==null)return;this._georeference=n,this._initialControlPoints=this._georeference.controlPoints,e.map.addMany([this._graphicsLayer]),e.focus(),this.visible=!1,this.finishToolCreation(),await this._loadProjectionEngine(),this._controlPointEditGeometryOperations=this._georeference.controlPoints.map(({mapPoint:t})=>p.fromGeometry(o(t,e.spatialReference),!1)),this._controlPointGraphics=this._controlPointEditGeometryOperations.map((e,t)=>new l({symbol:new d({data:{type:`CIMSymbolReference`,symbol:{type:`CIMPointSymbol`,symbolLayers:[{type:`CIMVectorMarker`,enable:!0,colorLocked:!0,anchorPoint:{x:0,y:-15.75},anchorPointUnits:`Absolute`,dominantSizeAxis3D:`Y`,size:9,billboardMode3D:`FaceNearPlane`,frame:{xmin:0,ymin:0,xmax:84.3,ymax:84.3},markerGraphics:[{type:`CIMMarkerGraphic`,geometry:{rings:[[[83.2,32.5],[84.3,40.7],[83.8,48.9],[81.7,56.9],[78.1,64.3],[73,70.9],[66.9,76.4],[59.7,80.5],[51.9,83.2],[43.7,84.3],[35.4,83.8],[27.4,81.7],[20,78],[13.4,73],[7.9,66.8],[3.8,59.7],[1.1,51.9],[0,43.7],[.5,35.4],[2.6,27.4],[6.3,20],[11.3,13.4],[17.5,7.9],[24.7,3.8],[32.5,1.1],[39.8,.1],[47.1,.3],[54.3,1.8],[61.1,4.5],[67.4,8.4],[72.9,13.3],[77.4,19.1],[80.9,25.5],[83.2,32.5]]]},symbol:{type:`CIMPolygonSymbol`,symbolLayers:[{type:`CIMSolidFill`,enable:!0,color:[255,255,255,255]}]}}],scaleSymbolsProportionally:!0,respectFrame:!0,clippingPath:{type:`CIMClippingPath`,clippingType:`Intersect`,path:{rings:[[[0,0],[84.3,0],[84.3,84.3],[0,84.3],[0,0]]]}},rotation:0},{type:`CIMVectorMarker`,enable:!0,anchorPoint:{x:0,y:-11.25},anchorPointUnits:`Absolute`,dominantSizeAxis3D:`Y`,size:22.5,billboardMode3D:`FaceNearPlane`,frame:{xmin:0,ymin:0,xmax:197.7,ymax:294.7},markerGraphics:[{type:`CIMMarkerGraphic`,geometry:{rings:[[[98.9,0],[119.4,23.2],[139.4,49.3],[156.8,75.2],[171.2,100.8],[182.4,125.3],[190.6,148.8],[195.7,171.4],[197.7,192.9],[197.7,195.8],[197.7,200.3],[197.6,202.5],[197.5,204.8],[197.3,207.1],[197,209.4],[196.7,211.7],[196.4,214.1],[196,216.4],[195.5,218.7],[195,221.1],[194.4,223.4],[193.7,225.8],[193,228.1],[192.2,230.5],[191.4,232.8],[190.5,235.1],[189.5,237.5],[188.5,239.7],[187.4,242],[186.2,244.3],[185,246.5],[183.7,248.7],[182.4,250.9],[181,253.1],[179.5,255.2],[178,257.3],[176.4,259.4],[174.7,261.4],[173.1,263.3],[171.3,265.3],[169.5,267.2],[167.7,269],[165.8,270.8],[163.9,272.5],[161.9,274.2],[159.9,275.8],[157.8,277.4],[155.7,278.9],[153.6,280.4],[151.4,281.7],[149.2,283.1],[147,284.4],[144.8,285.6],[142.5,286.7],[140.3,287.8],[138,288.8],[135.7,289.8],[133.4,290.7],[131,291.5],[128.7,292.3],[126.4,293],[124,293.6],[121.7,294.2],[119.4,294.7],[117,295.2],[114.7,295.6],[112.4,296],[110.1,296.3],[107.8,296.5],[105.5,296.7],[103.3,296.8],[101.1,296.9],[98.8,296.9],[83.1,295.7],[67.8,292],[53.3,285.9],[39.9,277.5],[28.1,267.2],[18,255.1],[10,241.5],[4.2,226.9],[.9,211.5],[0,195.8],[.1,192.9],[2.1,171.4],[7.2,148.8],[15.4,125.3],[26.6,100.8],[41,75.2],[58.4,49.3],[78.4,23.2],[98.9,0]]]},symbol:{type:`CIMPolygonSymbol`,symbolLayers:[{type:`CIMSolidFill`,enable:!0,color:t===this.activeHandle?v.toArray():this.view.effectiveTheme.accentColor.toArray()}]}}],scaleSymbolsProportionally:!0,respectFrame:!0,clippingPath:{type:`CIMClippingPath`,clippingType:`Intersect`,path:{rings:[[[0,0],[197.7,0],[197.7,294.7],[0,294.7],[0,0]]]}},rotation:0}],haloSize:1,scaleX:1,angleAlignment:`Display`,angle:0}}}),geometry:e.data.geometry})),this._graphicsLayer.graphics.addMany([...this._controlPointGraphics]),this._controlPointManipulations=this._controlPointGraphics.map(t=>new _({tool:this,view:e,graphic:t})),this.addHandles([...this._controlPointManipulations.map((e,t)=>e.createDragPipeline(this._getInfo.bind(this,t),(e,n)=>{e.action===`start`&&(this._undoStack.push(t),this._redoStack=[],this._sharedUndoStack.push({tool:this,operation:n}),this._sharedRedoStack.length=0),this.updateGraphics()})),a(()=>this.view.scale,()=>this.active?this.updateGraphics():null)]),this._controlPointManipulations.forEach((e,t)=>{e.forEachManipulator(e=>{this.addHandles([e.events.on([`click`,`grab-changed`],e=>this.updateActiveHandle(t))])})});let r=new h;r.add(g.toggleOpacity,()=>{e.activeTool===this&&(t.opacity*=this._isOpacityToggled?2:.5,this._isOpacityToggled=!this._isOpacityToggled)}),r.addToggle(g.factorModifier,t=>{e.activeTool===this&&(this._factor=t.type===`key-down`?10:1)}),r.add(g.moveUp,()=>{e.activeTool===this&&this._move(0,this._factor)}),r.add(g.moveDown,()=>{e.activeTool===this&&this._move(0,-this._factor)}),r.add(g.moveLeft,()=>{e.activeTool===this&&this._move(-this._factor,0)}),r.add(g.moveRight,()=>{e.activeTool===this&&this._move(this._factor,0)}),this.addHandles([r.register(e)])}async _loadProjectionEngine(){let e=this._georeference.controlPoints[0].mapPoint;return s(e.spatialReference,this.view.spatialReference)}_getInfo(e){return{editGeometryOperations:this._controlPointEditGeometryOperations[e],constraints:this._hasValidSpatialReference?null:{xmin:0,ymin:0,xmax:this._georeference.width,ymax:this._georeference.height}}}_move(e,t){let n=this._controlPointEditGeometryOperations[this.activeHandle].move(e*this.view.resolution,t*this.view.resolution,0,0);this._sharedUndoStack.push({tool:this,operation:n}),this._sharedRedoStack.length=0,this.updateGraphics()}};e([n()],y.prototype,`_hasValidSpatialReference`,null),e([n()],y.prototype,`activeHandle`,void 0),e([n()],y.prototype,`editSourcePoints`,void 0),e([n({constructOnly:!0,nonNullable:!0})],y.prototype,`mediaElement`,void 0),e([n({readOnly:!0})],y.prototype,`type`,void 0),e([n({constructOnly:!0})],y.prototype,`view`,void 0),y=e([r(`esri.views.2d.interactive.editingTools.ControlPointsTransformTool`)],y);export{y as ControlPointsTransformTool};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{getContrast as r}from"../../../../core/colorUtils.js";import{subtract as i,normalize as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as o,fromValues as s,UNIT_X as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{scale as l,length as u,dot as d,squaredLength as f,set as p,copy as m,normalize as h,lerp as g,add as _,subtract as v}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as y,fromValues as ee}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{rad2deg as b}from"../../../../core/mathUtils.js";import{destroyMaybe as x}from"../../../../core/maybe.js";import{watch as S,syncAndInitial as C,initial as w,sync as T}from"../../../../core/reactiveUtils.js";import{px2pt as E}from"../../../../core/screenUtils.js";import{getMetersPerUnitForSR as D}from"../../../../core/units.js";import O from"../../../../geometry/Point.js";import k from"../../../../geometry/Polygon.js";import te from"../../../../geometry/Polyline.js";import{project as A,initializeProjection as j}from"../../../../geometry/projectionUtils.js";import{create as M,copy as N}from"../../../../geometry/support/boundedPlane.js";import{equals as P}from"../../../../geometry/support/spatialReferenceUtils.js";import F from"../../../../Graphic.js";import I from"../../../../layers/GraphicsLayer.js";import L from"../../../../symbols/CIMSymbol.js";import R from"../../../../symbols/SimpleFillSymbol.js";import z from"../../../../symbols/SimpleLineSymbol.js";import B from"../../../../symbols/SimpleMarkerSymbol.js";import{getCIMSymbolRotation as V,applyCIMSymbolRotation as H}from"../../../../symbols/support/cimSymbolUtils.js";import{EditGeometry as U}from"../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as W}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{calculateOrientedBounds as G}from"../../../interactive/editGeometry/support/editPlaneUtils.js";import{InteractiveToolBase as K}from"../../../interactive/InteractiveToolBase.js";import{KeyBindings as q,mediaKeys as J}from"../../../interactive/keybindings.js";import{findFirstGraphicHit as Y}from"../../../support/hitTestSelectUtils.js";import{createScreenPointFromEvent as X}from"../../../support/screenUtils.js";import{DragManipulation as Z}from"./manipulations/DragManipulation.js";import{RotateManipulation as ne}from"./manipulations/RotateManipulation.js";import{ScaleManipulation as re}from"./manipulations/ScaleManipulation.js";import{PreserveAspectRatio as Q,SnapRotation as ie,onGrabChangedHandle as ae}from"./manipulations/utils.js";const oe=[[1,1],[1,-1],[-1,-1],[-1,1],[1,0],[0,-1],[-1,0],[0,1]];let $=class extends K{constructor(e){super(e),this._graphic=null,this._planeCache=M(),this._displayPlaneCache=M(),this._mainAxisCache=o(),this._rotationHandleCache=y(),this._cornerA=y(),this._cornerB=y(),this._cornerC=y(),this._cornerD=y(),this._avgAB=y(),this._avgBC=y(),this._avgCD=y(),this._avgDA=y(),this._dragManipulation=null,this._anchorManipulation=null,this._rotateManipulation=null,this._preserveAspectRatio=new Q,this._snapRotation=new ie,this._graphicsLayer=new I({internal:!0,listMode:`hide`,visible:!1,title:`TransformTool layer`}),this._targetGeometryChanged=!1,this._sharedUndoStack=[],this._sharedRedoStack=[],this._factor=1,this.preserveAspectRatio=null,this.scaleFromAnchor=!1,this.snapRotation=null,this.type=`transform`,this._capabilities={...e.target.capabilities}}initialize(){this._initialize()}destroy(){let{map:e}=this.view;this._dragManipulation?.destroy(),this._anchorManipulation?.destroy(),this._rotateManipulation?.destroy(),this._scaleManipulations.forEach(e=>e.destroy()),this._editGeometryOperations.destroy(),e.removeMany([this._graphicsLayer]),this._graphicsLayer.removeAll(),this._graphicsLayer=x(this._graphicsLayer),this._graphic=x(this._graphic),this._anchorVertex=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 _backgroundGraphicGeometry(){let e=this._displayPlane;if(!e)return null;let t=this.view.spatialReference;return this._updateDisplayPlaneConrers(e),new k({spatialReference:t,rings:[[this._cornerA,this._cornerB,this._cornerC,this._cornerD,this._cornerA]]})}get _displayPlane(){let e=this._plane;if(!e)return null;let t=this._displayPlaneCache;N(e,t);let n=10*this.view.resolution;return l(t.basis1,t.basis1,1+n/u(t.basis1)),l(t.basis2,t.basis2,1+n/u(t.basis2)),t}get _plane(){let e=this._graphic.geometry;if(e==null)return null;let t=this._editGeometryOperations.data,n=t.parts[0].segments[0],r=i(this._mainAxisCache,n.leftVertex.pos,n.rightVertex.pos);a(r,r);let o=80*this.view.resolution,s=this.view.spatialReference;return P(s,e.spatialReference)&&(o*=D(s)/D(e.spatialReference)),G(r,t,o,this._planeCache)}get _rotateConnectorGeometry(){let e=this._rotateGraphicGeometry;if(!e)return null;let t=this._rotationHandleDirection,n=20*this.view.resolution,r=12*this.view.resolution;return new te({spatialReference:this.view.spatialReference,paths:[[[e.x-t[0]*n,e.y-t[1]*n],[e.x-t[0]*r,e.y-t[1]*r]]]})}get _rotateGraphicGeometry(){let e=this._displayPlane;if(!e)return null;let t=this._rotationHandleDirection,n=1/Math.max(Math.abs(d(t,e.basis1))/f(e.basis1),Math.abs(d(t,e.basis2))/f(e.basis2))+20*this.view.resolution;return new O({x:e.origin[0]+t[0]*n,y:e.origin[1]+t[1]*n,spatialReference:this.view.spatialReference})}get _rotationHandleDirection(){let e=this._plane,t=this.anchor,n=p(this._rotationHandleCache,e.origin[0]-t.x,e.origin[1]-t.y,0);return u(n)<=this.view.resolution*1e-6&&m(n,e.basis1),h(n,n)}get _scaleGraphicGeometries(){let e=this._displayPlane;if(!e)return[];let t=this.view.spatialReference;this._updateDisplayPlaneConrers(e);let{_cornerA:n,_cornerB:r,_cornerC:i,_cornerD:a}=this,o=g(this._avgAB,n,r,.5),s=g(this._avgBC,r,i,.5),c=g(this._avgCD,i,a,.5),l=g(this._avgDA,a,n,.5);return[new O({x:n[0],y:n[1],spatialReference:t}),new O({x:r[0],y:r[1],spatialReference:t}),new O({x:i[0],y:i[1],spatialReference:t}),new O({x:a[0],y:a[1],spatialReference:t}),new O({x:o[0],y:o[1],spatialReference:t}),new O({x:s[0],y:s[1],spatialReference:t}),new O({x:c[0],y:c[1],spatialReference:t}),new O({x:l[0],y:l[1],spatialReference:t})]}get anchor(){return this._anchorGraphic.geometry}canUndo(){return this._editGeometryOperations.canUndo}canRedo(){return this._editGeometryOperations.canRedo}undo(){this._editGeometryOperations.undo(),this.updateGraphics()}redo(){this._editGeometryOperations.redo(),this.updateGraphics()}refresh(){let{view:e,target:t}=this,n=t.getGeometry(),r=this._editGeometryOperations,i=r.data.parts[0].vertices,a=U.fromGeometry(A(n,e.spatialReference),2).parts[0].vertices;i.forEach((e,t)=>{r.setVertexPosition(e,a[t].pos)}),this._targetGeometryChanged=!1,this._graphic.geometry=r.data.geometry,this.updateGraphics()}reset(){this.target.reset(),this.refresh(),this.resetAnchor(),this._sharedUndoStack.length=0,this._sharedRedoStack.length=0}resetAnchor(){let e=this._plane.origin,t=this._anchorVertex.pos;if(e[0]===t[0]&&e[1]===t[1])return;let n=this._editGeometryOperations.moveVertices([this._anchorVertex],e[0]-t[0],e[1]-t[1],0,0);this._sharedUndoStack.push({tool:this,operation:n}),this._sharedRedoStack.length=0,this.updateGraphics()}updateGraphics(){if(this._targetGeometryChanged){let e=this._editGeometryOperations.data.geometry;this.target.setGeometry(e),this._graphic.geometry=e,this._targetGeometryChanged=!1}let e=this._anchorVertex.pos;this._anchorGraphic.geometry=new O({x:e[0],y:e[1],spatialReference:this.view.spatialReference}),this._backgroundGraphic.geometry=this._backgroundGraphicGeometry,this._rotateConnectorGraphic.geometry=this._rotateConnectorGeometry,this._rotateGraphic.geometry=this._rotateGraphicGeometry;let t=this._scaleGraphicGeometries;this._scaleGraphics.forEach((e,n)=>{e.geometry=t[n]}),this._updateSymbolAngles()}setSharedUndoStack(e){this._sharedUndoStack=e}setSharedRedoStack(e){this._sharedRedoStack=e}onActivate(){this.visible=!0}onDeactivate(){this.visible=!1}onShow(){this._graphicsLayer.visible=!0}onHide(){this._graphicsLayer.visible=!1}async _initialize(){let{view:e,target:t,_capabilities:n}=this;this._graphic=new F({geometry:t.getGeometry()}),this.addHandles(S(()=>t.isVisible?.()??!0,e=>{this._graphic.visible=e},C)),e.map.addMany([this._graphicsLayer]),e.focus(),this.visible=!1,this.finishToolCreation(),await this._loadProjectionEngine(),this._editGeometryOperations=W.fromGeometry(A(this._graphic.geometry,e.spatialReference),2);let i=this._plane.origin,a=U.fromGeometry(new O({x:i[0],y:i[1],z:0,spatialReference:e.spatialReference}),2);this._anchorVertex=a.parts[0].vertices[0],this.addHandles(this._editGeometryOperations.on(`vertex-update`,({vertices:e})=>{e.some(e=>e!==this._anchorVertex)&&(this._targetGeometryChanged=!0)})),this._backgroundGraphic=new F({geometry:this._backgroundGraphicGeometry}),this._anchorGraphic=new F({geometry:a.geometry}),this._rotateConnectorGraphic=new F({geometry:this._rotateConnectorGeometry}),this._rotateGraphic=new F({geometry:this._rotateGraphicGeometry}),this._scaleGraphics=n.scale?this._scaleGraphicGeometries.map(e=>new F({geometry:e})):[],this.addHandles(S(()=>e.effectiveTheme.accentColor,e=>{let t=new z({color:e,width:1});this._backgroundGraphic.symbol=new R({color:`transparent`,outline:{type:`simple-line`,color:e,width:2}}),this._rotateConnectorGraphic.symbol=t,this._rotateGraphic.symbol=ce(e),this._anchorGraphic.symbol=se(e),this._scaleGraphics.forEach(n=>{n.symbol=new B({size:6,style:`square`,color:r(e),outline:t})}),this._updateSymbolAngles()},w)),this._graphicsLayer.graphics.addMany([this._backgroundGraphic,...n.rotate?[this._rotateConnectorGraphic,this._rotateGraphic]:[],...this._scaleGraphics,...n.rotate||n.scale?[this._anchorGraphic]:[]]),(n.rotate||n.scale)&&(this._anchorManipulation=new Z({tool:this,view:e,graphic:this._anchorGraphic}),this._anchorManipulation.forEachManipulator(e=>{e.cursor=`grab`,this.addHandles([e.events.on(`grab-changed`,t=>ae(t,e)),e.events.on(`immediate-double-click`,e=>{e.stopPropagation(),this.resetAnchor()})])})),n.translate&&(this._dragManipulation=new Z({tool:this,view:e,graphic:this._graphic})),n.rotate&&(this._rotateManipulation=new ne({tool:this,view:e,graphic:this._rotateGraphic,snapRotation:this._snapRotation})),this._scaleManipulations=this._scaleGraphics.map((t,n)=>new re({tool:this,view:e,graphic:t,direction:oe[n],preserveAspectRatio:this._preserveAspectRatio})),this._dragManipulation&&this.addHandles(this._dragManipulation.createDragPipeline(this._getInfo.bind(this),this._handleManipulationUpdate.bind(this))),this._anchorManipulation&&this.addHandles(this._anchorManipulation.createDragPipeline(()=>({editGeometryOperations:this._editGeometryOperations,vertices:[this._anchorVertex]}),this._handleManipulationUpdate.bind(this))),this._rotateManipulation&&this.addHandles(this._rotateManipulation.createDragPipeline(this._getInfo.bind(this),this._handleManipulationUpdate.bind(this))),this.addHandles([...this._scaleManipulations.map(e=>e.createDragPipeline(this._getInfo.bind(this),this._handleManipulationUpdate.bind(this))),S(()=>this.view.scale,()=>this.active?this.updateGraphics():null),S(()=>e.rotation,()=>this._updateSymbolAngles(),T),e.on(`click`,async n=>{if(e.activeTool!=null&&e.activeTool!==this)return;let r=X(n),i=[];e.map.allLayers.forEach(e=>{(e.type===`vector-tile`||e.type===`imagery`)&&i.push(e)});let a=await this.view.hitTest(r,{exclude:i});if(a.results.length===0)e.activeTool=null;else{let n=Y(a.results);t.isHit(a)||n!=null&&this._graphicsLayer.graphics.includes(n.graphic)?e.activeTool??=this:e.activeTool=null}})]);let o=e=>{this.addHandles(e.events.on(`grab-changed`,e=>{t.onGrabChanged?.(e.action===`start`)}))};this._dragManipulation?.forEachManipulator(o),this._rotateManipulation?.forEachManipulator(o),this._scaleManipulations.forEach(e=>e.forEachManipulator(o));let s=new q;n.scale&&(s.addToggle(J.preserveAspectRatio,()=>{this.preserveAspectRatio??(this._preserveAspectRatio.enabled=!this._preserveAspectRatio.enabled)}),s.add(J.scaleUp,()=>this._scale(this._factor)),s.add(J.scaleDown,()=>this._scale(-this._factor))),n.rotate&&s.addToggle(J.rotateIncrements,()=>{this.snapRotation??(this._snapRotation.enabled=!this._snapRotation.enabled)}),s.addToggle(J.factorModifier,e=>this._factor=e.type===`key-down`?10:1),n.translate&&(s.add(J.moveUp,()=>this._move(0,this._factor)),s.add(J.moveDown,()=>this._move(0,-this._factor)),s.add(J.moveLeft,()=>this._move(-this._factor,0)),s.add(J.moveRight,()=>this._move(this._factor,0))),t.registerKeyBindings?.(s),this.addHandles([e.on(`key-down`,t=>{e.activeTool===this&&s.dispatch(e.inputManager,t)}),e.on(`key-up`,t=>{e.activeTool===this&&s.dispatch(e.inputManager,t)})])}async _loadProjectionEngine(){let e=this._graphic.geometry;return j(e.spatialReference,this.view.spatialReference)}_updateDisplayPlaneConrers(e){let{basis1:t,basis2:n,origin:r}=e,i=this._cornerA;_(i,r,t),_(i,i,n);let a=this._cornerB;_(a,r,t),v(a,a,n);let o=this._cornerC;v(o,r,t),v(o,o,n);let s=this._cornerD;v(s,r,t),_(s,s,n)}_getInfo(){return{editGeometryOperations:this._editGeometryOperations,plane:this._plane,displayPlane:this._displayPlane,origin:ee(this._anchorVertex.pos[0],this._anchorVertex.pos[1],0),vertices:[...this._editGeometryOperations.data.allVerticesUnordered,this._anchorVertex],scaleFromAnchor:this.scaleFromAnchor}}_handleManipulationUpdate(e,t){e.action===`start`&&(this._sharedUndoStack.push({tool:this,operation:t}),this._sharedRedoStack.length=0),this.updateGraphics()}_scale(e){let t=this._editGeometryOperations,n=t.data.geometry.extent?.width,r=(n+e*this.view.resolution)/n,i=t.scaleVertices([...t.data.allVerticesUnordered,this._anchorVertex],s(this._anchorVertex.pos[0],this._anchorVertex.pos[1]),c,r,r,0,1);this._sharedUndoStack.push({tool:this,operation:i}),this._sharedRedoStack.length=0,this.updateGraphics()}_move(e,t){let n=this._editGeometryOperations,r=n.moveVertices([...n.data.allVerticesUnordered,this._anchorVertex],e*this.view.resolution,t*this.view.resolution,0,0);this._sharedUndoStack.push({tool:this,operation:r}),this._sharedRedoStack.length=0,this.updateGraphics()}_updateSymbolAngles(){let e=this._plane;if(!e)return;let t=this._rotationHandleDirection,n=b(Math.atan2(t[1],t[0]))+90,r=this._rotateGraphic.symbol;if(r?.type===`cim`&&V(r)!==n){let e=r.clone();H(e,n),this._rotateGraphic.symbol=e}let i=b(Math.atan2(e.basis1[1],e.basis1[0]))+90;this._scaleGraphics.forEach(e=>{let t=e.symbol;t?.type===`simple-marker`&&(t.angle=this.view.rotation-i)})}};e([t()],$.prototype,`_backgroundGraphicGeometry`,null),e([t()],$.prototype,`_plane`,null),e([t()],$.prototype,`_rotateConnectorGeometry`,null),e([t()],$.prototype,`_rotateGraphicGeometry`,null),e([t()],$.prototype,`_scaleGraphicGeometries`,null),e([t()],$.prototype,`anchor`,null),e([t()],$.prototype,`preserveAspectRatio`,void 0),e([t()],$.prototype,`scaleFromAnchor`,void 0),e([t()],$.prototype,`snapRotation`,void 0),e([t({constructOnly:!0,nonNullable:!0})],$.prototype,`target`,void 0),e([t({readOnly:!0})],$.prototype,`type`,void 0),e([t({constructOnly:!0})],$.prototype,`view`,void 0),$=e([n(`esri.views.2d.interactive.editingTools.TransformTool`)],$);function se(e){let t=Array.from({length:33},(e,t)=>{let n=t*Math.PI/16;return[5*Math.cos(n),5*Math.sin(n)]});return new L({data:{type:`CIMSymbolReference`,symbol:{type:`CIMPointSymbol`,symbolLayers:[{type:`CIMVectorMarker`,enable:!0,size:E(18),anchorPoint:{x:0,y:0},frame:{xmin:-9,ymin:-9,xmax:9,ymax:9},respectFrame:!0,scaleSymbolsProportionally:!0,markerGraphics:[{type:`CIMMarkerGraphic`,geometry:{paths:[[[-8,0],[8,0]],[[0,-8],[0,8]],t]},symbol:{type:`CIMLineSymbol`,symbolLayers:[{type:`CIMSolidStroke`,enable:!0,width:1.5,color:e.toArray()},{type:`CIMSolidStroke`,enable:!0,width:3,color:r(e).toArray()}]}}]}]}}})}function ce(e){let t=r(e).toArray(),n=Array.from({length:48},(e,t)=>{let n=-t*Math.PI/24;return[12*Math.cos(n),12*Math.sin(n)]});n.push(n[0]);let i=Array.from({length:25},(e,t)=>{let n=(t/24*1.5+.75)*Math.PI;return[6.5*Math.cos(n),6.5*Math.sin(n)]});return new L({data:{type:`CIMSymbolReference`,symbol:{type:`CIMPointSymbol`,angleAlignment:`Map`,symbolLayers:[{type:`CIMVectorMarker`,enable:!0,size:E(24),anchorPoint:{x:0,y:0},frame:{xmin:-12,ymin:-12,xmax:12,ymax:12},scaleSymbolsProportionally:!0,respectFrame:!0,markerGraphics:[{type:`CIMMarkerGraphic`,geometry:{rings:[n]},symbol:{type:`CIMPolygonSymbol`,symbolLayers:[{type:`CIMSolidFill`,enable:!0,color:e.toArray()}]}},{type:`CIMMarkerGraphic`,geometry:{paths:[i]},symbol:{type:`CIMLineSymbol`,symbolLayers:[{type:`CIMSolidStroke`,enable:!0,width:2,capStyle:`Round`,color:t}]}},{type:`CIMMarkerGraphic`,geometry:{rings:[[[1.5,7.5],[7.5,7.5],[1.5,1.5],[1.5,7.5]]]},symbol:{type:`CIMPolygonSymbol`,symbolLayers:[{type:`CIMSolidFill`,enable:!0,color:t}]}}]}]}}})}export{$ as TransformTool};
|
|
2
|
+
import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{getContrast as r}from"../../../../core/colorUtils.js";import{subtract as i,normalize as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as o,fromValues as s,UNIT_X as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{scale as l,length as u,dot as d,squaredLength as f,set as p,copy as m,normalize as h,lerp as g,add as _,subtract as v}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as y,fromValues as ee}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{rad2deg as b}from"../../../../core/mathUtils.js";import{destroyMaybe as x}from"../../../../core/maybe.js";import{watch as S,syncAndInitial as C,initial as w,sync as T}from"../../../../core/reactiveUtils.js";import{px2pt as E}from"../../../../core/screenUtils.js";import{getMetersPerUnitForSR as D}from"../../../../core/units.js";import O from"../../../../geometry/Point.js";import k from"../../../../geometry/Polygon.js";import te from"../../../../geometry/Polyline.js";import{project as A,initializeProjection as j}from"../../../../geometry/projectionUtils.js";import{create as M,copy as N}from"../../../../geometry/support/boundedPlane.js";import{equals as P}from"../../../../geometry/support/spatialReferenceUtils.js";import F from"../../../../Graphic.js";import I from"../../../../layers/GraphicsLayer.js";import L from"../../../../symbols/CIMSymbol.js";import R from"../../../../symbols/SimpleFillSymbol.js";import z from"../../../../symbols/SimpleLineSymbol.js";import B from"../../../../symbols/SimpleMarkerSymbol.js";import{getCIMSymbolRotation as V,applyCIMSymbolRotation as H}from"../../../../symbols/support/cimSymbolUtils.js";import{EditGeometry as U}from"../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as W}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{calculateOrientedBounds as G}from"../../../interactive/editGeometry/support/editPlaneUtils.js";import{InteractiveToolBase as K}from"../../../interactive/InteractiveToolBase.js";import{KeyBindings as q,mediaKeys as J}from"../../../interactive/keybindings.js";import{findFirstGraphicHit as Y}from"../../../support/hitTestSelectUtils.js";import{createScreenPointFromEvent as X}from"../../../support/screenUtils.js";import{DragManipulation as Z}from"./manipulations/DragManipulation.js";import{RotateManipulation as ne}from"./manipulations/RotateManipulation.js";import{ScaleManipulation as re}from"./manipulations/ScaleManipulation.js";import{PreserveAspectRatio as Q,SnapRotation as ie,onGrabChangedHandle as ae}from"./manipulations/utils.js";const oe=[[1,1],[1,-1],[-1,-1],[-1,1],[1,0],[0,-1],[-1,0],[0,1]];let $=class extends K{constructor(e){super(e),this._graphic=null,this._planeCache=M(),this._displayPlaneCache=M(),this._mainAxisCache=o(),this._rotationHandleCache=y(),this._cornerA=y(),this._cornerB=y(),this._cornerC=y(),this._cornerD=y(),this._avgAB=y(),this._avgBC=y(),this._avgCD=y(),this._avgDA=y(),this._dragManipulation=null,this._anchorManipulation=null,this._rotateManipulation=null,this._preserveAspectRatio=new Q,this._snapRotation=new ie,this._graphicsLayer=new I({internal:!0,listMode:`hide`,visible:!1,title:`TransformTool layer`}),this._targetGeometryChanged=!1,this._sharedUndoStack=[],this._sharedRedoStack=[],this._factor=1,this.preserveAspectRatio=null,this.scaleFromAnchor=!1,this.snapRotation=null,this.type=`transform`,this._capabilities={...e.target.capabilities}}initialize(){this._initialize()}destroy(){let{map:e}=this.view;this._dragManipulation?.destroy(),this._anchorManipulation?.destroy(),this._rotateManipulation?.destroy(),this._scaleManipulations.forEach(e=>e.destroy()),this._editGeometryOperations.destroy(),e.removeMany([this._graphicsLayer]),this._graphicsLayer.removeAll(),this._graphicsLayer=x(this._graphicsLayer),this._graphic=x(this._graphic),this._anchorVertex=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 _backgroundGraphicGeometry(){let e=this._displayPlane;if(!e)return null;let t=this.view.spatialReference;return this._updateDisplayPlaneConrers(e),new k({spatialReference:t,rings:[[this._cornerA,this._cornerB,this._cornerC,this._cornerD,this._cornerA]]})}get _displayPlane(){let e=this._plane;if(!e)return null;let t=this._displayPlaneCache;N(e,t);let n=10*this.view.resolution;return l(t.basis1,t.basis1,1+n/u(t.basis1)),l(t.basis2,t.basis2,1+n/u(t.basis2)),t}get _plane(){let e=this._graphic.geometry;if(e==null)return null;let t=this._editGeometryOperations.data,n=t.parts[0].segments[0],r=i(this._mainAxisCache,n.leftVertex.pos,n.rightVertex.pos);a(r,r);let o=80*this.view.resolution,s=this.view.spatialReference;return P(s,e.spatialReference)&&(o*=D(s)/D(e.spatialReference)),G(r,t,o,this._planeCache)}get _rotateConnectorGeometry(){let e=this._rotateGraphicGeometry;if(!e)return null;let t=this._rotationHandleDirection,n=20*this.view.resolution,r=12*this.view.resolution;return new te({spatialReference:this.view.spatialReference,paths:[[[e.x-t[0]*n,e.y-t[1]*n],[e.x-t[0]*r,e.y-t[1]*r]]]})}get _rotateGraphicGeometry(){let e=this._displayPlane;if(!e)return null;let t=this._rotationHandleDirection,n=1/Math.max(Math.abs(d(t,e.basis1))/f(e.basis1),Math.abs(d(t,e.basis2))/f(e.basis2))+20*this.view.resolution;return new O({x:e.origin[0]+t[0]*n,y:e.origin[1]+t[1]*n,spatialReference:this.view.spatialReference})}get _rotationHandleDirection(){let e=this._plane,t=this.anchor,n=p(this._rotationHandleCache,e.origin[0]-t.x,e.origin[1]-t.y,0);return u(n)<=this.view.resolution*1e-6&&m(n,e.basis1),h(n,n)}get _scaleGraphicGeometries(){let e=this._displayPlane;if(!e)return[];let t=this.view.spatialReference;this._updateDisplayPlaneConrers(e);let{_cornerA:n,_cornerB:r,_cornerC:i,_cornerD:a}=this,o=g(this._avgAB,n,r,.5),s=g(this._avgBC,r,i,.5),c=g(this._avgCD,i,a,.5),l=g(this._avgDA,a,n,.5);return[new O({x:n[0],y:n[1],spatialReference:t}),new O({x:r[0],y:r[1],spatialReference:t}),new O({x:i[0],y:i[1],spatialReference:t}),new O({x:a[0],y:a[1],spatialReference:t}),new O({x:o[0],y:o[1],spatialReference:t}),new O({x:s[0],y:s[1],spatialReference:t}),new O({x:c[0],y:c[1],spatialReference:t}),new O({x:l[0],y:l[1],spatialReference:t})]}get anchor(){return this._anchorGraphic.geometry}canUndo(){return this._editGeometryOperations.canUndo}canRedo(){return this._editGeometryOperations.canRedo}undo(){this._editGeometryOperations.undo(),this.updateGraphics()}redo(){this._editGeometryOperations.redo(),this.updateGraphics()}refresh(){let{view:e,target:t}=this,n=t.getGeometry(),r=this._editGeometryOperations,i=r.data.parts[0].vertices,a=U.fromGeometry(A(n,e.spatialReference),!1).parts[0].vertices;i.forEach((e,t)=>{r.setVertexPosition(e,a[t].pos)}),this._targetGeometryChanged=!1,this._graphic.geometry=r.data.geometry,this.updateGraphics()}reset(){this.target.reset(),this.refresh(),this.resetAnchor(),this._sharedUndoStack.length=0,this._sharedRedoStack.length=0}resetAnchor(){let e=this._plane.origin,t=this._anchorVertex.pos;if(e[0]===t[0]&&e[1]===t[1])return;let n=this._editGeometryOperations.moveVertices([this._anchorVertex],e[0]-t[0],e[1]-t[1],0,0);this._sharedUndoStack.push({tool:this,operation:n}),this._sharedRedoStack.length=0,this.updateGraphics()}updateGraphics(){if(this._targetGeometryChanged){let e=this._editGeometryOperations.data.geometry;this.target.setGeometry(e),this._graphic.geometry=e,this._targetGeometryChanged=!1}let e=this._anchorVertex.pos;this._anchorGraphic.geometry=new O({x:e[0],y:e[1],spatialReference:this.view.spatialReference}),this._backgroundGraphic.geometry=this._backgroundGraphicGeometry,this._rotateConnectorGraphic.geometry=this._rotateConnectorGeometry,this._rotateGraphic.geometry=this._rotateGraphicGeometry;let t=this._scaleGraphicGeometries;this._scaleGraphics.forEach((e,n)=>{e.geometry=t[n]}),this._updateSymbolAngles()}setSharedUndoStack(e){this._sharedUndoStack=e}setSharedRedoStack(e){this._sharedRedoStack=e}onActivate(){this.visible=!0}onDeactivate(){this.visible=!1}onShow(){this._graphicsLayer.visible=!0}onHide(){this._graphicsLayer.visible=!1}async _initialize(){let{view:e,target:t,_capabilities:n}=this;this._graphic=new F({geometry:t.getGeometry()}),this.addHandles(S(()=>t.isVisible?.()??!0,e=>{this._graphic.visible=e},C)),e.map.addMany([this._graphicsLayer]),e.focus(),this.visible=!1,this.finishToolCreation(),await this._loadProjectionEngine(),this._editGeometryOperations=W.fromGeometry(A(this._graphic.geometry,e.spatialReference),!1);let i=this._plane.origin,a=U.fromGeometry(new O({x:i[0],y:i[1],z:0,spatialReference:e.spatialReference}),!1);this._anchorVertex=a.parts[0].vertices[0],this.addHandles(this._editGeometryOperations.on(`vertex-update`,({vertices:e})=>{e.some(e=>e!==this._anchorVertex)&&(this._targetGeometryChanged=!0)})),this._backgroundGraphic=new F({geometry:this._backgroundGraphicGeometry}),this._anchorGraphic=new F({geometry:a.geometry}),this._rotateConnectorGraphic=new F({geometry:this._rotateConnectorGeometry}),this._rotateGraphic=new F({geometry:this._rotateGraphicGeometry}),this._scaleGraphics=n.scale?this._scaleGraphicGeometries.map(e=>new F({geometry:e})):[],this.addHandles(S(()=>e.effectiveTheme.accentColor,e=>{let t=new z({color:e,width:1});this._backgroundGraphic.symbol=new R({color:`transparent`,outline:{type:`simple-line`,color:e,width:2}}),this._rotateConnectorGraphic.symbol=t,this._rotateGraphic.symbol=ce(e),this._anchorGraphic.symbol=se(e),this._scaleGraphics.forEach(n=>{n.symbol=new B({size:6,style:`square`,color:r(e),outline:t})}),this._updateSymbolAngles()},w)),this._graphicsLayer.graphics.addMany([this._backgroundGraphic,...n.rotate?[this._rotateConnectorGraphic,this._rotateGraphic]:[],...this._scaleGraphics,...n.rotate||n.scale?[this._anchorGraphic]:[]]),(n.rotate||n.scale)&&(this._anchorManipulation=new Z({tool:this,view:e,graphic:this._anchorGraphic}),this._anchorManipulation.forEachManipulator(e=>{e.cursor=`grab`,this.addHandles([e.events.on(`grab-changed`,t=>ae(t,e)),e.events.on(`immediate-double-click`,e=>{e.stopPropagation(),this.resetAnchor()})])})),n.translate&&(this._dragManipulation=new Z({tool:this,view:e,graphic:this._graphic})),n.rotate&&(this._rotateManipulation=new ne({tool:this,view:e,graphic:this._rotateGraphic,snapRotation:this._snapRotation})),this._scaleManipulations=this._scaleGraphics.map((t,n)=>new re({tool:this,view:e,graphic:t,direction:oe[n],preserveAspectRatio:this._preserveAspectRatio})),this._dragManipulation&&this.addHandles(this._dragManipulation.createDragPipeline(this._getInfo.bind(this),this._handleManipulationUpdate.bind(this))),this._anchorManipulation&&this.addHandles(this._anchorManipulation.createDragPipeline(()=>({editGeometryOperations:this._editGeometryOperations,vertices:[this._anchorVertex]}),this._handleManipulationUpdate.bind(this))),this._rotateManipulation&&this.addHandles(this._rotateManipulation.createDragPipeline(this._getInfo.bind(this),this._handleManipulationUpdate.bind(this))),this.addHandles([...this._scaleManipulations.map(e=>e.createDragPipeline(this._getInfo.bind(this),this._handleManipulationUpdate.bind(this))),S(()=>this.view.scale,()=>this.active?this.updateGraphics():null),S(()=>e.rotation,()=>this._updateSymbolAngles(),T),e.on(`click`,async n=>{if(e.activeTool!=null&&e.activeTool!==this)return;let r=X(n),i=[];e.map.allLayers.forEach(e=>{(e.type===`vector-tile`||e.type===`imagery`)&&i.push(e)});let a=await this.view.hitTest(r,{exclude:i});if(a.results.length===0)e.activeTool=null;else{let n=Y(a.results);t.isHit(a)||n!=null&&this._graphicsLayer.graphics.includes(n.graphic)?e.activeTool??=this:e.activeTool=null}})]);let o=e=>{this.addHandles(e.events.on(`grab-changed`,e=>{t.onGrabChanged?.(e.action===`start`)}))};this._dragManipulation?.forEachManipulator(o),this._rotateManipulation?.forEachManipulator(o),this._scaleManipulations.forEach(e=>e.forEachManipulator(o));let s=new q;n.scale&&(s.addToggle(J.preserveAspectRatio,()=>{this.preserveAspectRatio??(this._preserveAspectRatio.enabled=!this._preserveAspectRatio.enabled)}),s.add(J.scaleUp,()=>this._scale(this._factor)),s.add(J.scaleDown,()=>this._scale(-this._factor))),n.rotate&&s.addToggle(J.rotateIncrements,()=>{this.snapRotation??(this._snapRotation.enabled=!this._snapRotation.enabled)}),s.addToggle(J.factorModifier,e=>this._factor=e.type===`key-down`?10:1),n.translate&&(s.add(J.moveUp,()=>this._move(0,this._factor)),s.add(J.moveDown,()=>this._move(0,-this._factor)),s.add(J.moveLeft,()=>this._move(-this._factor,0)),s.add(J.moveRight,()=>this._move(this._factor,0))),t.registerKeyBindings?.(s),this.addHandles([e.on(`key-down`,t=>{e.activeTool===this&&s.dispatch(e.inputManager,t)}),e.on(`key-up`,t=>{e.activeTool===this&&s.dispatch(e.inputManager,t)})])}async _loadProjectionEngine(){let e=this._graphic.geometry;return j(e.spatialReference,this.view.spatialReference)}_updateDisplayPlaneConrers(e){let{basis1:t,basis2:n,origin:r}=e,i=this._cornerA;_(i,r,t),_(i,i,n);let a=this._cornerB;_(a,r,t),v(a,a,n);let o=this._cornerC;v(o,r,t),v(o,o,n);let s=this._cornerD;v(s,r,t),_(s,s,n)}_getInfo(){return{editGeometryOperations:this._editGeometryOperations,plane:this._plane,displayPlane:this._displayPlane,origin:ee(this._anchorVertex.pos[0],this._anchorVertex.pos[1],0),vertices:[...this._editGeometryOperations.data.allVerticesUnordered,this._anchorVertex],scaleFromAnchor:this.scaleFromAnchor}}_handleManipulationUpdate(e,t){e.action===`start`&&(this._sharedUndoStack.push({tool:this,operation:t}),this._sharedRedoStack.length=0),this.updateGraphics()}_scale(e){let t=this._editGeometryOperations,n=t.data.geometry.extent?.width,r=(n+e*this.view.resolution)/n,i=t.scaleVertices([...t.data.allVerticesUnordered,this._anchorVertex],s(this._anchorVertex.pos[0],this._anchorVertex.pos[1]),c,r,r,0,1);this._sharedUndoStack.push({tool:this,operation:i}),this._sharedRedoStack.length=0,this.updateGraphics()}_move(e,t){let n=this._editGeometryOperations,r=n.moveVertices([...n.data.allVerticesUnordered,this._anchorVertex],e*this.view.resolution,t*this.view.resolution,0,0);this._sharedUndoStack.push({tool:this,operation:r}),this._sharedRedoStack.length=0,this.updateGraphics()}_updateSymbolAngles(){let e=this._plane;if(!e)return;let t=this._rotationHandleDirection,n=b(Math.atan2(t[1],t[0]))+90,r=this._rotateGraphic.symbol;if(r?.type===`cim`&&V(r)!==n){let e=r.clone();H(e,n),this._rotateGraphic.symbol=e}let i=b(Math.atan2(e.basis1[1],e.basis1[0]))+90;this._scaleGraphics.forEach(e=>{let t=e.symbol;t?.type===`simple-marker`&&(t.angle=this.view.rotation-i)})}};e([t()],$.prototype,`_backgroundGraphicGeometry`,null),e([t()],$.prototype,`_plane`,null),e([t()],$.prototype,`_rotateConnectorGeometry`,null),e([t()],$.prototype,`_rotateGraphicGeometry`,null),e([t()],$.prototype,`_scaleGraphicGeometries`,null),e([t()],$.prototype,`anchor`,null),e([t()],$.prototype,`preserveAspectRatio`,void 0),e([t()],$.prototype,`scaleFromAnchor`,void 0),e([t()],$.prototype,`snapRotation`,void 0),e([t({constructOnly:!0,nonNullable:!0})],$.prototype,`target`,void 0),e([t({readOnly:!0})],$.prototype,`type`,void 0),e([t({constructOnly:!0})],$.prototype,`view`,void 0),$=e([n(`esri.views.2d.interactive.editingTools.TransformTool`)],$);function se(e){let t=Array.from({length:33},(e,t)=>{let n=t*Math.PI/16;return[5*Math.cos(n),5*Math.sin(n)]});return new L({data:{type:`CIMSymbolReference`,symbol:{type:`CIMPointSymbol`,symbolLayers:[{type:`CIMVectorMarker`,enable:!0,size:E(18),anchorPoint:{x:0,y:0},frame:{xmin:-9,ymin:-9,xmax:9,ymax:9},respectFrame:!0,scaleSymbolsProportionally:!0,markerGraphics:[{type:`CIMMarkerGraphic`,geometry:{paths:[[[-8,0],[8,0]],[[0,-8],[0,8]],t]},symbol:{type:`CIMLineSymbol`,symbolLayers:[{type:`CIMSolidStroke`,enable:!0,width:1.5,color:e.toArray()},{type:`CIMSolidStroke`,enable:!0,width:3,color:r(e).toArray()}]}}]}]}}})}function ce(e){let t=r(e).toArray(),n=Array.from({length:48},(e,t)=>{let n=-t*Math.PI/24;return[12*Math.cos(n),12*Math.sin(n)]});n.push(n[0]);let i=Array.from({length:25},(e,t)=>{let n=(t/24*1.5+.75)*Math.PI;return[6.5*Math.cos(n),6.5*Math.sin(n)]});return new L({data:{type:`CIMSymbolReference`,symbol:{type:`CIMPointSymbol`,angleAlignment:`Map`,symbolLayers:[{type:`CIMVectorMarker`,enable:!0,size:E(24),anchorPoint:{x:0,y:0},frame:{xmin:-12,ymin:-12,xmax:12,ymax:12},scaleSymbolsProportionally:!0,respectFrame:!0,markerGraphics:[{type:`CIMMarkerGraphic`,geometry:{rings:[n]},symbol:{type:`CIMPolygonSymbol`,symbolLayers:[{type:`CIMSolidFill`,enable:!0,color:e.toArray()}]}},{type:`CIMMarkerGraphic`,geometry:{paths:[i]},symbol:{type:`CIMLineSymbol`,symbolLayers:[{type:`CIMSolidStroke`,enable:!0,width:2,capStyle:`Round`,color:t}]}},{type:`CIMMarkerGraphic`,geometry:{rings:[[[1.5,7.5],[7.5,7.5],[1.5,1.5],[1.5,7.5]]]},symbol:{type:`CIMPolygonSymbol`,symbolLayers:[{type:`CIMSolidFill`,enable:!0,color:t}]}}]}]}}})}export{$ as TransformTool};
|