@arcgis/core 4.23.0-next.20220128 → 4.23.0-next.20220202
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/Graphic.js +1 -1
- package/TimeExtent.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/01a10fe5ad6941b0ee8c.js +1 -0
- package/assets/esri/core/workers/chunks/{7a5f5acfbd4ca1a5c1f3.js → 06116433eb6e669f146b.js} +1 -1
- package/assets/esri/core/workers/chunks/09a05d778b6fac710828.js +1 -0
- package/assets/esri/core/workers/chunks/{83d00afae4406ec78bc9.js → 0c6be307709523eb8a05.js} +1 -1
- package/assets/esri/core/workers/chunks/0e215fa28a0448169132.js +1 -0
- package/assets/esri/core/workers/chunks/{391e96192d1ec4e55ce2.js → 101b4f02f0572afb666f.js} +1 -1
- package/assets/esri/core/workers/chunks/11750e96065b4d7b926b.js +1 -0
- package/assets/esri/core/workers/chunks/{929c9b7cdab7c4ca3d87.js → 17c51f5a13f471e6656a.js} +1 -1
- package/assets/esri/core/workers/chunks/{ed0bcc66fb1e0ee75a4b.js → 1f34957ef42e5b5977d0.js} +1 -1
- package/assets/esri/core/workers/chunks/2f4e425be3a3bdfd8d29.js +1 -0
- package/assets/esri/core/workers/chunks/34bed896b68993cabaa1.js +1 -0
- package/assets/esri/core/workers/chunks/3e1679b01429fd73cffe.js +1 -0
- package/assets/esri/core/workers/chunks/{99619fcb772807c74f3b.js → 444829a840b8ded16fd7.js} +1 -1
- package/assets/esri/core/workers/chunks/467b5faa1c90d9821609.js +1 -0
- package/assets/esri/core/workers/chunks/49353182a16218a84251.js +1 -0
- package/assets/esri/core/workers/chunks/4bfc2eeb0738c393d8ec.js +1 -0
- package/assets/esri/core/workers/chunks/4de996ebc432f5e149bc.js +1 -0
- package/assets/esri/core/workers/chunks/{422537fc3df707bb62c9.js → 5038935db9b1ebe61d02.js} +1 -1
- package/assets/esri/core/workers/chunks/50976921acf7bd636123.js +1 -0
- package/assets/esri/core/workers/chunks/50ef2622fd0d9a241979.js +1 -0
- package/assets/esri/core/workers/chunks/{5790d171072b3c7d108f.js → 53aa2ab4e569c994a32d.js} +1 -1
- package/assets/esri/core/workers/chunks/{7903a3e2e0faff0f86c0.js → 56657f890e0f79f5d2ad.js} +1 -1
- package/assets/esri/core/workers/chunks/{db3c729ce0c0b2690dc9.js → 574e33f28c106d607fe3.js} +1 -1
- package/assets/esri/core/workers/chunks/{952980635afc7ec81804.js → 5b02ba8ed152dba53155.js} +1 -1
- package/assets/esri/core/workers/chunks/60c06d1bb3f8a26cb5ac.js +1 -0
- package/assets/esri/core/workers/chunks/{c2253a9f29c1aabb2b75.js → 66c47983e93071de28b1.js} +1 -1
- package/assets/esri/core/workers/chunks/6be326edd9829781d926.js +1 -0
- package/assets/esri/core/workers/chunks/70d6bb3c7112cb702389.js +1 -0
- package/assets/esri/core/workers/chunks/{5bcb3240b3c005e5fe72.js → 7215af7810d15e89aa5a.js} +1 -1
- package/assets/esri/core/workers/chunks/7509c1693ffedc0fa018.js +1 -0
- package/assets/esri/core/workers/chunks/76c1d663f6d3f935c87f.js +1 -0
- package/assets/esri/core/workers/chunks/7ccbb923f113b3e21545.js +1 -0
- package/assets/esri/core/workers/chunks/810a763373d7f78ae398.js +1 -0
- package/assets/esri/core/workers/chunks/82194fec53054c37061f.js +1 -0
- package/assets/esri/core/workers/chunks/82c59a71b7f087148089.js +1 -0
- package/assets/esri/core/workers/chunks/84eee02122b56a22d49e.js +1 -0
- package/assets/esri/core/workers/chunks/{dd13772a5e2eccc6a2bc.js → 8598f762f15ca68d52b7.js} +1 -1
- package/assets/esri/core/workers/chunks/{3c673495e5f507c4a9e5.js → 88458dcaff8edc50620c.js} +1 -1
- package/assets/esri/core/workers/chunks/{5ec98f4ddac707d0fbd1.js → 88815d533808aabb1fa9.js} +1 -1
- package/assets/esri/core/workers/chunks/{0463ba46df855a92b9c0.js → 8941f09329d9d39fb2fe.js} +1 -1
- package/assets/esri/core/workers/chunks/{655b55ac0cd533d7e9d7.js → 8ad5dc818dc73f4b9a76.js} +1 -1
- package/assets/esri/core/workers/chunks/8e96cddb069b643d864a.js +1 -0
- package/assets/esri/core/workers/chunks/{f2124f4d0f2b8a91f0ea.js → 90c5edcd8a609224ce55.js} +1 -1
- package/assets/esri/core/workers/chunks/9230b20eba4304d421b4.js +1 -0
- package/assets/esri/core/workers/chunks/{bac9fc90e6756e211160.js → 94d9951509c0db09547a.js} +1 -1
- package/assets/esri/core/workers/chunks/996d6ae7f2e2273f9bce.js +1 -0
- package/assets/esri/core/workers/chunks/{37c03cfc19086ce631c6.js → 9bd603ec98d24cd918e9.js} +1 -1
- package/assets/esri/core/workers/chunks/{c1135cb02ec46c491459.js → 9ce961bc390202c87941.js} +1 -1
- package/assets/esri/core/workers/chunks/9d4a35d4a85db80c4071.js +1 -0
- package/assets/esri/core/workers/chunks/9f0ad28e66862ba971a3.js +1 -0
- package/assets/esri/core/workers/chunks/{b3f5e91116112b0b612a.js → 9fd47b8fe25657ac0237.js} +1 -1
- package/assets/esri/core/workers/chunks/{b9e9cb354822c6d995a4.js → a276e60209f3d877a8d0.js} +1 -1
- package/assets/esri/core/workers/chunks/{aeaa1667c2d9f1b3366b.js → a85ed251d3d3668e474f.js} +1 -1
- package/assets/esri/core/workers/chunks/{44f0c3663b293afbd172.js → acf10f747215e9ff54dc.js} +1 -1
- package/assets/esri/core/workers/chunks/{69fd99b7c76e9992ccf3.js → b32bf9808cb4be3a6bd0.js} +1 -1
- package/assets/esri/core/workers/chunks/b3dc80ddbfa81026e937.js +1 -0
- package/assets/esri/core/workers/chunks/b548e6b3add4154ac4e6.js +1 -0
- package/assets/esri/core/workers/chunks/b6c55bdd8c957b062bc1.js +1 -0
- package/assets/esri/core/workers/chunks/{9d77467aa71d345fc1b6.js → bcc01bbffaa3bb5f60a8.js} +1 -1
- package/assets/esri/core/workers/chunks/{1f8c6a179e39fd4c5e6f.js → bd152e8b43cc4a6844dd.js} +1 -1
- package/assets/esri/core/workers/chunks/{0d02c6ad1f4688bfa374.js → bf7c44644fe7b0aa60cf.js} +1 -1
- package/assets/esri/core/workers/chunks/c0dc5882362479794224.js +1 -0
- package/assets/esri/core/workers/chunks/c8b574a76807f4ea7a70.js +1 -0
- package/assets/esri/core/workers/chunks/d09a0b2dc3a6fc10fa41.js +1 -0
- package/assets/esri/core/workers/chunks/{ec10151a2a95e95a0bb5.js → d304fe0ac836afd46e3d.js} +1 -1
- package/assets/esri/core/workers/chunks/{37a7bd30352b1309b8f8.js → d3f05b8e4bd53eb1eb9d.js} +1 -1
- package/assets/esri/core/workers/chunks/{be588873c16770ceb9ef.js → d46b511bbb83e68f1ece.js} +1 -1
- package/assets/esri/core/workers/chunks/{17de7a324dfa7f57ad5d.js → d780e946149b1c3d1246.js} +1 -1
- package/assets/esri/core/workers/chunks/d80bcf5ed1f54e0c4f5a.js +1 -0
- package/assets/esri/core/workers/chunks/{8cbb04a9065aa3756638.js → dc04a8ba6c770bdc2bd4.js} +1 -1
- package/assets/esri/core/workers/chunks/{89820b200ee44e678af5.js → dd891a98105904f8a06b.js} +1 -1
- package/assets/esri/core/workers/chunks/e5ab037c2a90411c453b.js +1 -0
- package/assets/esri/core/workers/chunks/ef2df21e1af3aa7ced29.js +1 -0
- package/assets/esri/core/workers/chunks/f5a7281ae24e837efc61.js +1 -0
- package/assets/esri/core/workers/chunks/{ff6abdc72076f3994659.js → f7150547d7e3259a0f29.js} +1 -1
- package/assets/esri/core/workers/chunks/{2c607d30ff8ca1b61286.js → fe0c3b7c9b428d9c3f25.js} +1 -1
- package/assets/esri/images/portal/mediaservice16.png +0 -0
- package/assets/esri/libs/vxl/vxlLayer.wasm +0 -0
- package/assets/esri/widgets/Directions/t9n/Directions.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ar.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_bg.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_bs.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ca.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_cs.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_da.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_de.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_el.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_en.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_es.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_et.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_fi.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_fr.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_he.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_hr.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_hu.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_id.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_it.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ja.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ko.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_lt.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_lv.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_nb.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_nl.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_pl.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_pt-BR.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_pt-PT.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ro.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ru.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_sk.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_sl.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_sr.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_sv.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_th.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_tr.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_uk.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_vi.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_zh-CN.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_zh-HK.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_zh-TW.json +1 -1
- package/chunks/Heatmap.glsl.js +10 -0
- package/chunks/HeatmapDensity.glsl.js +21 -0
- package/core/maybe.js +1 -1
- package/core/promiseUtils.js +1 -1
- package/interfaces.d.ts +455 -45
- package/layers/RouteLayer.d.ts +4 -0
- package/layers/RouteLayer.js +1 -1
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/graphics/data/optimizedFeatureQueryEngineAdapter.js +1 -1
- package/layers/graphics/featureConversionUtils.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/support/rasterFunctions/vectorFieldUtils.js +1 -1
- package/package.json +1 -1
- package/portal/PortalItem.js +1 -1
- package/renderers/support/rendererConversion.js +1 -1
- package/rest/support/DirectionLine.d.ts +4 -0
- package/rest/support/DirectionPoint.d.ts +4 -0
- package/rest/support/FeatureSet.js +1 -1
- package/rest/support/RouteInfo.d.ts +4 -0
- package/rest/support/RouteInfo.js +1 -1
- package/rest/support/RouteSolveResult.d.ts +4 -0
- package/support/featureFlags.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/TextSymbol3DLayer.js +1 -1
- package/symbols/support/Symbol3DHalo.js +1 -1
- package/symbols/support/Symbol3DTextBackground.js +5 -0
- package/views/2d/engine/RasterVFContainer.js +5 -0
- package/views/2d/engine/RasterVFDisplayObject.js +1 -1
- package/views/2d/engine/flow/AnimatedFlowView2D.js +1 -1
- package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
- package/views/2d/engine/webgl/brushes/raster/BrushVectorField.js +1 -1
- package/views/2d/engine/webgl/cpuMapped/Buffer.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/WGLBaseTextTemplate.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/ImageryLayerView2D.js +1 -1
- package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
- package/views/2d/layers/RouteLayerView2D.js +1 -1
- package/views/2d/layers/features/processors/HeatmapProcessor.js +1 -1
- package/views/2d/layers/features/processors/SymbolProcessor.js +1 -1
- package/views/2d/layers/features/support/AttributeStore.js +1 -1
- package/views/2d/layers/features/support/ClusterStore.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderJSON.js +1 -1
- package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
- package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
- package/views/2d/layers/imagery/ImageryVFStrategy.js +5 -0
- package/views/2d/layers/imagery/ImageryView2D.js +1 -1
- package/views/2d/layers/imagery/VectorFieldTileView2D.js +1 -1
- package/views/2d/layers/imagery/VectorFieldView2D.js +5 -0
- package/views/3d/environment/ChapmanAtmosphere.js +1 -1
- package/views/3d/environment/CloudsComposition.js +1 -1
- package/views/3d/environment/CloudsGenerator.js +1 -1
- package/views/3d/environment/EnvironmentRenderer.js +1 -1
- package/views/3d/environment/Fog.js +1 -1
- package/views/3d/environment/NoiseTextureAtlas.js +1 -1
- package/views/3d/environment/PanoramicAtmosphere.js +1 -1
- package/views/3d/environment/Precipitation.js +1 -1
- package/views/3d/environment/SimpleAtmosphere.js +1 -1
- package/views/3d/environment/Stars.js +1 -1
- package/views/3d/interactive/analysisTools/lineOfSight/LineOfSightTool.js +1 -1
- package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/VoxelLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWebStyleSymbol.js +1 -1
- package/views/3d/layers/graphics/labelPlacement.js +1 -1
- package/views/3d/layers/i3s/I3SCrossfadeHelper.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
- package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
- package/views/3d/layers/i3s/PointRenderer.js +1 -1
- package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
- package/views/3d/support/LaserLineRenderer.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TileRenderer.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
- package/views/3d/webgl-engine/lib/CompositingHelper.js +1 -1
- package/views/3d/webgl-engine/lib/DrapedHeatmapRenderer.js +5 -0
- package/views/3d/webgl-engine/lib/HighlightHelper.js +1 -1
- package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
- package/views/3d/webgl-engine/lib/SSAOHelper.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowHighlightHelper.js +1 -1
- package/views/3d/webgl-engine/lib/SmaaRenderPass.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/Texture.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +5 -0
- package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
- package/views/3d/webgl-engine/shaders/Heatmap.glsl.js +5 -0
- package/views/3d/webgl-engine/shaders/HeatmapDensity.glsl.js +5 -0
- package/views/3d/webgl-engine/shaders/HeatmapDensityTechnique.js +5 -0
- package/views/3d/webgl-engine/shaders/HeatmapTechnique.js +5 -0
- package/views/draw/support/Box.js +1 -1
- package/views/draw/support/GraphicMover.js +1 -1
- package/views/draw/support/HighlightHelper.js +5 -0
- package/views/draw/support/Reshape.js +1 -1
- package/views/draw/support/layerUtils.js +1 -1
- package/webdoc/support/{Thumbnail.js → SlideThumbnail.js} +1 -1
- package/webmap/Bookmark.js +1 -1
- package/webmap/Version.js +1 -1
- package/webscene/Slide.js +1 -1
- package/webscene/Version.js +1 -1
- package/webscene/support/SlideVisibleLayer.js +1 -1
- package/widgets/Bookmarks/BookmarksViewModel.js +1 -1
- package/widgets/Bookmarks.js +1 -1
- package/widgets/Directions/DirectionsViewModel.js +1 -1
- package/widgets/Directions/support/directionsUtils.js +1 -1
- package/widgets/Directions/support/resources.js +1 -1
- package/widgets/Directions.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/Grid/Grid.js +1 -1
- package/widgets/FeatureTable/support/FeatureStore.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/Sketch.js +1 -1
- package/widgets/TimeSlider.js +1 -1
- package/widgets/Widget.js +1 -1
- package/widgets/support/vnodeCache.js +5 -0
- package/widgets/support/widgetUtils.js +1 -1
- package/assets/esri/core/workers/chunks/0453fad5cb819797b4f6.js +0 -1
- package/assets/esri/core/workers/chunks/0cd0a6eef51fc5b9ea61.js +0 -1
- package/assets/esri/core/workers/chunks/0d684f16f37d5dc385dd.js +0 -1
- package/assets/esri/core/workers/chunks/16b6d0f8378582c051c3.js +0 -1
- package/assets/esri/core/workers/chunks/1877ab1b6a115dbba1c5.js +0 -1
- package/assets/esri/core/workers/chunks/1b2a961f776a0b57e57a.js +0 -1
- package/assets/esri/core/workers/chunks/1b3fd66577b19aa5f2b6.js +0 -1
- package/assets/esri/core/workers/chunks/1c733b7db092a2a88ef3.js +0 -1
- package/assets/esri/core/workers/chunks/27474b007988855bea9d.js +0 -1
- package/assets/esri/core/workers/chunks/357033117dfe61eb81ea.js +0 -1
- package/assets/esri/core/workers/chunks/483d5d8593d96d0f0b15.js +0 -1
- package/assets/esri/core/workers/chunks/4ba6de8aa7e2960bad49.js +0 -1
- package/assets/esri/core/workers/chunks/4be35af7d6babbfe9d84.js +0 -1
- package/assets/esri/core/workers/chunks/5457962a70bd3c557a75.js +0 -1
- package/assets/esri/core/workers/chunks/57856b4a9b8784a69844.js +0 -1
- package/assets/esri/core/workers/chunks/57b349d1dbc0bed75b79.js +0 -1
- package/assets/esri/core/workers/chunks/5d11b97b667921d67ae7.js +0 -1
- package/assets/esri/core/workers/chunks/5dbe555a5a662ff3d9ce.js +0 -1
- package/assets/esri/core/workers/chunks/64b7e8d812ea8fcf269e.js +0 -1
- package/assets/esri/core/workers/chunks/75d812955a473d0e8960.js +0 -1
- package/assets/esri/core/workers/chunks/96f148a556a2418038de.js +0 -1
- package/assets/esri/core/workers/chunks/9876a1bae350795fab36.js +0 -1
- package/assets/esri/core/workers/chunks/a8692bffb76444c34760.js +0 -1
- package/assets/esri/core/workers/chunks/ba762bcfd74af0bb8218.js +0 -1
- package/assets/esri/core/workers/chunks/c093dff4592832ac0973.js +0 -1
- package/assets/esri/core/workers/chunks/c984b3040e120e502b11.js +0 -1
- package/assets/esri/core/workers/chunks/cdbc005eebec1503b99d.js +0 -1
- package/assets/esri/core/workers/chunks/d1fe53b597351dc58305.js +0 -1
- package/assets/esri/core/workers/chunks/e218bde41ffbcc5194f5.js +0 -1
- package/assets/esri/core/workers/chunks/e287f49184d076af17e2.js +0 -1
- package/assets/esri/core/workers/chunks/e93dfdede0532a89ffa5.js +0 -1
- package/assets/esri/core/workers/chunks/e9e5196b44b6923be1a3.js +0 -1
- package/assets/esri/core/workers/chunks/ea595b0df5050eda2a13.js +0 -1
- package/assets/esri/core/workers/chunks/eb82ff10cef2bde6e57f.js +0 -1
- package/assets/esri/core/workers/chunks/ee6e0db58dc64410e687.js +0 -1
- package/assets/esri/core/workers/chunks/f0a9f161805fc7a30fc5.js +0 -1
- package/assets/esri/core/workers/chunks/fc7e31d87555beb63291.js +0 -1
- package/assets/esri/core/workers/chunks/fff6b0338f06dad0c45d.js +0 -1
- package/views/2d/layers/imagery/ImageryGraphicsView2D.js +0 -5
- package/widgets/Directions/support/CostSummary.js +0 -5
- package/widgets/Directions/support/RouteSection.js +0 -5
- package/widgets/Directions/support/RouteSections.js +0 -5
- package/widgets/Directions/support/maneuverUtils.js +0 -5
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{someMap as e}from"../../../../../core/MapUtils.js";import{isSome as t,isNone as r}from"../../../../../core/maybe.js";import s from"../../../../../core/PooledArray.js";import{m as i,a,t as o}from"../../../../../chunks/mat4.js";import{c as n}from"../../../../../chunks/mat4f64.js";import{glLayout as d}from"../../../support/buffer/glUtil.js";import{GLMaterials as h}from"../../lib/GLMaterials.js";import{RenderOccludedFlag as
|
|
5
|
+
import{someMap as e}from"../../../../../core/MapUtils.js";import{isSome as t,isNone as r}from"../../../../../core/maybe.js";import s from"../../../../../core/PooledArray.js";import{m as i,a,t as o}from"../../../../../chunks/mat4.js";import{c as n}from"../../../../../chunks/mat4f64.js";import{glLayout as d}from"../../../support/buffer/glUtil.js";import{GLMaterials as h}from"../../lib/GLMaterials.js";import{RenderOccludedFlag as f}from"../../lib/Material.js";import{ModelDirty as l}from"../../lib/ModelDirtyTypes.js";import{RenderPass as m}from"../../lib/RenderPass.js";import{assert as c,setMatrixTranslation3 as u}from"../../lib/Util.js";import{WaterMaterial as g}from"../WaterMaterial.js";import{sortInstancesByRange as _,BufferRange as p,Instance as b,addOrMerge as w}from"./Instance.js";import{MergedGeometryBuffer as y}from"./MergedGeometryBuffer.js";import{MergedGeometryBufferPool as C}from"./MergedGeometryBufferPool.js";import{calculateTransformRelativeToOrigin as H}from"./utils.js";class v{constructor(e,t,r){this._rctx=e,this._materialRepository=t,this._material=r,this.type="MergedRenderer",this._dataByOrigin=new Map,this._renderCommandData=new s,this._hasHighlights=!1,this._hasOccludees=!1,this._glMaterials=new h(this._material,this._materialRepository),this._bufferWriter=r.createBufferWriter(),this._bufferPool=new C(e,r.vertexAttributeLocations,d(this._bufferWriter.vertexBufferLayout))}dispose(){this._glMaterials.destroy(),this._dataByOrigin.forEach((e=>e.buffer.dispose())),this._dataByOrigin.clear(),this._bufferPool.dispose()}get isEmpty(){return 0===this._dataByOrigin.size}get hasHighlights(){return this._hasHighlights}get hasOccludees(){return this._hasOccludees}get hasWater(){return!this.isEmpty&&this._material instanceof g}get rendersOccluded(){return!this.isEmpty&&this._material.renderOccluded!==f.Occlude}modify(e){this._updateGeometries(e.updates),this._addAndRemoveGeometries(e.adds,e.removes),this._updateRenderCommands()}_addAndRemoveGeometries(e,t){const r=this._bufferWriter,s=r.vertexBufferLayout.stride/4,i=this._dataByOrigin,a=A(e,t);a.forEach(((e,t)=>{a.delete(t);const o=e.toAdd.reduce(((e,t)=>e+r.elementCount(t.data)),0);let n=i.get(t);if(null==n)c(0===e.toRemove.length),n=new B(e.origin,new y(this._bufferPool,o*s)),i.set(t,n);else if(0===e.toAdd.length&&n.instances.size===e.toRemove.length)return n.buffer.dispose(),void i.delete(t);let d=0;n.instances.forEach((e=>d+=e.to-e.from));const h=e.toRemove.reduce(((e,t)=>e+r.elementCount(t.data)),0),f=n.buffer.size,l=(d+o-h)*s,m=M;if(l<f/2?this._removeAndRebuild(n,e.toRemove,s,l,m):e.toRemove.length>0&&this._remove(n,e.toRemove,s,m),e.toAdd.length>0){const t=E;u(t,-e.origin[0],-e.origin[1],-e.origin[2]),this._add(n,e.toAdd,s,t,m)}const g=n.buffer.vao.vertexBuffers.geometry;I(m),m.forAll((({from:e,to:t})=>{if(e<t){const r=n.buffer.array,s=4,i=e*s,a=t*s;g.setSubData(r,i,i,a)}})),m.clear(),n.drawCommandsDirty=!0}))}_updateGeometries(e){const t=this._bufferWriter,r=t.vertexBufferLayout.stride/4;for(const s of e){const e=s.renderGeometry,i=this._dataByOrigin.get(e.origin.id),a=i&&i.instances.get(e.id);if(!a)return;const o=s.updateType;if(o&l.State.VISIBILITIES&&(a.isVisible=e.instanceParameters.visible),o&(l.State.HIGHLIGHTS|l.State.VISIBILITIES)){const t=e.instanceParameters.visible;a.hasHighlights=!!e.instanceParameters.highlights&&t}if(o&l.State.OCCLUDEES&&(a.hasOccludees=!!e.instanceParameters.occludees),o&(l.State.VERTEXATTRS|l.State.TRANSFORMATION)){const{array:s,vao:o}=i.buffer;H(e,L,P),t.write({transformation:L,invTranspTransformation:P},e.data,t.vertexBufferLayout.createView(s.buffer),a.from),c(a.from+t.elementCount(e.data)===a.to,"material VBO layout has changed"),o.vertexBuffers.geometry.setSubData(s,a.from*r*4,a.from*r*4,a.to*r*4)}i.drawCommandsDirty=!0}}_updateRenderCommands(){this._hasHighlights=!1,this._hasOccludees=!1,this._dataByOrigin.forEach((t=>{t.hasHiddenInstances=!1,t.hasHighlights=!1,t.hasOccludees=!1,e(t.instances,(e=>(e.isVisible?(e.hasHighlights&&(this._hasHighlights=!0,t.hasHighlights=!0),e.hasOccludees&&(this._hasOccludees=!0,t.hasOccludees=!0)):t.hasHiddenInstances=!0,t.hasHiddenInstances&&t.hasHighlights&&t.hasOccludees)))}));const t=e=>{if(e.drawCommandsDefault=null,e.drawCommandsHighlight=null,e.drawCommandsOccludees=null,e.drawCommandsShadowHighlightRest=null,0===e.instances.size)return;if(!S(e)){const t=this._bufferWriter.vertexBufferLayout.stride,r=4*e.buffer.size/t;return void(e.drawCommandsDefault=[{first:0,count:r}])}const t=_(e.instances);e.drawCommandsDefault=[],e.drawCommandsHighlight=[],e.drawCommandsOccludees=[],e.drawCommandsShadowHighlightRest=[];for(const r of t)r.isVisible&&(r.hasOccludees?w(e.drawCommandsOccludees,r):w(e.drawCommandsDefault,r),r.hasHighlights?w(e.drawCommandsHighlight,r):w(e.drawCommandsShadowHighlightRest,r))};this._dataByOrigin.forEach((e=>{e.drawCommandsDirty&&(t(e),e.drawCommandsDirty=!1)}))}updateAnimation(e){return this._material.update(e)}requiresSlot(e,t){return null==e||this._material.requiresSlot(e,t)}render(e,s,i){if(!this.requiresSlot(e,s))return!1;const a=s===m.MATERIAL_HIGHLIGHT||s===m.MATERIAL_DEPTH_SHADOWMAP_HIGHLIGHT;if(a&&!this._hasHighlights)return!1;const o=s===m.MATERIAL_DEPTH_SHADOWMAP_DEFAULT,n=!(a||o);if(this._dataByOrigin.forEach((e=>{if(a&&!e.hasHighlights)return;const r=(a?e.drawCommandsHighlight:o&&S(e)?e.drawCommandsShadowHighlightRest:e.drawCommandsDefault)||null,s=n&&e.drawCommandsOccludees||null;(t(r)||t(s))&&this._renderCommandData.push(new T(e.origin,e.buffer,r,s))})),0===this._renderCommandData.length)return!1;const d=this._rctx,h=this._glMaterials.load(d,s);if(r(h))return this._renderCommandData.clear(),!1;const f=h.beginSlot(i);return d.useTechnique(f,e,!1),h.bind(i,f),this._renderCommandData.forAll((({origin:r,buffer:s,renderCommands:a,occludeeCommands:o})=>{i.origin=r,f.bindDraw(i),f.ensureAttributeLocations(s.vao),d.bindVAO(s.vao);const n=f.primitiveType;t(a)&&this._renderCommands(d,n,a),t(o)&&(f.bindPipelineState(d,e,!0),this._renderCommands(d,n,o),f.bindPipelineState(d,e,!1))})),this._renderCommandData.clear(),!0}_renderCommands(e,t,r){for(let s=0;s<r.length;s++)e.drawArrays(t,r[s].first,r[s].count)}_removeAndRebuild(e,t,r,s,i){for(const h of t)e.instances.delete(h.id);const a=_(e.instances);e.instances.clear();const o=e.buffer.size,n=e.buffer.alloc(s);let d=0;for(const h of a){const t=h.from*r,s=h.to*r;n.copy(d,t,s),h.from=d/r,d+=s-t,h.to=d/r,e.instances.set(h.id,h)}i.push(new p(0,n.hasNewBuffer?e.buffer.array.length:o)),n.dispose(),e.buffer.erase(d,i.back().to),e.holes.clear()}_remove(e,t,r,s){for(const i of t){const t=i.id,a=e.instances.get(t),o=a.from*r,n=a.to*r;e.buffer.erase(o,n),e.holes.push(new p(a.from,a.to)),e.instances.delete(t),s.push(new p(o,n))}I(e.holes)}_add(e,s,n,d,h){const f=this._bufferWriter;let l=f.vertexBufferLayout.createView(e.buffer.array.buffer);for(const m of s){const s=t(m.transformation)?i(L,d,m.transformation):d;a(P,s);const u=o(P,P),g=f.elementCount(m.data),_=g*n;let w=D(e.holes,g);r(w)&&(w=e.buffer.size/n,e.buffer.grow(_),l=f.vertexBufferLayout.createView(e.buffer.array.buffer)),f.write({transformation:s,invTranspTransformation:u},m.data,l,w);const y=m.instanceParameters.visible,C=!!m.instanceParameters.highlights&&y,H=!!m.instanceParameters.occludees,v=new b(m.id,w,w+g,y,C,H);c(null==e.instances.get(m.id)),e.instances.set(m.id,v),h.push(new p(v.from*n,v.to*n))}}get test(){return{material:this._material,glMaterials:this._glMaterials}}}class O{constructor(e){this.origin=e,this.toAdd=new Array,this.toRemove=new Array}}function A(e,t){const r=new Map;for(const s of e)R(r,s,!0);for(const s of t)R(r,s,!1);return r}function R(e,t,s){const i=t.origin;if(r(i))return;let a=e.get(i.id);null==a&&(a=new O(i.vec3),e.set(i.id,a)),s?a.toAdd.push(t):a.toRemove.push(t)}function S(e){return e.hasOccludees||e.hasHighlights||e.hasHiddenInstances}function D(e,t){let r;if(!e.some((e=>!(e.to-e.from<t)&&(r=e,!0))))return null;const s=r.from;return r.from+=t,r.from>=r.to&&e.removeUnordered(r),s}function I(e){const t=new Map;e.forAll((e=>t.set(e.from,e)));let r=!0;for(;r;)r=!1,e.forEach((s=>{const i=t.get(s.to);i&&(s.to=i.to,t.delete(i.from),e.removeUnordered(i),r=!0)}))}class B{constructor(e,t){this.origin=e,this.buffer=t,this.instances=new Map,this.holes=new s({deallocator:null}),this.hasHiddenInstances=!1,this.hasHighlights=!1,this.hasOccludees=!1,this.drawCommandsDirty=!1}}class T{constructor(e,t,r,s){this.origin=e,this.buffer=t,this.renderCommands=r,this.occludeeCommands=s}}const M=new s({deallocator:null}),E=n(),L=n(),P=n();export{v as MergedRenderer};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import"../core/shaderLibrary/ScreenSpacePass.js";import"../core/shaderLibrary/util/AlphaDiscard.glsl.js";import"../core/shaderModules/interfaces.js";import"../core/shaderModules/ShaderBuilder.js";import"../lib/basicInterfaces.js";export{b as build}from"../../../../chunks/Heatmap.glsl.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import"../core/shaderModules/interfaces.js";import"../core/shaderModules/ShaderBuilder.js";import"../lib/VertexAttribute.js";export{b as build}from"../../../../chunks/HeatmapDensity.glsl.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{bindProjectionMatrix as r,bindView as e}from"../core/shaderLibrary/util/View.glsl.js";import{ReloadableShaderModule as i}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as t}from"../core/shaderTechnique/ShaderTechnique.js";import{Default3D as o}from"../lib/DefaultVertexAttributeLocations.js";import{Program as s}from"../lib/Program.js";import{H as a}from"../../../../chunks/HeatmapDensity.glsl.js";import{BlendOperation as l,BlendFactor as m}from"../../../webgl/enums.js";import{makePipelineState as n,simpleBlendingParams as p,defaultColorWriteParams as d}from"../../../webgl/renderState.js";class h extends t{initializeProgram(r){const e=h.shader.get().build();return new s(r.rctx,e,o)}initializePipeline(){return n({blending:p(m.ONE,m.ONE,l.ADD),colorWrite:d,depthTest:null,depthWrite:null})}bindPass(e,i){r(this.program,i.camera.projectionMatrix),this.program.setUniform1f("radius",e.searchRadius/i.camera.fullViewport[2])}bindDraw(r){e(this.program,r)}}h.shader=new i(a,(()=>import("./HeatmapDensity.glsl.js")));export{h as HeatmapDensityTechnique};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{ReloadableShaderModule as e}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as r}from"../core/shaderTechnique/ShaderTechnique.js";import{Default3D as t}from"../lib/DefaultVertexAttributeLocations.js";import{blendingDefault as i}from"../lib/OrderIndependentTransparency.js";import{Program as o}from"../lib/Program.js";import{H as n}from"../../../../chunks/Heatmap.glsl.js";import{PrimitiveType as s}from"../../../webgl/enums.js";import{makePipelineState as a,defaultColorWriteParams as m}from"../../../webgl/renderState.js";class l extends r{initializeProgram(e){const r=l.shader.get().build();return new o(e.rctx,r,t)}initializePipeline(e){return a({blending:i,colorWrite:m,depthTest:null,depthWrite:null})}bindPass(e,r){this.program.bindTexture(e.densityMap,"densityMap"),this.program.bindTexture(e.colorRamp,"tex");const t=3/(.05*e.pointCount);this.program.setUniform1f("densityNormalizer",t)}get primitiveType(){return s.TRIANGLE_STRIP}}l.shader=new e(n,(()=>import("./Heatmap.glsl.js")));export{l as HeatmapTechnique};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import e from"../../../Graphic.js";import i from"../../../core/Evented.js";import s from"../../../core/Handles.js";import{destroyMaybe as r,isSome as a}from"../../../core/maybe.js";import{whenOnce as o,pausable as h}from"../../../core/watchUtils.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{create as l}from"../../../geometry/support/aaBoundingRect.js";import{getRingsOrPathsBounds as p}from"../../../geometry/support/boundsUtils.js";import{geometryToCoordinates as d}from"../../../geometry/support/coordsUtils.js";import m from"../../../geometry/support/rotate.js";import u from"../../../symbols/SimpleFillSymbol.js";import g from"../../../symbols/SimpleLineSymbol.js";import _ from"../../../symbols/SimpleMarkerSymbol.js";import{cloneMove as v,scale as y,getScaleRatio as G,getRotationAngle as f}from"./drawUtils.js";import b from"./GraphicMover.js";import{addUniqueLayer as S}from"./layerUtils.js";import{settings as w}from"./settings.js";import k from"../../../geometry/Point.js";import x from"../../../geometry/Polygon.js";import R from"../../../geometry/Polyline.js";class M{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.dx=i,this.dy=s,this.type="move-start"}}class I{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.dx=i,this.dy=s,this.type="move"}}class C{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.dx=i,this.dy=s,this.type="move-stop"}}class E{constructor(t,e,i){this.graphics=t,this.mover=e,this.angle=i,this.type="rotate-start"}}class O{constructor(t,e,i){this.graphics=t,this.mover=e,this.angle=i,this.type="rotate"}}class j{constructor(t,e,i){this.graphics=t,this.mover=e,this.angle=i,this.type="rotate-stop"}}class L{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.xScale=i,this.yScale=s,this.type="scale-start"}}class B{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.xScale=i,this.yScale=s,this.type="scale"}}class Y{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.xScale=i,this.yScale=s,this.type="scale-stop"}}const z=w.transformGraphics,N={centerIndicator:new _({style:"cross",size:z.center.size,color:z.center.color}),fill:{default:new u({color:z.fill.color,outline:{color:z.fill.outlineColor,join:"round",width:1}}),active:new u({color:z.fill.stagedColor,outline:{color:z.fill.outlineColor,join:"round",style:"dash",width:1}})},handles:{default:new _({style:"square",size:z.vertex.size,color:z.vertex.color,outline:{color:z.vertex.outlineColor,width:1}}),hover:new _({style:"square",size:z.vertex.hoverSize,color:z.vertex.hoverColor,outline:{color:z.vertex.hoverOutlineColor,width:1}})},rotator:{default:new _({style:"circle",size:z.vertex.size,color:z.vertex.color,outline:{color:z.vertex.outlineColor,width:1}}),hover:new _({style:"circle",size:z.vertex.hoverSize,color:z.vertex.hoverColor,outline:{color:z.vertex.hoverOutlineColor,width:1}})},rotatorLine:new g({color:z.line.color,width:1})};let P=class extends i.EventedAccessor{constructor(t){super(t),this._activeHandleGraphic=null,this._graphicAttributes={esriSketchTool:"box"},this._handles=new s,this._mover=null,this._rotateGraphicOffset=20,this._angleOfRotation=0,this._rotateLineGraphic=null,this._startInfo=null,this._totalDx=0,this._totalDy=0,this._xScale=1,this._yScale=1,this.type="box",this.callbacks={onMoveStart(){},onMove(){},onMoveStop(){},onScaleStart(){},onScale(){},onScaleStop(){},onRotateStart(){},onRotate(){},onRotateStop(){},onGraphicClick(){}},this.centerGraphic=null,this.backgroundGraphic=null,this.enableMovement=!0,this.enableRotation=!0,this.enableScaling=!0,this.graphics=[],this.handleGraphics=[],this.layer=null,this.preserveAspectRatio=!1,this.rotateGraphic=null,this.showCenterGraphic=!0,this.view=null,this._getBounds=(()=>{const t=l();return(e,i)=>{e[0]=Number.POSITIVE_INFINITY,e[1]=Number.POSITIVE_INFINITY,e[2]=Number.NEGATIVE_INFINITY,e[3]=Number.NEGATIVE_INFINITY;for(const s of i){if(!s)continue;let i,r,a,o;if("point"===s.type)i=a=s.x,r=o=s.y;else if("multipoint"===s.type){const e=d(s);[i,r,a,o]=p(t,[e])}else if("extent"===s.type)[i,r,a,o]=[s.xmin,s.ymin,s.xmax,s.ymax];else{const e=d(s);[i,r,a,o]=p(t,e)}e[0]=Math.min(i,e[0]),e[1]=Math.min(r,e[1]),e[2]=Math.max(a,e[2]),e[3]=Math.max(o,e[3])}return e}})()}initialize(){this._setup(),this._handles.add([o(this,"view.ready",(()=>{const{layer:t,view:e}=this;S(e,t)})),h(this,"preserveAspectRatio",(()=>{this._activeHandleGraphic&&(this._scaleGraphic(this._activeHandleGraphic),this._updateGraphics())})),h(this,"view.scale",(()=>{this._updateRotateGraphic(),this._updateRotateLineGraphic()})),h(this,"graphics",(()=>this.refresh())),h(this,"layer",((t,e)=>{e&&this._resetGraphics(e),this.refresh()}))])}destroy(){this._reset(),this._handles=r(this._handles)}get state(){const t=!!this.get("view.ready"),e=!(!this.get("graphics.length")||!this.get("layer"));return t&&e?"active":t?"ready":"disabled"}set symbols(t){const{centerIndicator:e=N.centerIndicator,fill:i=N.fill,handles:s=N.handles,rotator:r=N.rotator,rotatorLine:a=N.rotatorLine}=t||{};this._set("symbols",{centerIndicator:e,fill:i,handles:s,rotator:r,rotatorLine:a})}isUIGraphic(t){let e=[];return this.handleGraphics.length&&(e=e.concat(this.handleGraphics)),this.backgroundGraphic&&e.push(this.backgroundGraphic),this.centerGraphic&&e.push(this.centerGraphic),this.rotateGraphic&&e.push(this.rotateGraphic),this._rotateLineGraphic&&e.push(this._rotateLineGraphic),e.length&&e.includes(t)}move(t,e){if(this._mover&&this.graphics.length){for(const i of this.graphics){const s=i.geometry,r=v(s,t,e,this.view);i.geometry=r}this.refresh(),this._emitMoveStopEvent(t,e,null)}}scale(t,e){if(this._mover&&this.graphics.length){for(const i of this.graphics){const s=i.geometry,r=y(s,t,e);i.geometry=r}this.refresh(),this._emitScaleStopEvent(t,e,null)}}rotate(t,e){if(this._mover&&this.graphics.length){if(!e){const t=this.handleGraphics[1].geometry.x,i=this.handleGraphics[3].geometry.y;e=new k(t,i,this.view.spatialReference)}for(const i of this.graphics){const s=i.geometry,r=m(s,t,e);i.geometry=r}this.refresh(),this._emitRotateStopEvent(t,null)}}refresh(){this._reset(),this._setup()}reset(){this.graphics=[]}_setup(){"active"===this.state&&(this._setupGraphics(),this._setupMover(),this._updateGraphics())}_reset(){this._resetGraphicStateVars(),this._resetGraphics(),this._mover&&this._mover.destroy(),this._mover=null,this.view.cursor="default"}_resetGraphicStateVars(){this._startInfo=null,this._activeHandleGraphic=null,this._totalDx=0,this._totalDy=0,this._xScale=1,this._yScale=1,this._angleOfRotation=0}_resetGraphics(t){const e=t||this.layer;e&&(e.removeMany(this.handleGraphics),e.remove(this.backgroundGraphic),e.remove(this.centerGraphic),e.remove(this.rotateGraphic),e.remove(this._rotateLineGraphic));for(const i of this.handleGraphics)i.destroy();this._set("handleGraphics",[]),this.backgroundGraphic&&(this.backgroundGraphic.destroy(),this._set("backgroundGraphic",null)),this.centerGraphic&&(this.centerGraphic.destroy(),this._set("centerGraphic",null)),this.rotateGraphic&&(this.rotateGraphic.destroy(),this._set("rotateGraphic",null)),this._rotateLineGraphic&&(this._rotateLineGraphic.destroy(),this._rotateLineGraphic=null)}_setupMover(){let t=[];this.enableScaling&&(t=t.concat(this.handleGraphics)),this.enableMovement&&(t=t.concat(this.graphics,this.backgroundGraphic)),this.enableRotation&&t.push(this.rotateGraphic),this.showCenterGraphic&&t.push(this.centerGraphic),this._mover=new b({enableMoveAllGraphics:!1,indicatorsEnabled:!1,view:this.view,graphics:t,callbacks:{onGraphicClick:t=>this._onGraphicClickCallback(t),onGraphicMoveStart:t=>this._onGraphicMoveStartCallback(t),onGraphicMove:t=>this._onGraphicMoveCallback(t),onGraphicMoveStop:t=>this._onGraphicMoveStopCallback(t),onGraphicPointerOver:t=>this._onGraphicPointerOverCallback(t),onGraphicPointerOut:t=>this._onGraphicPointerOutCallback(t)}})}_getStartInfo(t){const[e,i,s,r]=this._getBoxBounds(l()),a=Math.abs(s-e),o=Math.abs(r-i),h=(s+e)/2,c=(r+i)/2,{x:n,y:p}=t.geometry;return{width:a,height:o,centerX:h,centerY:c,startX:n,startY:p,graphicInfos:this._getGraphicInfos(),box:this.backgroundGraphic.geometry,rotate:this.rotateGraphic.geometry}}_getGraphicInfos(){return this.graphics.map((t=>this._getGraphicInfo(t)))}_getGraphicInfo(t){const e=t.geometry,[i,s,r,a]=this._getBounds(l(),[e]);return{width:Math.abs(r-i),height:Math.abs(a-s),centerX:(r+i)/2,centerY:(a+s)/2,geometry:e}}_onGraphicClickCallback(t){t.viewEvent.stopPropagation(),this.emit("graphic-click",t),this.callbacks.onGraphicClick&&this.callbacks.onGraphicClick(t)}_onGraphicMoveStartCallback(t){const{_angleOfRotation:e,_xScale:i,_yScale:s,backgroundGraphic:r,handleGraphics:a,rotateGraphic:o,symbols:h}=this,c=t.graphic;this._resetGraphicStateVars(),this._hideGraphicsBeforeUpdate(),r.symbol=h.fill.active,this._startInfo=this._getStartInfo(c),c===o?(this.view.cursor="grabbing",this._emitRotateStartEvent(e,c)):a.includes(c)?(this._activeHandleGraphic=c,this._emitScaleStartEvent(i,s,c)):this._emitMoveStartEvent(t.dx,t.dy,c)}_onGraphicMoveCallback(t){const e=t.graphic;if(this._startInfo)if(this.handleGraphics.includes(e))this._scaleGraphic(e),this._emitScaleEvent(this._xScale,this._yScale,e);else if(e===this.rotateGraphic)this._rotateGraphic(e),this._emitRotateEvent(this._angleOfRotation,e);else{const i=t.dx,s=t.dy;this._totalDx+=i,this._totalDy+=s,this._moveGraphic(e,i,s),this._emitMoveEvent(i,s,e)}}_onGraphicMoveStopCallback(t){const e=t.graphic;if(!this._startInfo)return void this.refresh();const{_angleOfRotation:i,_totalDx:s,_totalDy:r,_xScale:a,_yScale:o,handleGraphics:h,rotateGraphic:c}=this;this.refresh(),e===c?(this.view.cursor="pointer",this._emitRotateStopEvent(i,e)):h.includes(e)?this._emitScaleStopEvent(a,o,e):this._emitMoveStopEvent(s,r,e)}_onGraphicPointerOverCallback(t){const{backgroundGraphic:e,handleGraphics:i,graphics:s,rotateGraphic:r,symbols:a,view:o}=this,h=t.graphic;if(h===r)return r.symbol=a.rotator.hover,void(o.cursor="pointer");if(s.includes(h)||h===e)return void(o.cursor="move");if(!i.includes(h))return void(o.cursor="pointer");t.graphic.symbol=a.handles.hover;const c=o.rotation;let n,l=t.index;switch(l<8&&(c>=0&&c<45?l%=8:l=c>=45&&c<90?(l+1)%8:c>=90&&c<135?(l+2)%8:c>=135&&c<180?(l+3)%8:c>=180&&c<225?(l+4)%8:c>=225&&c<270?(l+5)%8:c>=270&&c<315?(l+6)%8:(l+7)%8),l){case 0:case 4:n="nwse-resize";break;case 1:case 5:n="ns-resize";break;case 2:case 6:n="nesw-resize";break;case 3:case 7:n="ew-resize";break;default:n="pointer"}o.cursor=n}_onGraphicPointerOutCallback(t){const{handleGraphics:e,rotateGraphic:i,symbols:s,view:r}=this;t.graphic===i?i.symbol=s.rotator.default:e.includes(t.graphic)&&(t.graphic.symbol=s.handles.default),r.cursor="default"}_scaleGraphic(t){const{_startInfo:e,handleGraphics:i,preserveAspectRatio:s,view:r}=this,{centerX:a,centerY:o,startX:h,startY:c}=e,{resolution:n,transform:l}=r.state,p=i.indexOf(t);1!==p&&5!==p||this._updateX(t,a),3!==p&&7!==p||this._updateY(t,o);const{x:d,y:m}=t.geometry,u=l[0]*d+l[2]*m+l[4],g=l[1]*d+l[3]*m+l[5],_=e.graphicInfos.map((t=>t.geometry));if(s){const t=l[0]*a+l[2]*o+l[4],e=l[1]*a+l[3]*o+l[5],i=l[0]*h+l[2]*c+l[4],s=l[1]*h+l[3]*c+l[5];this._xScale=this._yScale=G(t,e,i,s,u,g);for(const r of _){const t=_.indexOf(r);this.graphics[t].geometry=y(r,this._xScale,this._yScale,[a,o])}this._updateBackgroundGraphic()}else{const{width:t,height:i}=e;let s=d-h,l=c-m;if(1===p||5===p?s=0:3!==p&&7!==p||(l=0),0===s&&0===l)return;const u=t+(h>a?s:-1*s),g=i+(c<o?l:-1*l),G=a+s/2,f=o+l/2;this._xScale=u/t||1,this._yScale=g/i||1,1===p||5===p?this._xScale=1:3!==p&&7!==p||(this._yScale=1);const b=(G-a)/n,S=(f-o)/n,w=y(e.box,this._xScale,this._yScale);this.backgroundGraphic.geometry=v(w,b,S,r,!0);const{centerX:x,centerY:R}=this._getGraphicInfo(this.backgroundGraphic),M=(x-a)/n,I=-1*(R-o)/n;for(const e of _){const t=_.indexOf(e),i=y(e,this._xScale,this._yScale,[a,o]);this.graphics[t].geometry=v(i,M,I,r,!0)}this.centerGraphic.geometry=new k(x,R,r.spatialReference)}}_rotateGraphic(t){const{centerX:e,centerY:i,startX:s,startY:r,box:a,rotate:o}=this._startInfo,h=new k(s,r,this.view.spatialReference),c=new k(e,i,this.view.spatialReference),n=t.geometry;this._angleOfRotation=f(h,n,c);const l=this._startInfo.graphicInfos.map((t=>t.geometry));for(const p of l){const t=l.indexOf(p),e=m(p,this._angleOfRotation,c);this.graphics[t].geometry=e}this.backgroundGraphic.geometry=m(a,this._angleOfRotation,c),this.rotateGraphic.geometry=m(o,this._angleOfRotation,c)}_moveGraphic(t,e,i){if(this.graphics.includes(t)){const s=this.backgroundGraphic.geometry;this.backgroundGraphic.geometry=v(s,e,i,this.view);for(const r of this.graphics)r!==t&&(r.geometry=v(r.geometry,e,i,this.view))}else if(t===this.centerGraphic){const t=this.backgroundGraphic.geometry;this.backgroundGraphic.geometry=v(t,e,i,this.view)}if(t===this.backgroundGraphic||t===this.centerGraphic)for(const s of this.graphics)s.geometry=v(s.geometry,e,i,this.view)}_setupGraphics(){const{_graphicAttributes:t,symbols:i}=this;this._set("centerGraphic",new e(null,i.centerIndicator,t)),this.showCenterGraphic&&this.layer.add(this.centerGraphic),this._set("backgroundGraphic",new e(null,i.fill.default,t)),this.layer.add(this.backgroundGraphic),this._rotateLineGraphic=new e(null,i.rotatorLine,t),this._set("rotateGraphic",new e(null,i.rotator.default,t)),this.enableRotation&&!this._hasExtentGraphic()&&(this.layer.add(this._rotateLineGraphic),this.layer.add(this.rotateGraphic));for(let s=0;s<8;s++)this.handleGraphics.push(new e(null,i.handles.default,t));this.enableScaling&&this.layer.addMany(this.handleGraphics)}_updateGraphics(){this._updateBackgroundGraphic(),this._updateHandleGraphics(),this._updateCenterGraphic(),this._updateRotateGraphic(),this._updateRotateLineGraphic()}_hideGraphicsBeforeUpdate(){this.centerGraphic.visible=!1,this.rotateGraphic.visible=!1,this._rotateLineGraphic.visible=!1,this.handleGraphics.forEach((t=>t.visible=!1))}_updateHandleGraphics(){const t=this._getCoordinates(!0);this.handleGraphics.forEach(((e,i)=>{const[s,r]=t[i];this._updateXY(e,s,r)}))}_updateBackgroundGraphic(){const t=this._getCoordinates();this.backgroundGraphic.geometry=new x({rings:t,spatialReference:this.view.spatialReference})}_updateCenterGraphic(){const[t,e,i,s]=this._getBoxBounds(l()),r=(i+t)/2,a=(s+e)/2;this.centerGraphic.geometry=new k(r,a,this.view.spatialReference)}_updateRotateGraphic(){if(!this.handleGraphics.length)return;const{x:t,y:e}=this.handleGraphics[1].geometry,i=e+this.view.state.resolution*this._rotateGraphicOffset;this.rotateGraphic.geometry=new k(t,i,this.view.spatialReference)}_updateRotateLineGraphic(){if(!this.handleGraphics.length||!this.rotateGraphic||!this.rotateGraphic.geometry)return;const t=this.handleGraphics[1].geometry,e=this.rotateGraphic.geometry;this._rotateLineGraphic.geometry=new R({paths:[[t.x,t.y],[e.x,e.y]],spatialReference:this.view.spatialReference})}_updateXY(t,e,i){t.geometry=new k(e,i,this.view.spatialReference)}_updateX(t,e){const i=t.geometry.y;t.geometry=new k(e,i,this.view.spatialReference)}_updateY(t,e){const i=t.geometry.x;t.geometry=new k(i,e,this.view.spatialReference)}_hasExtentGraphic(){return this.graphics.some((t=>t&&a(t.geometry)&&"extent"===t.geometry.type))}_getBoxBounds(t){const e=this.graphics.map((t=>t.geometry));return this._getBounds(t,e)}_getCoordinates(t){const[e,i,s,r]=this._getBoxBounds(l());if(t){const t=(e+s)/2,a=(r+i)/2;return[[e,r],[t,r],[s,r],[s,a],[s,i],[t,i],[e,i],[e,a]]}return[[e,r],[s,r],[s,i],[e,i]]}_emitMoveStartEvent(t,e,i){const s=new M(this.graphics,i,t,e);this.emit("move-start",s),this.callbacks.onMoveStart&&this.callbacks.onMoveStart(s)}_emitMoveEvent(t,e,i){const s=new I(this.graphics,i,t,e);this.emit("move",s),this.callbacks.onMove&&this.callbacks.onMove(s)}_emitMoveStopEvent(t,e,i){const s=new C(this.graphics,i,t,e);this.emit("move-stop",s),this.callbacks.onMoveStop&&this.callbacks.onMoveStop(s)}_emitRotateStartEvent(t,e){const i=new E(this.graphics,e,t);this.emit("rotate-start",i),this.callbacks.onRotateStart&&this.callbacks.onRotateStart(i)}_emitRotateEvent(t,e){const i=new O(this.graphics,e,t);this.emit("rotate",i),this.callbacks.onRotate&&this.callbacks.onRotate(i)}_emitRotateStopEvent(t,e){const i=new j(this.graphics,e,t);this.emit("rotate-stop",i),this.callbacks.onRotateStop&&this.callbacks.onRotateStop(i)}_emitScaleStartEvent(t,e,i){const s=new L(this.graphics,i,t,e);this.emit("scale-start",s),this.callbacks.onScaleStart&&this.callbacks.onScaleStart(s)}_emitScaleEvent(t,e,i){const s=new B(this.graphics,i,t,e);this.emit("scale",s),this.callbacks.onScale&&this.callbacks.onScale(s)}_emitScaleStopEvent(t,e,i){const s=new Y(this.graphics,i,t,e);this.emit("scale-stop",s),this.callbacks.onScaleStop&&this.callbacks.onScaleStop(s)}};t([c()],P.prototype,"_rotateLineGraphic",void 0),t([c({readOnly:!0})],P.prototype,"type",void 0),t([c()],P.prototype,"callbacks",void 0),t([c({readOnly:!0})],P.prototype,"centerGraphic",void 0),t([c({readOnly:!0})],P.prototype,"backgroundGraphic",void 0),t([c()],P.prototype,"enableMovement",void 0),t([c()],P.prototype,"enableRotation",void 0),t([c()],P.prototype,"enableScaling",void 0),t([c()],P.prototype,"graphics",void 0),t([c({readOnly:!0})],P.prototype,"handleGraphics",void 0),t([c()],P.prototype,"layer",void 0),t([c()],P.prototype,"preserveAspectRatio",void 0),t([c({readOnly:!0})],P.prototype,"rotateGraphic",void 0),t([c()],P.prototype,"showCenterGraphic",void 0),t([c({readOnly:!0})],P.prototype,"state",null),t([c({value:N})],P.prototype,"symbols",null),t([c()],P.prototype,"view",void 0),P=t([n("esri.views.draw.support.Box")],P);const X=P;export{X as default};
|
|
5
|
+
import{_ as t}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import e from"../../../Graphic.js";import i from"../../../core/Evented.js";import s from"../../../core/Handles.js";import{destroyMaybe as r,isSome as a}from"../../../core/maybe.js";import{whenOnce as o,pausable as h}from"../../../core/watchUtils.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{create as l}from"../../../geometry/support/aaBoundingRect.js";import{getRingsOrPathsBounds as p}from"../../../geometry/support/boundsUtils.js";import{geometryToCoordinates as d}from"../../../geometry/support/coordsUtils.js";import g from"../../../geometry/support/rotate.js";import m from"../../../symbols/SimpleFillSymbol.js";import u from"../../../symbols/SimpleLineSymbol.js";import _ from"../../../symbols/SimpleMarkerSymbol.js";import{cloneMove as v,scale as y,getScaleRatio as G,getRotationAngle as f}from"./drawUtils.js";import b from"./GraphicMover.js";import S from"./HighlightHelper.js";import{addUniqueLayer as w}from"./layerUtils.js";import{settings as k}from"./settings.js";import x from"../../../geometry/Point.js";import R from"../../../geometry/Polygon.js";import M from"../../../geometry/Polyline.js";class I{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.dx=i,this.dy=s,this.type="move-start"}}class E{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.dx=i,this.dy=s,this.type="move"}}class C{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.dx=i,this.dy=s,this.type="move-stop"}}class O{constructor(t,e,i){this.graphics=t,this.mover=e,this.angle=i,this.type="rotate-start"}}class j{constructor(t,e,i){this.graphics=t,this.mover=e,this.angle=i,this.type="rotate"}}class L{constructor(t,e,i){this.graphics=t,this.mover=e,this.angle=i,this.type="rotate-stop"}}class B{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.xScale=i,this.yScale=s,this.type="scale-start"}}class H{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.xScale=i,this.yScale=s,this.type="scale"}}class Y{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.xScale=i,this.yScale=s,this.type="scale-stop"}}const z=k.transformGraphics,N={centerIndicator:new _({style:"cross",size:z.center.size,color:z.center.color}),fill:{default:new m({color:z.fill.color,outline:{color:z.fill.outlineColor,join:"round",width:1}}),active:new m({color:z.fill.stagedColor,outline:{color:z.fill.outlineColor,join:"round",style:"dash",width:1}})},handles:{default:new _({style:"square",size:z.vertex.size,color:z.vertex.color,outline:{color:z.vertex.outlineColor,width:1}}),hover:new _({style:"square",size:z.vertex.hoverSize,color:z.vertex.hoverColor,outline:{color:z.vertex.hoverOutlineColor,width:1}})},rotator:{default:new _({style:"circle",size:z.vertex.size,color:z.vertex.color,outline:{color:z.vertex.outlineColor,width:1}}),hover:new _({style:"circle",size:z.vertex.hoverSize,color:z.vertex.hoverColor,outline:{color:z.vertex.hoverOutlineColor,width:1}})},rotatorLine:new u({color:z.line.color,width:1})};let A=class extends i.EventedAccessor{constructor(t){super(t),this._activeHandleGraphic=null,this._graphicAttributes={esriSketchTool:"box"},this._handles=new s,this._mover=null,this._rotateGraphicOffset=20,this._angleOfRotation=0,this._rotateLineGraphic=null,this._startInfo=null,this._totalDx=0,this._totalDy=0,this._xScale=1,this._yScale=1,this.type="box",this.callbacks={onMoveStart(){},onMove(){},onMoveStop(){},onScaleStart(){},onScale(){},onScaleStop(){},onRotateStart(){},onRotate(){},onRotateStop(){},onGraphicClick(){}},this.centerGraphic=null,this.backgroundGraphic=null,this.enableMovement=!0,this.enableRotation=!0,this.enableScaling=!0,this.graphics=[],this.handleGraphics=[],this.layer=null,this.preserveAspectRatio=!1,this.rotateGraphic=null,this.showCenterGraphic=!0,this.view=null,this._getBounds=(()=>{const t=l();return(e,i)=>{e[0]=Number.POSITIVE_INFINITY,e[1]=Number.POSITIVE_INFINITY,e[2]=Number.NEGATIVE_INFINITY,e[3]=Number.NEGATIVE_INFINITY;for(const s of i){if(!s)continue;let i,r,a,o;if("point"===s.type)i=a=s.x,r=o=s.y;else if("multipoint"===s.type){const e=d(s);[i,r,a,o]=p(t,[e])}else if("extent"===s.type)[i,r,a,o]=[s.xmin,s.ymin,s.xmax,s.ymax];else{const e=d(s);[i,r,a,o]=p(t,e)}e[0]=Math.min(i,e[0]),e[1]=Math.min(r,e[1]),e[2]=Math.max(a,e[2]),e[3]=Math.max(o,e[3])}return e}})()}initialize(){this._highlightHelper=new S({view:this.view}),this._setup(),this._handles.add([o(this,"view.ready",(()=>{const{layer:t,view:e}=this;w(e,t)})),h(this,"preserveAspectRatio",(()=>{this._activeHandleGraphic&&(this._scaleGraphic(this._activeHandleGraphic),this._updateGraphics())})),h(this,"view.scale",(()=>{this._updateRotateGraphic(),this._updateRotateLineGraphic()})),h(this,"graphics",(()=>this.refresh())),h(this,"layer",((t,e)=>{e&&this._resetGraphics(e),this.refresh()}))])}destroy(){this._reset(),this._handles=r(this._handles)}set highlightsEnabled(t){var e;null==(e=this._highlightHelper)||e.removeAll(),this._set("highlightsEnabled",t),this._setUpHighlights()}get state(){const t=!!this.get("view.ready"),e=!(!this.get("graphics.length")||!this.get("layer"));return t&&e?"active":t?"ready":"disabled"}set symbols(t){const{centerIndicator:e=N.centerIndicator,fill:i=N.fill,handles:s=N.handles,rotator:r=N.rotator,rotatorLine:a=N.rotatorLine}=t||{};this._set("symbols",{centerIndicator:e,fill:i,handles:s,rotator:r,rotatorLine:a})}isUIGraphic(t){let e=[];return this.handleGraphics.length&&(e=e.concat(this.handleGraphics)),this.backgroundGraphic&&e.push(this.backgroundGraphic),this.centerGraphic&&e.push(this.centerGraphic),this.rotateGraphic&&e.push(this.rotateGraphic),this._rotateLineGraphic&&e.push(this._rotateLineGraphic),e.length&&e.includes(t)}move(t,e){if(this._mover&&this.graphics.length){for(const i of this.graphics){const s=i.geometry,r=v(s,t,e,this.view);i.geometry=r}this.refresh(),this._emitMoveStopEvent(t,e,null)}}scale(t,e){if(this._mover&&this.graphics.length){for(const i of this.graphics){const s=i.geometry,r=y(s,t,e);i.geometry=r}this.refresh(),this._emitScaleStopEvent(t,e,null)}}rotate(t,e){if(this._mover&&this.graphics.length){if(!e){const t=this.handleGraphics[1].geometry.x,i=this.handleGraphics[3].geometry.y;e=new x(t,i,this.view.spatialReference)}for(const i of this.graphics){const s=i.geometry,r=g(s,t,e);i.geometry=r}this.refresh(),this._emitRotateStopEvent(t,null)}}refresh(){this._reset(),this._setup()}reset(){this.graphics=[]}_setup(){"active"===this.state&&(this._setUpHighlights(),this._setupGraphics(),this._setupMover(),this._updateGraphics())}_reset(){this._highlightHelper.removeAll(),this._resetGraphicStateVars(),this._resetGraphics(),this._mover&&this._mover.destroy(),this._mover=null,this.view.cursor="default"}_resetGraphicStateVars(){this._startInfo=null,this._activeHandleGraphic=null,this._totalDx=0,this._totalDy=0,this._xScale=1,this._yScale=1,this._angleOfRotation=0}_resetGraphics(t){const e=t||this.layer;e&&(e.removeMany(this.handleGraphics),e.remove(this.backgroundGraphic),e.remove(this.centerGraphic),e.remove(this.rotateGraphic),e.remove(this._rotateLineGraphic));for(const i of this.handleGraphics)i.destroy();this._set("handleGraphics",[]),this.backgroundGraphic&&(this.backgroundGraphic.destroy(),this._set("backgroundGraphic",null)),this.centerGraphic&&(this.centerGraphic.destroy(),this._set("centerGraphic",null)),this.rotateGraphic&&(this.rotateGraphic.destroy(),this._set("rotateGraphic",null)),this._rotateLineGraphic&&(this._rotateLineGraphic.destroy(),this._rotateLineGraphic=null)}_setupMover(){let t=[];this.enableScaling&&(t=t.concat(this.handleGraphics)),this.enableMovement&&(t=t.concat(this.graphics,this.backgroundGraphic)),this.enableRotation&&t.push(this.rotateGraphic),this.showCenterGraphic&&t.push(this.centerGraphic),this._mover=new b({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,view:this.view,graphics:t,callbacks:{onGraphicClick:t=>this._onGraphicClickCallback(t),onGraphicMoveStart:t=>this._onGraphicMoveStartCallback(t),onGraphicMove:t=>this._onGraphicMoveCallback(t),onGraphicMoveStop:t=>this._onGraphicMoveStopCallback(t),onGraphicPointerOver:t=>this._onGraphicPointerOverCallback(t),onGraphicPointerOut:t=>this._onGraphicPointerOutCallback(t)}})}_getStartInfo(t){const[e,i,s,r]=this._getBoxBounds(l()),a=Math.abs(s-e),o=Math.abs(r-i),h=(s+e)/2,c=(r+i)/2,{x:n,y:p}=t.geometry;return{width:a,height:o,centerX:h,centerY:c,startX:n,startY:p,graphicInfos:this._getGraphicInfos(),box:this.backgroundGraphic.geometry,rotate:this.rotateGraphic.geometry}}_getGraphicInfos(){return this.graphics.map((t=>this._getGraphicInfo(t)))}_getGraphicInfo(t){const e=t.geometry,[i,s,r,a]=this._getBounds(l(),[e]);return{width:Math.abs(r-i),height:Math.abs(a-s),centerX:(r+i)/2,centerY:(a+s)/2,geometry:e}}_onGraphicClickCallback(t){t.viewEvent.stopPropagation(),this.emit("graphic-click",t),this.callbacks.onGraphicClick&&this.callbacks.onGraphicClick(t)}_onGraphicMoveStartCallback(t){const{_angleOfRotation:e,_xScale:i,_yScale:s,backgroundGraphic:r,handleGraphics:a,rotateGraphic:o,symbols:h}=this,c=t.graphic;this._resetGraphicStateVars(),this._hideGraphicsBeforeUpdate(),r.symbol=h.fill.active,this._startInfo=this._getStartInfo(c),c===o?(this.view.cursor="grabbing",this._emitRotateStartEvent(e,c)):a.includes(c)?(this._activeHandleGraphic=c,this._emitScaleStartEvent(i,s,c)):this._emitMoveStartEvent(t.dx,t.dy,c)}_onGraphicMoveCallback(t){const e=t.graphic;if(this._startInfo)if(this.handleGraphics.includes(e))this._scaleGraphic(e),this._emitScaleEvent(this._xScale,this._yScale,e);else if(e===this.rotateGraphic)this._rotateGraphic(e),this._emitRotateEvent(this._angleOfRotation,e);else{const i=t.dx,s=t.dy;this._totalDx+=i,this._totalDy+=s,this._moveGraphic(e,i,s),this._emitMoveEvent(i,s,e)}}_onGraphicMoveStopCallback(t){const e=t.graphic;if(!this._startInfo)return void this.refresh();const{_angleOfRotation:i,_totalDx:s,_totalDy:r,_xScale:a,_yScale:o,handleGraphics:h,rotateGraphic:c}=this;this.refresh(),e===c?(this.view.cursor="pointer",this._emitRotateStopEvent(i,e)):h.includes(e)?this._emitScaleStopEvent(a,o,e):this._emitMoveStopEvent(s,r,e)}_onGraphicPointerOverCallback(t){const{backgroundGraphic:e,handleGraphics:i,graphics:s,rotateGraphic:r,symbols:a,view:o}=this,h=t.graphic;if(h===r)return r.symbol=a.rotator.hover,void(o.cursor="pointer");if(s.includes(h)||h===e)return void(o.cursor="move");if(!i.includes(h))return void(o.cursor="pointer");t.graphic.symbol=a.handles.hover;const c=o.rotation;let n,l=t.index;switch(l<8&&(c>=0&&c<45?l%=8:l=c>=45&&c<90?(l+1)%8:c>=90&&c<135?(l+2)%8:c>=135&&c<180?(l+3)%8:c>=180&&c<225?(l+4)%8:c>=225&&c<270?(l+5)%8:c>=270&&c<315?(l+6)%8:(l+7)%8),l){case 0:case 4:n="nwse-resize";break;case 1:case 5:n="ns-resize";break;case 2:case 6:n="nesw-resize";break;case 3:case 7:n="ew-resize";break;default:n="pointer"}o.cursor=n}_onGraphicPointerOutCallback(t){const{handleGraphics:e,rotateGraphic:i,symbols:s,view:r}=this;t.graphic===i?i.symbol=s.rotator.default:e.includes(t.graphic)&&(t.graphic.symbol=s.handles.default),r.cursor="default"}_scaleGraphic(t){const{_startInfo:e,handleGraphics:i,preserveAspectRatio:s,view:r}=this,{centerX:a,centerY:o,startX:h,startY:c}=e,{resolution:n,transform:l}=r.state,p=i.indexOf(t);1!==p&&5!==p||this._updateX(t,a),3!==p&&7!==p||this._updateY(t,o);const{x:d,y:g}=t.geometry,m=l[0]*d+l[2]*g+l[4],u=l[1]*d+l[3]*g+l[5],_=e.graphicInfos.map((t=>t.geometry));if(s){const t=l[0]*a+l[2]*o+l[4],e=l[1]*a+l[3]*o+l[5],i=l[0]*h+l[2]*c+l[4],s=l[1]*h+l[3]*c+l[5];this._xScale=this._yScale=G(t,e,i,s,m,u);for(const r of _){const t=_.indexOf(r);this.graphics[t].geometry=y(r,this._xScale,this._yScale,[a,o])}this._updateBackgroundGraphic()}else{const{width:t,height:i}=e;let s=d-h,l=c-g;if(1===p||5===p?s=0:3!==p&&7!==p||(l=0),0===s&&0===l)return;const m=t+(h>a?s:-1*s),u=i+(c<o?l:-1*l),G=a+s/2,f=o+l/2;this._xScale=m/t||1,this._yScale=u/i||1,1===p||5===p?this._xScale=1:3!==p&&7!==p||(this._yScale=1);const b=(G-a)/n,S=(f-o)/n,w=y(e.box,this._xScale,this._yScale);this.backgroundGraphic.geometry=v(w,b,S,r,!0);const{centerX:k,centerY:R}=this._getGraphicInfo(this.backgroundGraphic),M=(k-a)/n,I=-1*(R-o)/n;for(const e of _){const t=_.indexOf(e),i=y(e,this._xScale,this._yScale,[a,o]);this.graphics[t].geometry=v(i,M,I,r,!0)}this.centerGraphic.geometry=new x(k,R,r.spatialReference)}}_rotateGraphic(t){const{centerX:e,centerY:i,startX:s,startY:r,box:a,rotate:o}=this._startInfo,h=new x(s,r,this.view.spatialReference),c=new x(e,i,this.view.spatialReference),n=t.geometry;this._angleOfRotation=f(h,n,c);const l=this._startInfo.graphicInfos.map((t=>t.geometry));for(const p of l){const t=l.indexOf(p),e=g(p,this._angleOfRotation,c);this.graphics[t].geometry=e}this.backgroundGraphic.geometry=g(a,this._angleOfRotation,c),this.rotateGraphic.geometry=g(o,this._angleOfRotation,c)}_moveGraphic(t,e,i){if(this.graphics.includes(t)){const s=this.backgroundGraphic.geometry;this.backgroundGraphic.geometry=v(s,e,i,this.view);for(const r of this.graphics)r!==t&&(r.geometry=v(r.geometry,e,i,this.view))}else if(t===this.centerGraphic){const t=this.backgroundGraphic.geometry;this.backgroundGraphic.geometry=v(t,e,i,this.view)}if(t===this.backgroundGraphic||t===this.centerGraphic)for(const s of this.graphics)s.geometry=v(s.geometry,e,i,this.view)}_setUpHighlights(){var t,e;this.highlightsEnabled&&null!=(t=this.graphics)&&t.length&&(null==(e=this._highlightHelper)||e.add(this.graphics))}_setupGraphics(){const{_graphicAttributes:t,symbols:i}=this;this._set("centerGraphic",new e(null,i.centerIndicator,t)),this.showCenterGraphic&&this.layer.add(this.centerGraphic),this._set("backgroundGraphic",new e(null,i.fill.default,t)),this.layer.add(this.backgroundGraphic),this._rotateLineGraphic=new e(null,i.rotatorLine,t),this._set("rotateGraphic",new e(null,i.rotator.default,t)),this.enableRotation&&!this._hasExtentGraphic()&&(this.layer.add(this._rotateLineGraphic),this.layer.add(this.rotateGraphic));for(let s=0;s<8;s++)this.handleGraphics.push(new e(null,i.handles.default,t));this.enableScaling&&this.layer.addMany(this.handleGraphics)}_updateGraphics(){this._updateBackgroundGraphic(),this._updateHandleGraphics(),this._updateCenterGraphic(),this._updateRotateGraphic(),this._updateRotateLineGraphic()}_hideGraphicsBeforeUpdate(){this.centerGraphic.visible=!1,this.rotateGraphic.visible=!1,this._rotateLineGraphic.visible=!1,this.handleGraphics.forEach((t=>t.visible=!1))}_updateHandleGraphics(){const t=this._getCoordinates(!0);this.handleGraphics.forEach(((e,i)=>{const[s,r]=t[i];this._updateXY(e,s,r)}))}_updateBackgroundGraphic(){const t=this._getCoordinates();this.backgroundGraphic.geometry=new R({rings:t,spatialReference:this.view.spatialReference})}_updateCenterGraphic(){const[t,e,i,s]=this._getBoxBounds(l()),r=(i+t)/2,a=(s+e)/2;this.centerGraphic.geometry=new x(r,a,this.view.spatialReference)}_updateRotateGraphic(){if(!this.handleGraphics.length)return;const{x:t,y:e}=this.handleGraphics[1].geometry,i=e+this.view.state.resolution*this._rotateGraphicOffset;this.rotateGraphic.geometry=new x(t,i,this.view.spatialReference)}_updateRotateLineGraphic(){if(!this.handleGraphics.length||!this.rotateGraphic||!this.rotateGraphic.geometry)return;const t=this.handleGraphics[1].geometry,e=this.rotateGraphic.geometry;this._rotateLineGraphic.geometry=new M({paths:[[t.x,t.y],[e.x,e.y]],spatialReference:this.view.spatialReference})}_updateXY(t,e,i){t.geometry=new x(e,i,this.view.spatialReference)}_updateX(t,e){const i=t.geometry.y;t.geometry=new x(e,i,this.view.spatialReference)}_updateY(t,e){const i=t.geometry.x;t.geometry=new x(i,e,this.view.spatialReference)}_hasExtentGraphic(){return this.graphics.some((t=>t&&a(t.geometry)&&"extent"===t.geometry.type))}_getBoxBounds(t){const e=this.graphics.map((t=>t.geometry));return this._getBounds(t,e)}_getCoordinates(t){const[e,i,s,r]=this._getBoxBounds(l());if(t){const t=(e+s)/2,a=(r+i)/2;return[[e,r],[t,r],[s,r],[s,a],[s,i],[t,i],[e,i],[e,a]]}return[[e,r],[s,r],[s,i],[e,i]]}_emitMoveStartEvent(t,e,i){const s=new I(this.graphics,i,t,e);this.emit("move-start",s),this.callbacks.onMoveStart&&this.callbacks.onMoveStart(s)}_emitMoveEvent(t,e,i){const s=new E(this.graphics,i,t,e);this.emit("move",s),this.callbacks.onMove&&this.callbacks.onMove(s)}_emitMoveStopEvent(t,e,i){const s=new C(this.graphics,i,t,e);this.emit("move-stop",s),this.callbacks.onMoveStop&&this.callbacks.onMoveStop(s)}_emitRotateStartEvent(t,e){const i=new O(this.graphics,e,t);this.emit("rotate-start",i),this.callbacks.onRotateStart&&this.callbacks.onRotateStart(i)}_emitRotateEvent(t,e){const i=new j(this.graphics,e,t);this.emit("rotate",i),this.callbacks.onRotate&&this.callbacks.onRotate(i)}_emitRotateStopEvent(t,e){const i=new L(this.graphics,e,t);this.emit("rotate-stop",i),this.callbacks.onRotateStop&&this.callbacks.onRotateStop(i)}_emitScaleStartEvent(t,e,i){const s=new B(this.graphics,i,t,e);this.emit("scale-start",s),this.callbacks.onScaleStart&&this.callbacks.onScaleStart(s)}_emitScaleEvent(t,e,i){const s=new H(this.graphics,i,t,e);this.emit("scale",s),this.callbacks.onScale&&this.callbacks.onScale(s)}_emitScaleStopEvent(t,e,i){const s=new Y(this.graphics,i,t,e);this.emit("scale-stop",s),this.callbacks.onScaleStop&&this.callbacks.onScaleStop(s)}};t([c()],A.prototype,"_rotateLineGraphic",void 0),t([c({readOnly:!0})],A.prototype,"type",void 0),t([c()],A.prototype,"callbacks",void 0),t([c({readOnly:!0})],A.prototype,"centerGraphic",void 0),t([c({readOnly:!0})],A.prototype,"backgroundGraphic",void 0),t([c()],A.prototype,"enableMovement",void 0),t([c()],A.prototype,"enableRotation",void 0),t([c()],A.prototype,"enableScaling",void 0),t([c()],A.prototype,"graphics",void 0),t([c({readOnly:!0})],A.prototype,"handleGraphics",void 0),t([c({value:!0})],A.prototype,"highlightsEnabled",null),t([c()],A.prototype,"layer",void 0),t([c()],A.prototype,"preserveAspectRatio",void 0),t([c({readOnly:!0})],A.prototype,"rotateGraphic",void 0),t([c()],A.prototype,"showCenterGraphic",void 0),t([c({readOnly:!0})],A.prototype,"state",null),t([c({value:N})],A.prototype,"symbols",null),t([c()],A.prototype,"view",void 0),A=t([n("esri.views.draw.support.Box")],A);const P=A;export{P as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as i}from"../../../chunks/tslib.es6.js";import"../../../symbols.js";import t from"../../../core/Evented.js";import e from"../../../core/Handles.js";import{clone as s}from"../../../core/lang.js";import{destroyMaybe as r,isSome as a,isNone as o}from"../../../core/maybe.js";import{watch as h}from"../../../core/reactiveUtils.js";import{watch as c,whenOnce as n}from"../../../core/watchUtils.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import d from"../../../layers/GraphicsLayer.js";import{cloneMove as m}from"./drawUtils.js";import{addUniqueLayer as v}from"./layerUtils.js";import{GraphicClickEvent as y,GraphicDoubleClickEvent as _,GraphicPointerDownEvent as f,GraphicPointerUpEvent as u,GraphicPointerOutEvent as g,GraphicMoveStartEvent as G,GraphicMoveEvent as w,GraphicMoveStopEvent as b,GraphicPointerOverEvent as k}from"./input/GraphicMoverEvents.js";import{ViewEventPriorities as O}from"../../input/InputManager.js";import{GraphicManipulator as M}from"../../interactive/GraphicManipulator.js";import{createScreenPointFromEvent as x}from"../../support/screenUtils.js";import E from"../../../symbols/SimpleMarkerSymbol.js";import j from"../../../symbols/SimpleLineSymbol.js";import H from"../../../symbols/SimpleFillSymbol.js";const P="indicator-symbols";let U=class extends t.EventedAccessor{constructor(i){super(i),this._activeGraphic=null,this._indicators=[],this._dragEvent=null,this._handles=new e,this._hoverGraphic=null,this._initialDragGeometry=null,this._viewHandles=new e,this._manipulators=[],this._layerViews=null,this.type="graphic-mover",this.callbacks={onGraphicClick(){},onGraphicDoubleClick(){},onGraphicMoveStart(){},onGraphicMove(){},onGraphicMoveStop(){},onGraphicPointerOver(){},onGraphicPointerOut(){},onGraphicPointerDown(){},onGraphicPointerUp(){}},this.enableMoveAllGraphics=!1,this.graphics=[],this.indicatorsEnabled=!0,this.layer=new d({listMode:"hide",internal:!0,title:"GraphicMover highlight layer"}),this.view=null}initialize(){v(this.view,this.layer),this.refresh(),this._handles.add([c(this,["graphics","graphics.length"],(()=>this.refresh())),n(this,"view.ready",(()=>{this._viewHandles.add([this.view.on("immediate-click",(i=>this._clickHandler(i)),O.TOOL),this.view.on("double-click",(i=>this._doubleClickHandler(i)),O.TOOL),this.view.on("pointer-down",(i=>this._pointerDownHandler(i)),O.TOOL),this.view.on("pointer-move",(i=>this._pointerMoveHandler(i)),O.TOOL),this.view.on("pointer-up",(i=>this._pointerUpHandler(i)),O.TOOL),this.view.on("drag",(i=>this._dragHandler(i)),O.TOOL),this.view.on("key-down",(i=>this._keyDownHandler(i)),O.TOOL)])}))])}destroy(){var i;this._removeIndicators(),null==(i=this.view.map)||i.remove(this.layer),this.layer.destroy(),this.reset(),this._manipulators.forEach((i=>i.destroy())),this._manipulators=null,this._handles=r(this._handles),this._viewHandles=r(this._viewHandles)}get state(){const i=!!this.get("view.ready"),t=!!this.get("graphics.length"),e=this._activeGraphic;return i&&t?e?"moving":"active":i?"ready":"disabled"}refresh(){this._setUpIndicators(),this._setUpManipulators(),this._syncLayerViews()}reset(){this._activeGraphic=null,this._hoverGraphic=null,this._dragEvent=null}updateGeometry(i,t){const e=this.graphics[i];e&&(e.set("geometry",t),this._setUpIndicators())}_clickHandler(i){const t=this._findTargetGraphic(x(i));if(t){const e=new y(t,this.graphics.indexOf(t),i.x,i.y,i);this.emit("graphic-click",e),this.callbacks.onGraphicClick&&this.callbacks.onGraphicClick(e)}}_doubleClickHandler(i){const t=this._findTargetGraphic(x(i));if(t){const e=new _(t,this.graphics.indexOf(t),i.x,i.y,i);this.emit("graphic-double-click",e),this.callbacks.onGraphicDoubleClick&&this.callbacks.onGraphicDoubleClick(e)}}_pointerDownHandler(i){const t=this._findTargetGraphic(x(i));if(t){this._activeGraphic=t;const{x:e,y:s}=i,r=new f(t,this.graphics.indexOf(t),e,s,i);this.emit("graphic-pointer-down",r),this.callbacks.onGraphicPointerDown&&this.callbacks.onGraphicPointerDown(r)}else this._activeGraphic=null}_pointerUpHandler(i){if(this._activeGraphic){const{x:t,y:e}=i,s=this.graphics.indexOf(this._activeGraphic),r=new u(this._activeGraphic,s,t,e,i);this.emit("graphic-pointer-up",r),this.callbacks.onGraphicPointerUp&&this.callbacks.onGraphicPointerUp(r)}}_pointerMoveHandler(i){if(this._dragEvent)return;const t=this._findTargetGraphic(x(i));if(t){const{x:e,y:s}=i;if(this._hoverGraphic){if(this._hoverGraphic===t)return;const r=this.graphics.indexOf(this._hoverGraphic),a=new g(this.graphics[r],r,e,s,i);this._hoverGraphic=null,this.emit("graphic-pointer-out",a),this.callbacks.onGraphicPointerOut&&this.callbacks.onGraphicPointerOut(a)}const r=this.graphics.indexOf(t),a=new k(t,r,e,s,i);return this._hoverGraphic=t,this.emit("graphic-pointer-over",a),void(this.callbacks.onGraphicPointerOver&&this.callbacks.onGraphicPointerOver(a))}if(this._hoverGraphic){const{x:t,y:e}=i,s=this.graphics.indexOf(this._hoverGraphic),r=new g(this.graphics[s],s,t,e,i);this._hoverGraphic=null,this.emit("graphic-pointer-out",r),this.callbacks.onGraphicPointerOut&&this.callbacks.onGraphicPointerOut(r)}}_dragHandler(i){if("start"!==i.action&&!this._dragEvent||!this._activeGraphic||!this._activeGraphic.geometry)return;"start"===i.action&&this._removeIndicators(),i.stopPropagation();const{action:t,x:e,y:r}=i,a=this.graphics.indexOf(this._activeGraphic),o=this._dragEvent?e-this._dragEvent.x:0,h=this._dragEvent?r-this._dragEvent.y:0,c=e-i.origin.x,n=r-i.origin.y,l="start"===t?this._activeGraphic.geometry:this._initialDragGeometry,p=m(l,c,n,this.view);if(this._activeGraphic.geometry=p,this.enableMoveAllGraphics&&this.graphics.forEach((i=>{i!==this._activeGraphic&&(i.geometry=m(i.geometry,o,h,this.view))})),this._dragEvent=i,"start"===t){this._initialDragGeometry=s(l);const t=new G(this._activeGraphic,this.graphics,a,e,r,o,h,c,n,i);this.emit("graphic-move-start",t),this.callbacks.onGraphicMoveStart&&this.callbacks.onGraphicMoveStart(t),t.defaultPrevented&&this._activeGraphic.set("geometry",l)}else if("update"===t){const t=new w(this._activeGraphic,this.graphics,a,e,r,o,h,c,n,i);this.emit("graphic-move",t),this.callbacks.onGraphicMove&&this.callbacks.onGraphicMove(t),t.defaultPrevented&&(this._activeGraphic.geometry=l)}else{const t=new b(this._activeGraphic,this.graphics,a,e,r,o,h,c,n,i);this._dragEvent=null,this._activeGraphic=null,this._setUpIndicators(),this.emit("graphic-move-stop",t),this.callbacks.onGraphicMoveStop&&this.callbacks.onGraphicMoveStop(t),t.defaultPrevented&&(this.graphics[a].set("geometry",this._initialDragGeometry),this._setUpIndicators()),this._initialDragGeometry=null}}_keyDownHandler(i){"a"!==i.key&&"d"!==i.key&&"n"!==i.key||"moving"!==this.state||i.stopPropagation()}_findTargetGraphic(i){const t=this.view.toMap(i);let e=null,s=Number.MAX_VALUE;this._syncLayerViews();const r=this._layerViews.flatMap((i=>"graphicsViews"in i?Array.from(i.graphicsViews(),(i=>i.hitTest(t))).flat():i.graphicsView.hitTest(t))).filter((i=>this.graphics.indexOf(i)>-1));return r.length?r[0]:(this._manipulators.forEach((t=>{const r=t.intersectionDistance(i);a(r)&&r<s&&(s=r,e=t.graphic)})),e)}_syncLayerViews(){this._layerViews=[];const i=new Set;for(const t of this.graphics){const e=this.view.allLayerViews.find((i=>{const e=i.layer;return"sublayers"in e&&a(e.sublayers)&&!!e.sublayers.find((i=>i===t.layer))||e===t.layer}));e&&i.add(e)}this._layerViews=[...i]}_setUpManipulators(){const{graphics:i,view:t}=this;this._manipulators.forEach((i=>i.destroy())),this._manipulators=null!=i&&i.length?i.map((i=>new M({graphic:i,view:t}))):[]}_setUpIndicators(){if(this._removeIndicators(),this.indicatorsEnabled){for(const i of this.graphics){const t=i.clone();t.symbol=this._getSymbolForIndicator(i),this._indicators.push(t),this._handles.add(h((()=>i.symbol),(()=>this._setUpIndicators())),P)}this.layer.addMany(this._indicators)}}_removeIndicators(){this._handles.remove(P),this._indicators.length&&(this.layer.removeMany(this._indicators),this._indicators.forEach((i=>i.destroy())),this._indicators=[])}_getSymbolForIndicator(i){const t=12;if(o(i.symbol))return null;switch(i.symbol.type){case"cim":return new E({style:"circle",size:t,color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}});case"picture-marker":{const{xoffset:t,yoffset:e,height:s,width:r}=i.symbol,a=s===r?r:Math.max(s,r);return new E({xoffset:t,yoffset:e,size:a,style:"square",color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}})}case"simple-marker":{const{xoffset:t,yoffset:e,size:s,style:r}=i.symbol;return new E({xoffset:t,yoffset:e,style:"circle"===r?"circle":"square",size:s+2,color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}})}case"simple-fill":return new H({color:[0,0,0,0],outline:{style:"dash",color:[255,127,0,1],width:1}});case"simple-line":return new j({color:[255,127,0,1],style:"dash",width:1});case"text":{const{xoffset:e,yoffset:s}=i.symbol;return new E({xoffset:e,yoffset:s,size:t,color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}})}default:return null}}};i([l()],U.prototype,"_activeGraphic",void 0),i([l({readOnly:!0})],U.prototype,"type",void 0),i([l()],U.prototype,"callbacks",void 0),i([l()],U.prototype,"enableMoveAllGraphics",void 0),i([l()],U.prototype,"graphics",void 0),i([l()],U.prototype,"indicatorsEnabled",void 0),i([l()],U.prototype,"layer",void 0),i([l({readOnly:!0})],U.prototype,"state",null),i([l()],U.prototype,"view",void 0),U=i([p("esri.views.draw.support.GraphicMover")],U);const S=U;export{S as default};
|
|
5
|
+
import{_ as i}from"../../../chunks/tslib.es6.js";import"../../../symbols.js";import t from"../../../core/Evented.js";import e from"../../../core/Handles.js";import{clone as s}from"../../../core/lang.js";import{destroyMaybe as r,isNone as h,isSome as a}from"../../../core/maybe.js";import{watch as o}from"../../../core/reactiveUtils.js";import{watch as c,whenOnce as n}from"../../../core/watchUtils.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import d from"../../../layers/GraphicsLayer.js";import{cloneMove as v}from"./drawUtils.js";import g from"./HighlightHelper.js";import{addUniqueLayer as m,findLayerView as _}from"./layerUtils.js";import{GraphicClickEvent as y,GraphicDoubleClickEvent as u,GraphicPointerDownEvent as f,GraphicPointerUpEvent as w,GraphicPointerOutEvent as G,GraphicMoveStartEvent as b,GraphicMoveEvent as k,GraphicMoveStopEvent as O,GraphicPointerOverEvent as H}from"./input/GraphicMoverEvents.js";import{ViewEventPriorities as M}from"../../input/InputManager.js";import{GraphicManipulator as x}from"../../interactive/GraphicManipulator.js";import{createScreenPointFromEvent as E}from"../../support/screenUtils.js";import j from"../../../symbols/SimpleMarkerSymbol.js";import U from"../../../symbols/SimpleLineSymbol.js";import P from"../../../symbols/SimpleFillSymbol.js";const S="indicator-symbols";let D=class extends t.EventedAccessor{constructor(i){super(i),this._activeGraphic=null,this._dragEvent=null,this._handles=new e,this._hoverGraphic=null,this._indicators=[],this._initialDragGeometry=null,this._viewHandles=new e,this._manipulators=[],this._layerViews=null,this.type="graphic-mover",this.callbacks={onGraphicClick(){},onGraphicDoubleClick(){},onGraphicMoveStart(){},onGraphicMove(){},onGraphicMoveStop(){},onGraphicPointerOver(){},onGraphicPointerOut(){},onGraphicPointerDown(){},onGraphicPointerUp(){}},this.enableMoveAllGraphics=!1,this.graphics=[],this.indicatorsEnabled=!1,this.layer=new d({listMode:"hide",internal:!0,title:"GraphicMover highlight layer"}),this.view=null}initialize(){m(this.view,this.layer),this._highlightHelper=new g({view:this.view}),this.refresh(),this._handles.add([c(this,["graphics","graphics.length"],(()=>this.refresh())),n(this,"view.ready",(()=>{this._viewHandles.add([this.view.on("immediate-click",(i=>this._clickHandler(i)),M.TOOL),this.view.on("double-click",(i=>this._doubleClickHandler(i)),M.TOOL),this.view.on("pointer-down",(i=>this._pointerDownHandler(i)),M.TOOL),this.view.on("pointer-move",(i=>this._pointerMoveHandler(i)),M.TOOL),this.view.on("pointer-up",(i=>this._pointerUpHandler(i)),M.TOOL),this.view.on("drag",(i=>this._dragHandler(i)),M.TOOL),this.view.on("key-down",(i=>this._keyDownHandler(i)),M.TOOL)])})),o((()=>this.view),(i=>{this._highlightHelper.removeAll(),this._highlightHelper.view=i}))])}destroy(){var i;this._removeIndicators(),null==(i=this.view.map)||i.remove(this.layer),this.layer.destroy(),this.reset(),this._manipulators.forEach((i=>i.destroy())),this._manipulators=null,this._handles=r(this._handles),this._viewHandles=r(this._viewHandles)}set highlightsEnabled(i){var t,e;(null==(t=this._highlightHelper)||t.removeAll(),this._set("highlightsEnabled",i),i)&&(null==(e=this._highlightHelper)||e.add(this.graphics))}get state(){const i=!!this.get("view.ready"),t=!!this.get("graphics.length"),e=this._activeGraphic;return i&&t?e?"moving":"active":i?"ready":"disabled"}refresh(){this.reset(),this._setup()}reset(){this._activeGraphic=null,this._hoverGraphic=null,this._dragEvent=null,this._highlightHelper.removeAll()}updateGeometry(i,t){const e=this.graphics[i];e&&(e.set("geometry",t),this._setUpIndicators())}_setup(){this._setUpHighlights(),this._setUpIndicators(),this._setUpManipulators(),this._syncLayerViews()}_clickHandler(i){const t=this._findTargetGraphic(E(i));if(t){const e=new y(t,this.graphics.indexOf(t),i.x,i.y,i);this.emit("graphic-click",e),this.callbacks.onGraphicClick&&this.callbacks.onGraphicClick(e)}}_doubleClickHandler(i){const t=this._findTargetGraphic(E(i));if(t){const e=new u(t,this.graphics.indexOf(t),i.x,i.y,i);this.emit("graphic-double-click",e),this.callbacks.onGraphicDoubleClick&&this.callbacks.onGraphicDoubleClick(e)}}_pointerDownHandler(i){const t=this._findTargetGraphic(E(i));if(t){this._activeGraphic=t;const{x:e,y:s}=i,r=new f(t,this.graphics.indexOf(t),e,s,i);this.emit("graphic-pointer-down",r),this.callbacks.onGraphicPointerDown&&this.callbacks.onGraphicPointerDown(r)}else this._activeGraphic=null}_pointerUpHandler(i){if(this._activeGraphic){const{x:t,y:e}=i,s=this.graphics.indexOf(this._activeGraphic),r=new w(this._activeGraphic,s,t,e,i);this.emit("graphic-pointer-up",r),this.callbacks.onGraphicPointerUp&&this.callbacks.onGraphicPointerUp(r)}}_pointerMoveHandler(i){if(this._dragEvent)return;const t=this._findTargetGraphic(E(i));if(t){const{x:e,y:s}=i;if(this._hoverGraphic){if(this._hoverGraphic===t)return;const r=this.graphics.indexOf(this._hoverGraphic),h=new G(this.graphics[r],r,e,s,i);this._hoverGraphic=null,this.emit("graphic-pointer-out",h),this.callbacks.onGraphicPointerOut&&this.callbacks.onGraphicPointerOut(h)}const r=this.graphics.indexOf(t),h=new H(t,r,e,s,i);return this._hoverGraphic=t,this.emit("graphic-pointer-over",h),void(this.callbacks.onGraphicPointerOver&&this.callbacks.onGraphicPointerOver(h))}if(this._hoverGraphic){const{x:t,y:e}=i,s=this.graphics.indexOf(this._hoverGraphic),r=new G(this.graphics[s],s,t,e,i);this._hoverGraphic=null,this.emit("graphic-pointer-out",r),this.callbacks.onGraphicPointerOut&&this.callbacks.onGraphicPointerOut(r)}}_dragHandler(i){if("start"!==i.action&&!this._dragEvent||!this._activeGraphic||!this._activeGraphic.geometry)return;"start"===i.action&&this._removeIndicators(),i.stopPropagation();const{action:t,x:e,y:r}=i,h=this.graphics.indexOf(this._activeGraphic),a=this._dragEvent?e-this._dragEvent.x:0,o=this._dragEvent?r-this._dragEvent.y:0,c=e-i.origin.x,n=r-i.origin.y,l="start"===t?this._activeGraphic.geometry:this._initialDragGeometry,p=v(l,c,n,this.view);if(this._activeGraphic.geometry=p,this.enableMoveAllGraphics&&this.graphics.forEach((i=>{i!==this._activeGraphic&&(i.geometry=v(i.geometry,a,o,this.view))})),this._dragEvent=i,"start"===t){this._initialDragGeometry=s(l);const t=new b(this._activeGraphic,this.graphics,h,e,r,a,o,c,n,i);this.emit("graphic-move-start",t),this.callbacks.onGraphicMoveStart&&this.callbacks.onGraphicMoveStart(t),t.defaultPrevented&&this._activeGraphic.set("geometry",l)}else if("update"===t){const t=new k(this._activeGraphic,this.graphics,h,e,r,a,o,c,n,i);this.emit("graphic-move",t),this.callbacks.onGraphicMove&&this.callbacks.onGraphicMove(t),t.defaultPrevented&&(this._activeGraphic.geometry=l)}else{const t=new O(this._activeGraphic,this.graphics,h,e,r,a,o,c,n,i);this._dragEvent=null,this._activeGraphic=null,this._setUpIndicators(),this.emit("graphic-move-stop",t),this.callbacks.onGraphicMoveStop&&this.callbacks.onGraphicMoveStop(t),t.defaultPrevented&&(this.graphics[h].set("geometry",this._initialDragGeometry),this._setUpIndicators()),this._initialDragGeometry=null}}_keyDownHandler(i){"a"!==i.key&&"d"!==i.key&&"n"!==i.key||"moving"!==this.state||i.stopPropagation()}_findTargetGraphic(i){const t=this.view.toMap(i);let e=null,s=Number.MAX_VALUE;this._syncLayerViews();const r=this._layerViews.flatMap((i=>"graphicsViews"in i?Array.from(i.graphicsViews(),(i=>i.hitTest(t))).flat():i.graphicsView.hitTest(t))).filter((i=>this.graphics.indexOf(i)>-1));return r.length?r[0]:(this._manipulators.forEach((t=>{const r=t.intersectionDistance(i);a(r)&&r<s&&(s=r,e=t.graphic)})),e)}_syncLayerViews(){this._layerViews=[];const i=new Set;for(const t of this.graphics){const e=_(this.view,t.layer);e&&i.add(e)}this._layerViews=[...i]}_setUpManipulators(){const{graphics:i,view:t}=this;this._manipulators.forEach((i=>i.destroy())),this._manipulators=null!=i&&i.length?i.map((i=>new x({graphic:i,view:t}))):[]}_setUpHighlights(){this.highlightsEnabled&&this._highlightHelper.add(this.graphics)}_setUpIndicators(){if(this._removeIndicators(),this.indicatorsEnabled){for(const i of this.graphics){const t=i.clone();t.symbol=this._getSymbolForIndicator(i),this._indicators.push(t),this._handles.add(o((()=>i.symbol),(()=>this._setUpIndicators())),S)}this.layer.addMany(this._indicators)}}_removeIndicators(){this._handles.remove(S),this._indicators.length&&(this.layer.removeMany(this._indicators),this._indicators.forEach((i=>i.destroy())),this._indicators=[])}_getSymbolForIndicator(i){const t=12;if(h(i.symbol))return null;switch(i.symbol.type){case"cim":return new j({style:"circle",size:t,color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}});case"picture-marker":{const{xoffset:t,yoffset:e,height:s,width:r}=i.symbol,h=s===r?r:Math.max(s,r);return new j({xoffset:t,yoffset:e,size:h,style:"square",color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}})}case"simple-marker":{const{xoffset:t,yoffset:e,size:s,style:r}=i.symbol;return new j({xoffset:t,yoffset:e,style:"circle"===r?"circle":"square",size:s+2,color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}})}case"simple-fill":return new P({color:[0,0,0,0],outline:{style:"dash",color:[255,127,0,1],width:1}});case"simple-line":return new U({color:[255,127,0,1],style:"dash",width:1});case"text":{const{xoffset:e,yoffset:s}=i.symbol;return new j({xoffset:e,yoffset:s,size:t,color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}})}default:return null}}};i([l()],D.prototype,"_activeGraphic",void 0),i([l({readOnly:!0})],D.prototype,"type",void 0),i([l()],D.prototype,"callbacks",void 0),i([l()],D.prototype,"enableMoveAllGraphics",void 0),i([l()],D.prototype,"graphics",void 0),i([l({value:!1})],D.prototype,"highlightsEnabled",null),i([l()],D.prototype,"indicatorsEnabled",void 0),i([l()],D.prototype,"layer",void 0),i([l({readOnly:!0})],D.prototype,"state",null),i([l()],D.prototype,"view",void 0),D=i([p("esri.views.draw.support.GraphicMover")],D);const T=D;export{T as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{_ as r}from"../../../chunks/tslib.es6.js";import{HandleOwner as e}from"../../../core/HandleOwner.js";import{property as t}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{findLayerView as o}from"./layerUtils.js";import{highlightsSupported as i}from"../../support/layerViewUtils.js";let l=class extends e{constructor(r){super(r),this.view=null}get count(){return this.handles.size}add(r){const e=Array.isArray(r)?r:[r];null!=r&&e&&e.length&&e.forEach((r=>this._highlight(r)))}remove(r){const e=Array.isArray(r)?r:[r];null!=r&&e&&e.length&&e.forEach((r=>this._unhighlight(r)))}removeAll(){this.handles.removeAll()}_highlight(r){const e=o(this.view,r.layer);i(e)&&this.handles.add(e.highlight(r),`feature-${r.getObjectId()}`)}_unhighlight(r){r&&this.handles.remove(`feature-${r.getObjectId()}`)}};r([t({readOnly:!0})],l.prototype,"count",null),r([t()],l.prototype,"view",void 0),r([t()],l.prototype,"add",null),l=r([s("esri.views.draw.support.HighlightHelper")],l);const h=l;export{h as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import t from"../../../Graphic.js";import i from"../../../core/Collection.js";import s from"../../../core/Error.js";import r from"../../../core/Evented.js";import o from"../../../core/Handles.js";import n from"../../../core/Logger.js";import{destroyMaybe as a,isNone as h,isSome as c,abortMaybe as p,get as l}from"../../../core/maybe.js";import{createTask as d}from"../../../core/promiseUtils.js";import{whenOnce as m,pausable as v}from"../../../core/watchUtils.js";import{property as y}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import{geometryToCoordinates as g,getMidpoint as u}from"../../../geometry/support/coordsUtils.js";import x from"../../../layers/GraphicsLayer.js";import f from"../../../symbols/SimpleMarkerSymbol.js";import{ViewingMode as G}from"../../ViewingMode.js";import{SnappingVisualizer2D as b}from"../../2d/interactive/SnappingVisualizer2D.js";import{cloneMove as V}from"./drawUtils.js";import M from"./GraphicMover.js";import{addUniqueLayer as w}from"./layerUtils.js";import{settings as S}from"./settings.js";import{ViewEventPriorities as k}from"../../input/InputManager.js";import{SKETCH_KEYS as E}from"../../interactive/keybindings.js";import{EditGeometryOperations as I}from"../../interactive/editGeometry/EditGeometryOperations.js";import{SnappingContext as O}from"../../interactive/snapping/SnappingContext.js";import C from"../../../geometry/Polyline.js";import R from"../../../geometry/Point.js";class j{constructor(e,t,i){this.graphic=e,this.mover=t,this.selected=i,this.type="reshape-start"}}class H{constructor(e,t,i){this.graphic=e,this.mover=t,this.selected=i,this.type="reshape"}}class A{constructor(e,t,i){this.graphic=e,this.mover=t,this.selected=i,this.type="reshape-stop"}}class T{constructor(e,t,i){this.mover=e,this.dx=t,this.dy=i,this.type="move-start"}}class U{constructor(e,t,i){this.mover=e,this.dx=t,this.dy=i,this.type="move"}}class D{constructor(e,t,i){this.mover=e,this.dx=t,this.dy=i,this.type="move-stop"}}class F{constructor(e){this.added=e,this.type="vertex-select"}}class z{constructor(e){this.removed=e,this.type="vertex-deselect"}}class L{constructor(e,t,i,s){this.added=e,this.graphic=t,this.oldGraphic=i,this.vertices=s,this.type="vertex-add"}}class P{constructor(e,t,i,s){this.removed=e,this.graphic=t,this.oldGraphic=i,this.vertices=s,this.type="vertex-remove"}}const K=S.reshapeGraphics,N={vertices:{default:new f({style:"circle",size:K.vertex.size,color:K.vertex.color,outline:{color:K.vertex.outlineColor,width:1}}),hover:new f({style:"circle",size:K.vertex.hoverSize,color:K.vertex.hoverColor,outline:{color:K.vertex.hoverOutlineColor,width:1}}),selected:new f({style:"circle",size:K.selected.size,color:K.selected.color,outline:{color:K.selected.outlineColor,width:1}})},midpoints:{default:new f({style:"circle",size:K.midpoint.size,color:K.midpoint.color,outline:{color:K.midpoint.outlineColor,width:1}}),hover:new f({style:"circle",size:K.midpoint.size,color:K.midpoint.color,outline:{color:K.midpoint.outlineColor,width:1}})}},q="esri.views.draw.support.Reshape",B=n.getLogger(q);let J=class extends r.EventedAccessor{constructor(e){super(e),this._activeOperationInfo=null,this._editGeometryOperations=null,this._handles=new o,this._graphicAttributes={esriSketchTool:"box"},this._mover=null,this._snappingTask=null,this._stagedVertex=null,this._viewHandles=new o,this.callbacks={onReshapeStart(){},onReshape(){},onReshapeStop(){},onMoveStart(){},onMove(){},onMoveStop(){},onGraphicClick(){}},this.enableMidpoints=!0,this.enableMovement=!0,this.enableVertices=!0,this.graphic=null,this.vertexGraphics=new i,this.layer=null,this.midpointGraphics=new i,this.midpointSymbol=new f({style:"circle",size:6,color:[200,200,200],outline:{color:[100,100,100],width:1}}),this.selectedVertices=[],this.snappingManager=null,this.type="reshape",this.view=null}initialize(){this._setup(),this._handles.add([m(this,"view.ready",(()=>{const{layer:e,view:t}=this;w(t,e),this._viewHandles.add([t.on("key-down",(e=>this._keyDownHandler(e)),k.TOOL)])})),v(this,"graphic",(()=>this.refresh())),v(this,"layer",((e,t)=>{t&&(this._clearSelection(),this._resetGraphics(t)),this.refresh()})),v(this,"enableMidpoints",(()=>{this.refresh()}))])}destroy(){var e;this._reset(),null==(e=this._mover)||e.destroy(),this._mover=null,this._handles=a(this._handles),this._viewHandles=a(this._viewHandles)}get state(){const e=!!this.get("view.ready"),t=!(!this.get("graphic")||!this.get("layer"));return e&&t?"active":e?"ready":"disabled"}set symbols(e){const{midpoints:t=N.midpoints,vertices:i=N.vertices}=e||{};this._set("symbols",{midpoints:t,vertices:i})}isUIGraphic(e){const t=[];return this.graphic&&t.push(this.graphic),t.concat(this.vertexGraphics.items,this.midpointGraphics.items),t.length&&t.includes(e)}refresh(){this._reset(),this._setup()}reset(){this.graphic=null}clearSelection(){this._clearSelection()}removeSelectedVertices(){this.selectedVertices.length&&this._removeVertices(this.selectedVertices)}_setup(){const{graphic:e,layer:t}=this;if(!t||!e||h(e.geometry))return;const i=e.geometry;"mesh"!==i.type&&"extent"!==i.type?(this._setupGraphics(),this._setupMover()):this._logGeometryTypeError()}_setUpGeometryHelper(){const e=this.graphic.geometry;if(h(e)||"mesh"===e.type||"extent"===e.type)return void this._logGeometryTypeError();const t="multipoint"===e.type?new C({paths:e.points,spatialReference:e.spatialReference}):e;this._editGeometryOperations=I.fromGeometry(t,G.Local)}_saveSnappingContextForHandle(e,t){var i;this._snappingGraphicsLayer=new x({listMode:"hide",internal:!0,title:"Reshape snapping layer"}),this.view.map.layers.add(this._snappingGraphicsLayer),this._snappingContext=new O({editGeometryOperations:this._editGeometryOperations,elevationInfo:{mode:"on-the-ground",offset:0},pointer:(null==(i=t.viewEvent)?void 0:i.pointerType)||"mouse",excludeFeature:this.graphic,visualizer:new b(this._snappingGraphicsLayer),vertexHandle:this._getVertexFromEditGeometry(e)})}_reset(){this._clearSelection(),this._resetGraphics(),this._resetSnappingStateVars(),this._activeOperationInfo=null,this._mover&&this._mover.destroy(),this._mover=null,this.view.cursor="default"}_resetSnappingStateVars(){c(this.snappingManager)&&this.snappingManager.doneSnapping(),c(this._snappingGraphicsLayer)&&(this.view.map.layers.remove(this._snappingGraphicsLayer),this._snappingGraphicsLayer.destroy()),this._editGeometryOperations=a(this._editGeometryOperations),this._snappingTask=p(this._snappingTask),this._snappingTask=null,this._snappingContext=null,this._stagedVertex=null}_resetGraphics(e){this._removeMidpointGraphics(e),this._removeVertexGraphics(e),this._set("selectedVertices",[])}_removeMidpointGraphics(e){const t=e||this.layer;t&&t.removeMany(this.midpointGraphics.items),this.midpointGraphics.items.forEach((e=>e.destroy())),this.midpointGraphics.removeAll()}_removeVertexGraphics(e){const t=e||this.layer;t&&t.removeMany(this.vertexGraphics.items),this.vertexGraphics.items.forEach((e=>e.destroy())),this.vertexGraphics.removeAll()}_getCoordinatesForUI(e){const t=g(e.clone());if("polygon"===e.type)for(const i of t){const e=i[i.length-1];i[0][0]===e[0]&&i[0][1]===e[1]&&i.length>2&&i.pop()}return t}_setupGraphics(){const e=this.graphic.geometry;if(c(e)&&("polyline"===e.type||"polygon"===e.type)){const t=this._getCoordinatesForUI(e);this.enableMidpoints&&this._setUpMidpointGraphics(t),this.enableVertices&&this._setUpVertexGraphics(t)}}_setUpMidpointGraphics(e){this._removeMidpointGraphics();const t=this._createMidpointGraphics(e);this.midpointGraphics.addMany(t),this.layer.addMany(t)}_setUpVertexGraphics(e){this._removeVertexGraphics();const t=this._createVertexGraphics(e);this.vertexGraphics.addMany(t),this._storeRelatedVertexIndices(),this.layer.addMany(t)}_createVertexGraphics(e){const{_graphicAttributes:i,symbols:s,view:{spatialReference:r}}=this,o=[];return null==e||e.forEach(((e,n)=>{e.forEach(((e,a)=>{var h;const[c,p]=e;o.push(new t({geometry:new R({x:c,y:p,spatialReference:r}),symbol:null==s||null==(h=s.vertices)?void 0:h.default,attributes:{...i,pathIndex:n,pointIndex:a}}))}))})),o}_createMidpointGraphics(e){const{_graphicAttributes:i,symbols:s,view:{spatialReference:r}}=this,o=[];return null==e||e.forEach(((e,n)=>{e.forEach(((a,h)=>{const[c,p]=a,d=e[h+1]?h+1:0;if("polygon"===l(this.graphic.geometry,"type")||0!==d){const[a,l]=e[d],[m,v]=u([c,p],[a,l]);o.push(new t({geometry:new R({x:m,y:v,spatialReference:r}),symbol:s.midpoints.default,attributes:{...i,pathIndex:n,pointIndexStart:h,pointIndexEnd:d}}))}}))})),o}_storeRelatedVertexIndices(){const e=this.vertexGraphics.items;if(!e)return;const t=e.map((({geometry:e})=>({x:e.x,y:e.y})));for(let i=0;i<t.length;i++){const s=[];for(let e=0;e<t.length;e++){if(i===e)continue;const r=t[i],o=t[e];r.x===o.x&&r.y===o.y&&s.push(e)}e[i].attributes.relatedGraphicIndices=s}}_setupMover(){const{enableMovement:e,graphic:t,midpointGraphics:i,vertexGraphics:s,view:r}=this,o=l(t.geometry,"type"),n="point"===o||"multipoint"===o,a=s.concat(i).items;e&&a.push(t),this._mover=new M({enableMoveAllGraphics:!1,indicatorsEnabled:n,graphics:a,view:r,callbacks:{onGraphicClick:e=>this._onGraphicClickCallback(e),onGraphicMoveStart:e=>this._onGraphicMoveStartCallback(e),onGraphicMove:e=>this._onGraphicMoveCallback(e),onGraphicMoveStop:e=>this._onGraphicMoveStopCallback(e),onGraphicPointerOver:e=>this._onGraphicPointerOverCallback(e),onGraphicPointerOut:e=>this._onGraphicPointerOutCallback(e)}})}_onGraphicClickCallback(e){e.viewEvent.stopPropagation();const t=e.graphic;if(t===this.graphic)this.clearSelection(),this.emit("graphic-click",e),this.callbacks.onGraphicClick&&this.callbacks.onGraphicClick(e);else if(this._isMidpoint(t)){if(2===e.viewEvent.button)return;const i=this.graphic.clone(),s=this._createVertexFromMidpoint(t);this.refresh(),this._emitVertexAddEvent([t],i,s)}else if(this._isVertex(t))if(e.viewEvent.stopPropagation(),2===e.viewEvent.button)this._removeVertices(t);else{e.viewEvent.native.shiftKey||this._clearSelection(),this.selectedVertices.includes(t)?this._removeFromSelection(t,!0):this._addToSelection(t)}}_setUpOperation(e){const{graphic:t,dx:i,dy:s}=e,r=t===this.graphic;this._resetSnappingStateVars(),this._setUpGeometryHelper(),this._saveSnappingContextForHandle(t,e),this._activeOperationInfo={target:this.graphic,mover:t,operationType:r?"move":"reshape",totalDx:i,totalDy:s}}_onGraphicMoveStartCallback(e){const t=e.graphic,{dx:i,dy:s}=e;if(t===this.graphic)return this._clearSelection(),this._resetGraphics(),this._setUpOperation(e),this._emitMoveStartEvent(i,s),void("point"===this._editGeometryOperations.data.type&&this._onHandleMove(t,i,s,e,(()=>this._emitMoveEvent(i,s))));if(!this.selectedVertices.includes(t)){if(this._clearSelection(),this._isMidpoint(t)){const e=this.graphic.clone(),i=this._createVertexFromMidpoint(t);this._emitVertexAddEvent([t],e,i)}this._addToSelection(t)}this._setUpOperation(e),this._emitReshapeStartEvent(t),this._onHandleMove(t,i,s,e,(()=>this._emitReshapeEvent(t)))}_onGraphicMoveCallback(e){const{graphic:t,dx:i,dy:s}=e;this._activeOperationInfo.totalDx+=i,this._activeOperationInfo.totalDy+=s;const{operationType:r}=this._activeOperationInfo;"move"===r?"point"===this._editGeometryOperations.data.type?this._onHandleMove(t,i,s,e,(()=>this._emitMoveEvent(i,s))):this._emitMoveEvent(i,s):this._onHandleMove(t,i,s,e,(()=>this._emitReshapeEvent(t)))}_onGraphicMoveStopCallback(e){const{graphic:t,dx:i,dy:s}=e;this._activeOperationInfo.totalDx+=i,this._activeOperationInfo.totalDy+=s,t===this.graphic?(this._emitMoveStopEvent(),this.refresh()):(this._onHandleMove(t,i,s,e,(()=>this._emitReshapeStopEvent(t))),this._resetSnappingStateVars(),this._activeOperationInfo=null,this._isMidpoint(t)&&this.refresh())}_updateMidpointGraphicLocations(e){for(const t of this.midpointGraphics){const{pathIndex:i,pointIndexStart:s,pointIndexEnd:r}=t.attributes,[o,n]=e[i][s],[a,h]=e[i][r],[c,p]=u([o,n],[a,h]);t.geometry=new R({x:c,y:p,spatialReference:this.view.spatialReference})}}_getIndicesForVertexGraphic({attributes:e}){return[(null==e?void 0:e.pathIndex)||0,(null==e?void 0:e.pointIndex)||0]}_getVertexFromEditGeometry(e){const[t,i]=this._getIndicesForVertexGraphic(e);return this._editGeometryOperations.data.components[t].vertices[i]}_onHandleMove(e,t,i,s,r){if(p(this._snappingTask),!this._snappingContext)return;const o=e.geometry,n="graphic-move-stop"===s.type;if(c(this.snappingManager)&&this.selectedVertices.length<2&&!n){const s=this.snappingManager;this._stagedVertex=s.update(o,this._snappingContext),this._syncGeometryAfterVertexMove(e,new R(this._stagedVertex),t,i,n),r(),this._snappingTask=d((async a=>{const h=await s.snap(o,this._snappingContext,a);h.valid&&(this._stagedVertex=h.apply(),this._syncGeometryAfterVertexMove(e,new R(this._stagedVertex),t,i,n),r())}))}else{const s=c(this._stagedVertex)?new R(this._stagedVertex):o;this._syncGeometryAfterVertexMove(e,s,t,i,n),r()}}async _syncGeometryAfterVertexMove(e,t,i,s,r=!1){const o=this._editGeometryOperations.data.geometry;if("point"===o.type)e.geometry=t;else{const{x:n,y:a}=t,[h,c]=this._getIndicesForVertexGraphic(e);let p=g(o);const l=p[h].length-1;p[h][c]=[n,a],"polygon"===o.type&&(0===c?p[h][l]=[n,a]:c===l&&(p[h][0]=[n,a])),this._isVertex(e)&&(p=this._moveRelatedCoordinates(p,e,n,a),p=this._moveSelectedHandleCoordinates(p,e,i,s,"polygon"===o.type),this._updateMidpointGraphicLocations(p)),this.graphic.geometry=o.clone();const d=this._getVertexFromEditGeometry(e),m=n-d.pos[0],v=a-d.pos[1];this._editGeometryOperations.moveVertices([d],m,v,0),r&&(this._mover?this._mover.updateGeometry(this._mover.graphics.indexOf(e),t):e.geometry=t)}}_moveRelatedCoordinates(e,t,i,s){const{relatedGraphicIndices:r}=t.attributes;for(const o of r){const r=this.vertexGraphics.getItemAt(o),{pathIndex:n,pointIndex:a}=r.attributes;e[n][a]=[i,s],r.geometry=t.geometry}return e}_moveSelectedHandleCoordinates(e,t,i,s,r){for(const o of this.selectedVertices)if(o!==t){const{pathIndex:t,pointIndex:n,relatedGraphicIndices:a}=o.attributes,h=V(o.geometry,i,s,this.view),c=e[t].length-1;e[t][n]=[h.x,h.y],o.geometry=h,r&&(0===n?e[t][c]=[h.x,h.y]:n===c&&(e[t][0]=[h.x,h.y]));for(const i of a){const t=this.vertexGraphics.getItemAt(i),{pathIndex:s,pointIndex:r}=t.attributes;e[s][r]=[h.x,h.y],t.geometry=h}}return e}_onGraphicPointerOverCallback(e){const t=e.graphic;this._isVertex(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.vertices.hover),this._updateHoverCursor(t)}_onGraphicPointerOutCallback(e){const t=e.graphic;this._isVertex(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.vertices.default),this.view.cursor="default"}_createVertexFromMidpoint(e){const{_graphicAttributes:t,graphic:i}=this,s=i.geometry;if(h(s)||"polygon"!==s.type&&"polyline"!==s.type)return[];const r=s.clone(),o=[],{pathIndex:n,pointIndexStart:a,pointIndexEnd:c}=e.attributes,{x:p,y:l}=e.geometry,d=0===c?a+1:c,m=g(r);return m[n].splice(d,0,[p,l]),e.attributes={...t,pathIndex:n,pointIndex:d,relatedGraphicIndices:[]},o.push({coordinates:m[n][d],componentIndex:n,vertexIndex:d}),this.graphic.geometry=r,o}_addToSelection(e){e instanceof t&&(e=[e]);for(const t of e)t.symbol=this.symbols.vertices.selected;this._set("selectedVertices",this.selectedVertices.concat(e)),this._emitSelectEvent(e)}_removeFromSelection(e,i){const{vertices:s}=this.symbols,r=i?s.hover:s.default;e instanceof t&&(e=[e]);for(const t of e)this.selectedVertices.splice(this.selectedVertices.indexOf(t),1),this._set("selectedVertices",this.selectedVertices),t.set("symbol",r);this._emitDeselectEvent(e)}_clearSelection(){if(this.selectedVertices.length){const e=this.selectedVertices;for(const t of this.selectedVertices)t.set("symbol",this.symbols.vertices.default);this._set("selectedVertices",[]),this._emitDeselectEvent(e)}}_keyDownHandler(e){E.delete.includes(e.key)&&!e.repeat&&this.selectedVertices.length&&this._removeVertices(this.selectedVertices)}_removeVertices(e){const i=this.graphic.geometry;if(h(i)||"polygon"!==i.type&&"polyline"!==i.type)return;if("polygon"===i.type&&this.vertexGraphics.length<4||this.vertexGraphics.length<3)return;e instanceof t&&(e=[e]);const s=this.graphic.clone(),r=i.clone();let o=g(r);const n=[];e instanceof t&&(e=[e]);for(const t of e){const{x:e,y:i}=t.geometry;for(let t=0;t<o.length;t++){const s=o[t];for(let r=0;r<s.length;r++){const[a,h]=s[r];e===a&&i===h&&(n.push({coordinates:o[t][r],componentIndex:t,vertexIndex:r}),o[t].splice(Number(r),1))}}}if("polygon"===r.type)o=o.filter((e=>{if(e.length<2)return!1;const[t,i]=e[0],[s,r]=e[e.length-1];return(2!==e.length||t!==s||i!==r)&&(t===s&&i===r||e.push(e[0]),!0)})),r.rings=o;else{for(const e of o)1===e.length&&o.splice(o.indexOf(e),1);r.paths=o}this.graphic.geometry=r,this.refresh(),this._emitVertexRemoveEvent(e,s,n)}_isVertex(e){return this.vertexGraphics.includes(e)}_isSelected(e){return this._isVertex(e)&&this.selectedVertices.includes(e)}_isMidpoint(e){return this.midpointGraphics.includes(e)}_updateHoverCursor(e){this.view.cursor=this._isMidpoint(e)?"copy":"move"}_emitMoveStartEvent(e,t){const i=new T(this.graphic,e,t);this.emit("move-start",i),this.callbacks.onMoveStart&&this.callbacks.onMoveStart(i)}_emitMoveEvent(e,t){const i=new U(this.graphic,e,t);this.emit("move",i),this.callbacks.onMove&&this.callbacks.onMove(i)}_emitMoveStopEvent(){const{totalDx:e,totalDy:t}=this._activeOperationInfo,i=new D(this.graphic,e,t);this.emit("move-stop",i),this.callbacks.onMoveStop&&this.callbacks.onMoveStop(i)}_emitReshapeStartEvent(e){const t=new j(this.graphic,e,this.selectedVertices);this.emit("reshape-start",t),this.callbacks.onReshapeStart&&this.callbacks.onReshapeStart(t)}_emitReshapeEvent(e){const t=new H(this.graphic,e,this.selectedVertices);this.emit("reshape",t),this.callbacks.onReshape&&this.callbacks.onReshape(t)}_emitReshapeStopEvent(e){const t=new A(this.graphic,e,this.selectedVertices);this.emit("reshape-stop",t),this.callbacks.onReshapeStop&&this.callbacks.onReshapeStop(t)}_emitSelectEvent(e){const t=new F(e);this.emit("select",t),this.callbacks.onVertexSelect&&this.callbacks.onVertexSelect(t)}_emitDeselectEvent(e){const t=new z(e);this.emit("deselect",t),this.callbacks.onVertexDeselect&&this.callbacks.onVertexDeselect(t)}_emitVertexAddEvent(e,t,i){const s=new L(e,this.graphic,t,i);this.emit("vertex-add",s),this.callbacks.onVertexAdd&&this.callbacks.onVertexAdd(s)}_emitVertexRemoveEvent(e,t,i){const s=new P(e,this.graphic,t,i);this.emit("vertex-remove",s),this.callbacks.onVertexRemove&&this.callbacks.onVertexRemove(s)}_logGeometryTypeError(){B.error(new s("reshape:invalid-geometry","Reshape operation not supported for the provided graphic. The geometry type is not supported."))}};e([y()],J.prototype,"callbacks",void 0),e([y()],J.prototype,"enableMidpoints",void 0),e([y()],J.prototype,"enableMovement",void 0),e([y()],J.prototype,"enableVertices",void 0),e([y()],J.prototype,"graphic",void 0),e([y({readOnly:!0})],J.prototype,"vertexGraphics",void 0),e([y()],J.prototype,"layer",void 0),e([y({readOnly:!0})],J.prototype,"midpointGraphics",void 0),e([y()],J.prototype,"midpointSymbol",void 0),e([y({readOnly:!0})],J.prototype,"selectedVertices",void 0),e([y()],J.prototype,"snappingManager",void 0),e([y({readOnly:!0})],J.prototype,"state",null),e([y({value:N})],J.prototype,"symbols",null),e([y({readOnly:!0})],J.prototype,"type",void 0),e([y()],J.prototype,"view",void 0),J=e([_(q)],J);const Q=J;export{Q as default};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import t from"../../../Graphic.js";import i from"../../../core/Collection.js";import s from"../../../core/Error.js";import r from"../../../core/Evented.js";import o from"../../../core/Handles.js";import n from"../../../core/Logger.js";import{destroyMaybe as a,isNone as h,isSome as c,abortMaybe as p,get as l}from"../../../core/maybe.js";import{createTask as d}from"../../../core/promiseUtils.js";import{whenOnce as m,pausable as v}from"../../../core/watchUtils.js";import{property as y}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import{geometryToCoordinates as g,getMidpoint as u}from"../../../geometry/support/coordsUtils.js";import x from"../../../layers/GraphicsLayer.js";import f from"../../../symbols/SimpleMarkerSymbol.js";import{ViewingMode as G}from"../../ViewingMode.js";import{SnappingVisualizer2D as b}from"../../2d/interactive/SnappingVisualizer2D.js";import{cloneMove as V}from"./drawUtils.js";import M from"./GraphicMover.js";import w from"./HighlightHelper.js";import{addUniqueLayer as S}from"./layerUtils.js";import{settings as k}from"./settings.js";import{ViewEventPriorities as E}from"../../input/InputManager.js";import{SKETCH_KEYS as I}from"../../interactive/keybindings.js";import{EditGeometryOperations as O}from"../../interactive/editGeometry/EditGeometryOperations.js";import{SnappingContext as C}from"../../interactive/snapping/SnappingContext.js";import R from"../../../geometry/Polyline.js";import j from"../../../geometry/Point.js";class H{constructor(e,t,i){this.graphic=e,this.mover=t,this.selected=i,this.type="reshape-start"}}class A{constructor(e,t,i){this.graphic=e,this.mover=t,this.selected=i,this.type="reshape"}}class U{constructor(e,t,i){this.graphic=e,this.mover=t,this.selected=i,this.type="reshape-stop"}}class T{constructor(e,t,i){this.mover=e,this.dx=t,this.dy=i,this.type="move-start"}}class D{constructor(e,t,i){this.mover=e,this.dx=t,this.dy=i,this.type="move"}}class F{constructor(e,t,i){this.mover=e,this.dx=t,this.dy=i,this.type="move-stop"}}class z{constructor(e){this.added=e,this.type="vertex-select"}}class L{constructor(e){this.removed=e,this.type="vertex-deselect"}}class P{constructor(e,t,i,s){this.added=e,this.graphic=t,this.oldGraphic=i,this.vertices=s,this.type="vertex-add"}}class K{constructor(e,t,i,s){this.removed=e,this.graphic=t,this.oldGraphic=i,this.vertices=s,this.type="vertex-remove"}}const N=k.reshapeGraphics,q={vertices:{default:new f({style:"circle",size:N.vertex.size,color:N.vertex.color,outline:{color:N.vertex.outlineColor,width:1}}),hover:new f({style:"circle",size:N.vertex.hoverSize,color:N.vertex.hoverColor,outline:{color:N.vertex.hoverOutlineColor,width:1}}),selected:new f({style:"circle",size:N.selected.size,color:N.selected.color,outline:{color:N.selected.outlineColor,width:1}})},midpoints:{default:new f({style:"circle",size:N.midpoint.size,color:N.midpoint.color,outline:{color:N.midpoint.outlineColor,width:1}}),hover:new f({style:"circle",size:N.midpoint.size,color:N.midpoint.color,outline:{color:N.midpoint.outlineColor,width:1}})}},B="esri.views.draw.support.Reshape",J=n.getLogger(B);let Q=class extends r.EventedAccessor{constructor(e){super(e),this._activeOperationInfo=null,this._editGeometryOperations=null,this._handles=new o,this._graphicAttributes={esriSketchTool:"box"},this._mover=null,this._snappingTask=null,this._stagedVertex=null,this._viewHandles=new o,this.callbacks={onReshapeStart(){},onReshape(){},onReshapeStop(){},onMoveStart(){},onMove(){},onMoveStop(){},onGraphicClick(){}},this.enableMidpoints=!0,this.enableMovement=!0,this.enableVertices=!0,this.graphic=null,this.layer=null,this.midpointGraphics=new i,this.midpointSymbol=new f({style:"circle",size:6,color:[200,200,200],outline:{color:[100,100,100],width:1}}),this.selectedVertices=[],this.snappingManager=null,this.type="reshape",this.vertexGraphics=new i,this.view=null}initialize(){this._highlightHelper=new w({view:this.view}),this._setup(),this._handles.add([m(this,"view.ready",(()=>{const{layer:e,view:t}=this;S(t,e),this._viewHandles.add([t.on("key-down",(e=>this._keyDownHandler(e)),E.TOOL)])})),v(this,"graphic",(()=>this.refresh())),v(this,"layer",((e,t)=>{t&&(this._clearSelection(),this._resetGraphics(t)),this.refresh()})),v(this,"enableMidpoints",(()=>{this.refresh()}))])}destroy(){var e;this._reset(),null==(e=this._mover)||e.destroy(),this._mover=null,this._handles=a(this._handles),this._viewHandles=a(this._viewHandles)}set highlightsEnabled(e){var t;null==(t=this._highlightHelper)||t.removeAll(),this._set("highlightsEnabled",e),this._setUpHighlights()}get state(){const e=!!this.get("view.ready"),t=!(!this.get("graphic")||!this.get("layer"));return e&&t?"active":e?"ready":"disabled"}set symbols(e){const{midpoints:t=q.midpoints,vertices:i=q.vertices}=e||{};this._set("symbols",{midpoints:t,vertices:i})}isUIGraphic(e){const t=[];return this.graphic&&t.push(this.graphic),t.concat(this.vertexGraphics.items,this.midpointGraphics.items),t.length&&t.includes(e)}refresh(){this._reset(),this._setup()}reset(){this.graphic=null}clearSelection(){this._clearSelection()}removeSelectedVertices(){this.selectedVertices.length&&this._removeVertices(this.selectedVertices)}_setup(){const{graphic:e,layer:t}=this;if(!t||!e||h(e.geometry))return;const i=e.geometry;"mesh"!==i.type&&"extent"!==i.type?(this._setUpHighlights(),this._setupGraphics(),this._setupMover()):this._logGeometryTypeError()}_setUpHighlights(){this.highlightsEnabled&&this.graphic&&this._highlightHelper.add(this.graphic)}_setUpGeometryHelper(){const e=this.graphic.geometry;if(h(e)||"mesh"===e.type||"extent"===e.type)return void this._logGeometryTypeError();const t="multipoint"===e.type?new R({paths:e.points,spatialReference:e.spatialReference}):e;this._editGeometryOperations=O.fromGeometry(t,G.Local)}_saveSnappingContextForHandle(e,t){var i;this._snappingGraphicsLayer=new x({listMode:"hide",internal:!0,title:"Reshape snapping layer"}),this.view.map.layers.add(this._snappingGraphicsLayer),this._snappingContext=new C({editGeometryOperations:this._editGeometryOperations,elevationInfo:{mode:"on-the-ground",offset:0},pointer:(null==(i=t.viewEvent)?void 0:i.pointerType)||"mouse",excludeFeature:this.graphic,visualizer:new b(this._snappingGraphicsLayer),vertexHandle:this._getVertexFromEditGeometry(e)})}_reset(){this._clearSelection(),this._highlightHelper.removeAll(),this._resetGraphics(),this._resetSnappingStateVars(),this._activeOperationInfo=null,this._mover&&this._mover.destroy(),this._mover=null,this.view.cursor="default"}_resetSnappingStateVars(){c(this.snappingManager)&&this.snappingManager.doneSnapping(),c(this._snappingGraphicsLayer)&&(this.view.map.layers.remove(this._snappingGraphicsLayer),this._snappingGraphicsLayer.destroy()),this._editGeometryOperations=a(this._editGeometryOperations),this._snappingTask=p(this._snappingTask),this._snappingTask=null,this._snappingContext=null,this._stagedVertex=null}_resetGraphics(e){this._removeMidpointGraphics(e),this._removeVertexGraphics(e),this._set("selectedVertices",[])}_removeMidpointGraphics(e){const t=e||this.layer;t&&t.removeMany(this.midpointGraphics.items),this.midpointGraphics.items.forEach((e=>e.destroy())),this.midpointGraphics.removeAll()}_removeVertexGraphics(e){const t=e||this.layer;t&&t.removeMany(this.vertexGraphics.items),this.vertexGraphics.items.forEach((e=>e.destroy())),this.vertexGraphics.removeAll()}_getCoordinatesForUI(e){const t=g(e.clone());if("polygon"===e.type)for(const i of t){const e=i[i.length-1];i[0][0]===e[0]&&i[0][1]===e[1]&&i.length>2&&i.pop()}return t}_setupGraphics(){const e=this.graphic.geometry;if(c(e)&&("polyline"===e.type||"polygon"===e.type)){const t=this._getCoordinatesForUI(e);this.enableMidpoints&&this._setUpMidpointGraphics(t),this.enableVertices&&this._setUpVertexGraphics(t)}}_setUpMidpointGraphics(e){this._removeMidpointGraphics();const t=this._createMidpointGraphics(e);this.midpointGraphics.addMany(t),this.layer.addMany(t)}_setUpVertexGraphics(e){this._removeVertexGraphics();const t=this._createVertexGraphics(e);this.vertexGraphics.addMany(t),this._storeRelatedVertexIndices(),this.layer.addMany(t)}_createVertexGraphics(e){const{_graphicAttributes:i,symbols:s,view:{spatialReference:r}}=this,o=[];return null==e||e.forEach(((e,n)=>{e.forEach(((e,a)=>{var h;const[c,p]=e;o.push(new t({geometry:new j({x:c,y:p,spatialReference:r}),symbol:null==s||null==(h=s.vertices)?void 0:h.default,attributes:{...i,pathIndex:n,pointIndex:a}}))}))})),o}_createMidpointGraphics(e){const{_graphicAttributes:i,symbols:s,view:{spatialReference:r}}=this,o=[];return null==e||e.forEach(((e,n)=>{e.forEach(((a,h)=>{const[c,p]=a,d=e[h+1]?h+1:0;if("polygon"===l(this.graphic.geometry,"type")||0!==d){const[a,l]=e[d],[m,v]=u([c,p],[a,l]);o.push(new t({geometry:new j({x:m,y:v,spatialReference:r}),symbol:s.midpoints.default,attributes:{...i,pathIndex:n,pointIndexStart:h,pointIndexEnd:d}}))}}))})),o}_storeRelatedVertexIndices(){const e=this.vertexGraphics.items;if(!e)return;const t=e.map((({geometry:e})=>({x:e.x,y:e.y})));for(let i=0;i<t.length;i++){const s=[];for(let e=0;e<t.length;e++){if(i===e)continue;const r=t[i],o=t[e];r.x===o.x&&r.y===o.y&&s.push(e)}e[i].attributes.relatedGraphicIndices=s}}_setupMover(){const{enableMovement:e,graphic:t,midpointGraphics:i,vertexGraphics:s,view:r}=this,o=s.concat(i).items;e&&o.push(t),this._mover=new M({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,graphics:o,view:r,callbacks:{onGraphicClick:e=>this._onGraphicClickCallback(e),onGraphicMoveStart:e=>this._onGraphicMoveStartCallback(e),onGraphicMove:e=>this._onGraphicMoveCallback(e),onGraphicMoveStop:e=>this._onGraphicMoveStopCallback(e),onGraphicPointerOver:e=>this._onGraphicPointerOverCallback(e),onGraphicPointerOut:e=>this._onGraphicPointerOutCallback(e)}})}_onGraphicClickCallback(e){e.viewEvent.stopPropagation();const t=e.graphic;if(t===this.graphic)this.clearSelection(),this.emit("graphic-click",e),this.callbacks.onGraphicClick&&this.callbacks.onGraphicClick(e);else if(this._isMidpoint(t)){if(2===e.viewEvent.button)return;const i=this.graphic.clone(),s=this._createVertexFromMidpoint(t);this.refresh(),this._emitVertexAddEvent([t],i,s)}else if(this._isVertex(t))if(e.viewEvent.stopPropagation(),2===e.viewEvent.button)this._removeVertices(t);else{e.viewEvent.native.shiftKey||this._clearSelection(),this.selectedVertices.includes(t)?this._removeFromSelection(t,!0):this._addToSelection(t)}}_setUpOperation(e){const{graphic:t,dx:i,dy:s}=e,r=t===this.graphic;this._resetSnappingStateVars(),this._setUpGeometryHelper(),this._saveSnappingContextForHandle(t,e),this._activeOperationInfo={target:this.graphic,mover:t,operationType:r?"move":"reshape",totalDx:i,totalDy:s}}_onGraphicMoveStartCallback(e){const t=e.graphic,{dx:i,dy:s}=e;if(t===this.graphic)return this._clearSelection(),this._resetGraphics(),this._setUpOperation(e),this._emitMoveStartEvent(i,s),void("point"===this._editGeometryOperations.data.type&&this._onHandleMove(t,i,s,e,(()=>this._emitMoveEvent(i,s))));if(!this.selectedVertices.includes(t)){if(this._clearSelection(),this._isMidpoint(t)){const e=this.graphic.clone(),i=this._createVertexFromMidpoint(t);this._emitVertexAddEvent([t],e,i)}this._addToSelection(t)}this._setUpOperation(e),this._emitReshapeStartEvent(t),this._onHandleMove(t,i,s,e,(()=>this._emitReshapeEvent(t)))}_onGraphicMoveCallback(e){const{graphic:t,dx:i,dy:s}=e;this._activeOperationInfo.totalDx+=i,this._activeOperationInfo.totalDy+=s;const{operationType:r}=this._activeOperationInfo;"move"===r?"point"===this._editGeometryOperations.data.type?this._onHandleMove(t,i,s,e,(()=>this._emitMoveEvent(i,s))):this._emitMoveEvent(i,s):this._onHandleMove(t,i,s,e,(()=>this._emitReshapeEvent(t)))}_onGraphicMoveStopCallback(e){const{graphic:t,dx:i,dy:s}=e;this._activeOperationInfo.totalDx+=i,this._activeOperationInfo.totalDy+=s,t===this.graphic?(this._emitMoveStopEvent(),this.refresh()):(this._onHandleMove(t,i,s,e,(()=>this._emitReshapeStopEvent(t))),this._resetSnappingStateVars(),this._activeOperationInfo=null,this._isMidpoint(t)&&this.refresh())}_updateMidpointGraphicLocations(e){for(const t of this.midpointGraphics){const{pathIndex:i,pointIndexStart:s,pointIndexEnd:r}=t.attributes,[o,n]=e[i][s],[a,h]=e[i][r],[c,p]=u([o,n],[a,h]);t.geometry=new j({x:c,y:p,spatialReference:this.view.spatialReference})}}_getIndicesForVertexGraphic({attributes:e}){return[(null==e?void 0:e.pathIndex)||0,(null==e?void 0:e.pointIndex)||0]}_getVertexFromEditGeometry(e){const[t,i]=this._getIndicesForVertexGraphic(e);return this._editGeometryOperations.data.components[t].vertices[i]}_onHandleMove(e,t,i,s,r){if(p(this._snappingTask),!this._snappingContext)return;const o=e.geometry,n="graphic-move-stop"===s.type;if(c(this.snappingManager)&&this.selectedVertices.length<2&&!n){const s=this.snappingManager;this._stagedVertex=s.update(o,this._snappingContext),this._syncGeometryAfterVertexMove(e,new j(this._stagedVertex),t,i,n),r(),this._snappingTask=d((async a=>{const h=await s.snap(o,this._snappingContext,a);h.valid&&(this._stagedVertex=h.apply(),this._syncGeometryAfterVertexMove(e,new j(this._stagedVertex),t,i,n),r())}))}else{const s=c(this._stagedVertex)?new j(this._stagedVertex):o;this._syncGeometryAfterVertexMove(e,s,t,i,n),r()}}async _syncGeometryAfterVertexMove(e,t,i,s,r=!1){const o=this._editGeometryOperations.data.geometry;if("point"===o.type)e.geometry=t;else{const{x:n,y:a}=t,[h,c]=this._getIndicesForVertexGraphic(e);let p=g(o);const l=p[h].length-1;p[h][c]=[n,a],"polygon"===o.type&&(0===c?p[h][l]=[n,a]:c===l&&(p[h][0]=[n,a])),this._isVertex(e)&&(p=this._moveRelatedCoordinates(p,e,n,a),p=this._moveSelectedHandleCoordinates(p,e,i,s,"polygon"===o.type),this._updateMidpointGraphicLocations(p)),this.graphic.geometry=o.clone();const d=this._getVertexFromEditGeometry(e),m=n-d.pos[0],v=a-d.pos[1];this._editGeometryOperations.moveVertices([d],m,v,0),r&&(this._mover?this._mover.updateGeometry(this._mover.graphics.indexOf(e),t):e.geometry=t)}}_moveRelatedCoordinates(e,t,i,s){const{relatedGraphicIndices:r}=t.attributes;for(const o of r){const r=this.vertexGraphics.getItemAt(o),{pathIndex:n,pointIndex:a}=r.attributes;e[n][a]=[i,s],r.geometry=t.geometry}return e}_moveSelectedHandleCoordinates(e,t,i,s,r){for(const o of this.selectedVertices)if(o!==t){const{pathIndex:t,pointIndex:n,relatedGraphicIndices:a}=o.attributes,h=V(o.geometry,i,s,this.view),c=e[t].length-1;e[t][n]=[h.x,h.y],o.geometry=h,r&&(0===n?e[t][c]=[h.x,h.y]:n===c&&(e[t][0]=[h.x,h.y]));for(const i of a){const t=this.vertexGraphics.getItemAt(i),{pathIndex:s,pointIndex:r}=t.attributes;e[s][r]=[h.x,h.y],t.geometry=h}}return e}_onGraphicPointerOverCallback(e){const t=e.graphic;this._isVertex(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.vertices.hover),this._updateHoverCursor(t)}_onGraphicPointerOutCallback(e){const t=e.graphic;this._isVertex(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.vertices.default),this.view.cursor="default"}_createVertexFromMidpoint(e){const{_graphicAttributes:t,graphic:i}=this,s=i.geometry;if(h(s)||"polygon"!==s.type&&"polyline"!==s.type)return[];const r=s.clone(),o=[],{pathIndex:n,pointIndexStart:a,pointIndexEnd:c}=e.attributes,{x:p,y:l}=e.geometry,d=0===c?a+1:c,m=g(r);return m[n].splice(d,0,[p,l]),e.attributes={...t,pathIndex:n,pointIndex:d,relatedGraphicIndices:[]},o.push({coordinates:m[n][d],componentIndex:n,vertexIndex:d}),this.graphic.geometry=r,o}_addToSelection(e){e instanceof t&&(e=[e]);for(const t of e)t.symbol=this.symbols.vertices.selected;this._set("selectedVertices",this.selectedVertices.concat(e)),this._emitSelectEvent(e)}_removeFromSelection(e,i){const{vertices:s}=this.symbols,r=i?s.hover:s.default;e instanceof t&&(e=[e]);for(const t of e)this.selectedVertices.splice(this.selectedVertices.indexOf(t),1),this._set("selectedVertices",this.selectedVertices),t.set("symbol",r);this._emitDeselectEvent(e)}_clearSelection(){if(this.selectedVertices.length){const e=this.selectedVertices;for(const t of this.selectedVertices)t.set("symbol",this.symbols.vertices.default);this._set("selectedVertices",[]),this._emitDeselectEvent(e)}}_keyDownHandler(e){I.delete.includes(e.key)&&!e.repeat&&this.selectedVertices.length&&this._removeVertices(this.selectedVertices)}_removeVertices(e){const i=this.graphic.geometry;if(h(i)||"polygon"!==i.type&&"polyline"!==i.type)return;if("polygon"===i.type&&this.vertexGraphics.length<4||this.vertexGraphics.length<3)return;e instanceof t&&(e=[e]);const s=this.graphic.clone(),r=i.clone();let o=g(r);const n=[];e instanceof t&&(e=[e]);for(const t of e){const{x:e,y:i}=t.geometry;for(let t=0;t<o.length;t++){const s=o[t];for(let r=0;r<s.length;r++){const[a,h]=s[r];e===a&&i===h&&(n.push({coordinates:o[t][r],componentIndex:t,vertexIndex:r}),o[t].splice(Number(r),1))}}}if("polygon"===r.type)o=o.filter((e=>{if(e.length<2)return!1;const[t,i]=e[0],[s,r]=e[e.length-1];return(2!==e.length||t!==s||i!==r)&&(t===s&&i===r||e.push(e[0]),!0)})),r.rings=o;else{for(const e of o)1===e.length&&o.splice(o.indexOf(e),1);r.paths=o}this.graphic.geometry=r,this.refresh(),this._emitVertexRemoveEvent(e,s,n)}_isVertex(e){return this.vertexGraphics.includes(e)}_isSelected(e){return this._isVertex(e)&&this.selectedVertices.includes(e)}_isMidpoint(e){return this.midpointGraphics.includes(e)}_updateHoverCursor(e){this.view.cursor=this._isMidpoint(e)?"copy":"move"}_emitMoveStartEvent(e,t){const i=new T(this.graphic,e,t);this.emit("move-start",i),this.callbacks.onMoveStart&&this.callbacks.onMoveStart(i)}_emitMoveEvent(e,t){const i=new D(this.graphic,e,t);this.emit("move",i),this.callbacks.onMove&&this.callbacks.onMove(i)}_emitMoveStopEvent(){const{totalDx:e,totalDy:t}=this._activeOperationInfo,i=new F(this.graphic,e,t);this.emit("move-stop",i),this.callbacks.onMoveStop&&this.callbacks.onMoveStop(i)}_emitReshapeStartEvent(e){const t=new H(this.graphic,e,this.selectedVertices);this.emit("reshape-start",t),this.callbacks.onReshapeStart&&this.callbacks.onReshapeStart(t)}_emitReshapeEvent(e){const t=new A(this.graphic,e,this.selectedVertices);this.emit("reshape",t),this.callbacks.onReshape&&this.callbacks.onReshape(t)}_emitReshapeStopEvent(e){const t=new U(this.graphic,e,this.selectedVertices);this.emit("reshape-stop",t),this.callbacks.onReshapeStop&&this.callbacks.onReshapeStop(t)}_emitSelectEvent(e){const t=new z(e);this.emit("select",t),this.callbacks.onVertexSelect&&this.callbacks.onVertexSelect(t)}_emitDeselectEvent(e){const t=new L(e);this.emit("deselect",t),this.callbacks.onVertexDeselect&&this.callbacks.onVertexDeselect(t)}_emitVertexAddEvent(e,t,i){const s=new P(e,this.graphic,t,i);this.emit("vertex-add",s),this.callbacks.onVertexAdd&&this.callbacks.onVertexAdd(s)}_emitVertexRemoveEvent(e,t,i){const s=new K(e,this.graphic,t,i);this.emit("vertex-remove",s),this.callbacks.onVertexRemove&&this.callbacks.onVertexRemove(s)}_logGeometryTypeError(){J.error(new s("reshape:invalid-geometry","Reshape operation not supported for the provided graphic. The geometry type is not supported."))}};e([y()],Q.prototype,"callbacks",void 0),e([y()],Q.prototype,"enableMidpoints",void 0),e([y()],Q.prototype,"enableMovement",void 0),e([y()],Q.prototype,"enableVertices",void 0),e([y()],Q.prototype,"graphic",void 0),e([y({value:!0})],Q.prototype,"highlightsEnabled",null),e([y()],Q.prototype,"layer",void 0),e([y({readOnly:!0})],Q.prototype,"midpointGraphics",void 0),e([y()],Q.prototype,"midpointSymbol",void 0),e([y({readOnly:!0})],Q.prototype,"selectedVertices",void 0),e([y()],Q.prototype,"snappingManager",void 0),e([y({readOnly:!0})],Q.prototype,"state",null),e([y({value:q})],Q.prototype,"symbols",null),e([y({readOnly:!0})],Q.prototype,"type",void 0),e([y({readOnly:!0})],Q.prototype,"vertexGraphics",void 0),e([y()],Q.prototype,"view",void 0),Q=e([_(B)],Q);const W=Q;export{W as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
function
|
|
5
|
+
import{isSome as r}from"../../../core/maybe.js";function e(r,e,n){if(!e||!r||!r.map)return;const{map:a}=r,s=a.layers.find((r=>r===e));s||a.add(e,n),null!=n&&a.layers.reorder(s,n)}function n(e,n){return e.allLayerViews.find((e=>{const a=e.layer;return"sublayers"in a&&r(a.sublayers)&&!!a.sublayers.find((r=>r===n))||a===n}))}export{e as addUniqueLayer,n as findLayerView};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as r}from"../../chunks/tslib.es6.js";import{JSONSupport as o}from"../../core/JSONSupport.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as
|
|
5
|
+
import{_ as r}from"../../chunks/tslib.es6.js";import{JSONSupport as o}from"../../core/JSONSupport.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as e}from"../../core/accessorSupport/decorators/subclass.js";var t;let p=t=class extends o{constructor(){super(...arguments),this.url=""}destroy(){this.url=""}clone(){return new t({url:this.url})}};r([s({type:String,json:{write:{isRequired:!0}}})],p.prototype,"url",void 0),p=t=r([e("esri.webdoc.support.SlideThumbnail")],p);export{p as SlideThumbnail};
|
package/webmap/Bookmark.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../TimeExtent.js";import o from"../Viewpoint.js";import{deprecatedProperty as r}from"../core/deprecate.js";import i from"../core/Error.js";import{IdentifiableMixin as n}from"../core/Identifiable.js";import{JSONSupport as s}from"../core/JSONSupport.js";import{clone as p}from"../core/lang.js";import m from"../core/Logger.js";import{isSome as a,isNone as c}from"../core/maybe.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import{cast as u}from"../core/accessorSupport/decorators/cast.js";import{reader as w}from"../core/accessorSupport/decorators/reader.js";import{subclass as y}from"../core/accessorSupport/decorators/subclass.js";import{writer as
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../TimeExtent.js";import o from"../Viewpoint.js";import{deprecatedProperty as r}from"../core/deprecate.js";import i from"../core/Error.js";import{IdentifiableMixin as n}from"../core/Identifiable.js";import{JSONSupport as s}from"../core/JSONSupport.js";import{clone as p}from"../core/lang.js";import m from"../core/Logger.js";import{isSome as a,isNone as c}from"../core/maybe.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import{cast as u}from"../core/accessorSupport/decorators/cast.js";import{reader as w}from"../core/accessorSupport/decorators/reader.js";import{subclass as y}from"../core/accessorSupport/decorators/subclass.js";import{writer as d}from"../core/accessorSupport/decorators/writer.js";import{ensureType as h}from"../core/accessorSupport/ensureType.js";import f from"../geometry/Extent.js";import{SlideThumbnail as j}from"../webdoc/support/SlideThumbnail.js";var v;const b="esri.webmap.Bookmark",x=m.getLogger(b);let g=v=class extends(n(s)){constructor(e){super(e),this.name=null,this.thumbnail=new j,this.timeExtent=null}set extent(e){r(x,"extent",{replacement:"viewpoint",version:"4.17"}),this._set("viewpoint",new o({targetGeometry:e.clone()})),this._set("extent",e)}castThumbnail(e){return"string"==typeof e?new j({url:e}):h(j,e)}set viewpoint(e){const{targetGeometry:t,scale:o}=e;a(t)&&("extent"===t.type?this._set("extent",t.clone()):"point"===t.type&&c(o)&&x.warn("Bookmark.viewpoint should include 'scale' when its targetGeometry is a point.",e)),this._set("viewpoint",e)}readViewpoint(e,t){const{extent:r,viewpoint:i}=t;return o.fromJSON(i||{targetGeometry:r})}writeViewpoint(e,t,o,r){if(!e)return;const{targetGeometry:n}=e;if(a(n)&&"extent"!==n.type){const e="Bookmark.viewpoint cannot be written to JSON when the viewpoint's targetGeometry is not an extent.";null!=r&&r.messages?r.messages.push(new i("property:unsupported",e)):x.error(e)}else t[o]=e.toJSON()}clone(){return new v(p({name:this.name,thumbnail:this.thumbnail,timeExtent:this.timeExtent,viewpoint:this.viewpoint}))}};e([l({type:f,nonNullable:!0,json:{read:!1,write:{isRequired:!0}}})],g.prototype,"extent",null),e([l({type:String,nonNullable:!0,json:{write:{isRequired:!0}}})],g.prototype,"name",void 0),e([l({type:j,json:{write:{overridePolicy:e=>({enabled:!(!e||!e.url)})}}})],g.prototype,"thumbnail",void 0),e([u("thumbnail")],g.prototype,"castThumbnail",null),e([l({type:t,json:{write:!0}})],g.prototype,"timeExtent",void 0),e([l({type:o,nonNullable:!0,json:{write:!0}})],g.prototype,"viewpoint",null),e([w("viewpoint",["extent","viewpoint"])],g.prototype,"readViewpoint",null),e([d("viewpoint")],g.prototype,"writeViewpoint",null),g=v=e([y(b)],g);const S=g;export{S as default};
|
package/webmap/Version.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{Version as
|
|
5
|
+
import{Version as r}from"../core/Version.js";class s extends r{constructor(r,s){super(r,s,"webmap")}}export{s as Version};
|
package/webscene/Slide.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../Basemap.js";import i from"../Viewpoint.js";import{result as r}from"../core/asyncUtils.js";import s from"../core/Collection.js";import{referenceSetter as n}from"../core/collectionUtils.js";import{JSONSupport as o}from"../core/JSONSupport.js";import a from"../core/Logger.js";import{isSome as l}from"../core/maybe.js";import{eachAlways as p,onAbortOrThrow as m,isAbortError as h,all as c}from"../core/promiseUtils.js";import{property as u}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/has.js";import{cast as d}from"../core/accessorSupport/decorators/cast.js";import{subclass as y}from"../core/accessorSupport/decorators/subclass.js";import{ensureType as g}from"../core/accessorSupport/ensureType.js";import{h as v}from"../chunks/vec3.js";import{c as b}from"../chunks/vec3f64.js";import w from"../layers/Layer.js";import{isOperationalLayer as f}from"../layers/mixins/OperationalLayer.js";import{ensureType as L,clonePreservingTiledLayers as j}from"../support/basemapUtils.js";import{moduloPositive as T}from"../views/3d/support/mathUtils.js";import{toCamera as _}from"../views/3d/support/viewpointUtils.js";import{TaskPriority as C}from"../views/support/Scheduler.js";import S
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../Basemap.js";import i from"../Viewpoint.js";import{result as r}from"../core/asyncUtils.js";import s from"../core/Collection.js";import{referenceSetter as n}from"../core/collectionUtils.js";import{JSONSupport as o}from"../core/JSONSupport.js";import a from"../core/Logger.js";import{isSome as l}from"../core/maybe.js";import{eachAlways as p,onAbortOrThrow as m,isAbortError as h,all as c}from"../core/promiseUtils.js";import{property as u}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/has.js";import{cast as d}from"../core/accessorSupport/decorators/cast.js";import{subclass as y}from"../core/accessorSupport/decorators/subclass.js";import{ensureType as g}from"../core/accessorSupport/ensureType.js";import{h as v}from"../chunks/vec3.js";import{c as b}from"../chunks/vec3f64.js";import w from"../layers/Layer.js";import{isOperationalLayer as f}from"../layers/mixins/OperationalLayer.js";import{ensureType as L,clonePreservingTiledLayers as j}from"../support/basemapUtils.js";import{moduloPositive as T}from"../views/3d/support/mathUtils.js";import{toCamera as _}from"../views/3d/support/viewpointUtils.js";import{TaskPriority as C}from"../views/support/Scheduler.js";import{SlideThumbnail as S}from"../webdoc/support/SlideThumbnail.js";import U from"./Lighting.js";import V from"./support/Description.js";import{SlideEnvironment as x}from"./support/SlideEnvironment.js";import D from"./support/SlideGround.js";import{SlideVisibleLayer as E}from"./support/SlideVisibleLayer.js";import I from"./support/Title.js";let k=0;const O=s.ofType(E),R=a.getLogger("esri.webscene.Slide");let A=class extends o{constructor(e){super(e),this.id=Date.now().toString(16)+"-slide-"+k++,this.title=new I,this.description=new V,this.thumbnail=new S,this.viewpoint=null,this.basemap=null,this.ground=null,this.environment=new x,this.visibleLayers=new O}destroy(){this.visibleLayers.removeAll(),this.basemap=null,this.thumbnail&&this.thumbnail.destroy(),this.description=null,this.title=null,this.thumbnail=null}castTitle(e){return"string"==typeof e?new I({text:e}):g(I,e)}castDescription(e){return"string"==typeof e?new V({text:e}):g(V,e)}castThumbnail(e){return"string"==typeof e?new S({url:e}):g(S,e)}castBasemap(e){return L(e)}set visibleLayers(e){this._set("visibleLayers",n(e,this._get("visibleLayers"),O))}castVisibleLayers(e){return e&&"function"==typeof e.map?e.map((e=>{if("string"==typeof e)return{id:e};if(e instanceof w){const t=M(e);return{id:e.id,sublayerIds:t}}return e.id?{id:e.id,sublayerIds:e.sublayerIds}:(R.warn('Invalid visible layer, expected { id }, Layer or "id"'),e)})):null}clone(){return new(0,this.constructor)({id:this.id,title:this.title.clone(),thumbnail:this.thumbnail.clone(),description:this.description&&this.description.clone()||null,viewpoint:this.viewpoint&&this.viewpoint.clone()||null,basemap:this.basemap&&this.basemap.clone()||null,ground:this.ground&&this.ground.clone()||null,visibleLayers:this.visibleLayers.clone(),environment:this.environment&&this.environment.clone()||null})}_updateVisibleLayersFrom(e){const t=[];return p(this._getLayers(e.map).map((i=>e.whenLayerView(i).then((e=>{if(e.visible){const r=M(i);t.push(new E({id:e.layer.id,sublayerIds:r}))}})))).toArray()).then((()=>{this.visibleLayers.removeAll(),this.visibleLayers.addMany(t)}))}updateFrom(e,t){return t={screenshot:{format:"png",quality:80,width:120,height:75,disableDecorations:!0,...t&&t.screenshot}},e.when((()=>(this.viewpoint=e.viewpoint.clone(),this.environment.lighting=U.prototype.clone.apply(e.environment.lighting),this.basemap=e.map.basemap&&e.map.basemap.clone()||null,this.ground=e.map.ground?D.fromGround(e.map.ground):null,this._updateVisibleLayersFrom(e)))).then((()=>e.takeScreenshot(t.screenshot))).then((e=>(this.thumbnail=new S({url:e.dataUrl}),this)))}async applyTo(e,t){l(this._applyToController)&&this._applyToController.abort();let i=new AbortController;this._applyToController=i;const s=m(t,(()=>i.abort())),n=e.resourceController.scheduler.registerTask(C.SLIDE);let o=!1;t={animate:!0,...t,signal:this._applyToController.signal};const a=async()=>{await c([n.schedule((()=>o=this._setViewpointOfInterest(e,t))),n.schedule((()=>this._applyBasemap(e,t)),t.signal)]),await c([n.schedule((()=>this._applyLayerVisibility(e)),t.signal),n.schedule((()=>this._applyGround(e)),t.signal),n.schedule((()=>this._applyViewpoint(e,t)),t.signal)])},p=await r(e.addUpdatingPromise(a()));if(o&&(e.contentCamera=null),n.remove(),this._applyToController===i&&(this._applyToController=null),i=null,null==s||s.remove(),!1===p.ok)throw p.error;return this}async _applyBasemap(e,t){if(this.basemap){try{await this.basemap.load(t)}catch(i){if(h(i))throw i}e.map.basemap=j(this.basemap,e.map.basemap)}}_applyGround(e){this.ground&&(e.map.ground=this.ground.cloneAndApplyTo(e.map.ground))}_getLayers(e){const t=new s;return this._collectLayers(e,t),this._collectLayers(e.ground,t),t}_collectLayers(e,t){e.layers.forEach((e=>{f(e)&&(t.add(e),"layers"in e&&this._collectLayers(e,t))}))}_applyLayerVisibility(e){if(!this.visibleLayers)return;this._getLayers(e.map).forEach((e=>{const t=this.visibleLayers.find((t=>t.id===e.id));e.visible=null!=t;const i=t&&t.sublayerIds,r=q(e);i&&r&&r.forEach((e=>e.visible=i.indexOf(e.id)>=0))}))}_setViewpointOfInterest(e,t){if(e.state.fixedContentCamera||!this.viewpoint||t.ignoreViewpoint||!t.useDestinationCamera)return!1;const i=_(e,this.viewpoint);return e.contentCamera=i,l(i)}async _applyViewpoint(e,t){if(this.viewpoint&&!t.ignoreViewpoint){if(l(this.viewpoint.camera)&&(this.viewpoint.camera.fov=e.camera.fov),t.animate&&this.get("environment.lighting.date"))return void await this._animateToLighting(e,t);t.animate&&(e.environment.applyLighting(this.environment.lighting.clone()),await e.goTo(this.viewpoint,t)),e.viewpoint=this.viewpoint}e.environment.applyLighting(this.environment.lighting.clone())}async _animateToLighting(e,t){let i=null;"global"===e.viewingMode&&(i=this._animateLightingWithCamera(e)),e.environment.lighting.cameraTrackingEnabled=!1,e.environment.lighting.directShadowsEnabled=this.environment.lighting.directShadowsEnabled,null!=this.environment.lighting.displayUTCOffset&&(e.environment.lighting.displayUTCOffset=this.environment.lighting.displayUTCOffset);const r=e.goTo(this.viewpoint,t),s=()=>{i&&i.remove(),e.environment.lighting.cameraTrackingEnabled=!0};return r.then((()=>{e.environment.applyLighting(this.environment.lighting.clone()),s()}),(e=>{throw s(),e}))}_getTime(e){return[e.getTime(),3600*e.getUTCHours()+60*e.getUTCMinutes()+e.getUTCSeconds()]}_setTime(e,t,i){return e.setTime(t),e.setUTCHours(i/3600),e.setUTCMinutes(i%3600/60),e.setUTCSeconds(i%3600%60),e}_animateLightingWithCamera(e){const t=new Date(e.environment.lighting.date.toString()),[i,r]=this._getTime(t),[s,n]=this._getTime(this.environment.lighting.date),o=G(r,n),a=e.renderCoordsHelper,p=b();a.toRenderCoords(e.camera.position,p);const m=b(),h=b();l(this.viewpoint.camera)&&a.toRenderCoords(this.viewpoint.camera.position,m);const c=new Date;return e.watch("camera",(t=>{a.toRenderCoords(t.position,h);const n=v(p,h),l=v(m,h);let u=0;n+l!==0&&(u=n/(n+l));const d=i+(s-i)*u,y=H(r,o*u);e.environment.lighting.date=this._setTime(c,d,y)}))}static createFrom(e,t){return(new this).updateFrom(e,t)}};function q(e){if("building-scene"===e.type||"map-image"===e.type)return e.allSublayers.toArray()}function M(e){const t=q(e);if(t)return t.filter((e=>e.visible)).map((e=>e.id))}e([u({type:String,json:{write:{isRequired:!0}}})],A.prototype,"id",void 0),e([u({type:I,json:{default:()=>new I({text:""}),write:{isRequired:!0}}})],A.prototype,"title",void 0),e([d("title")],A.prototype,"castTitle",null),e([u({type:V,json:{write:{overridePolicy:e=>({enabled:!(!e||!e.text)})}}})],A.prototype,"description",void 0),e([d("description")],A.prototype,"castDescription",null),e([u({type:S,json:{default:()=>new S({url:""}),write:{isRequired:!0}}})],A.prototype,"thumbnail",void 0),e([d("thumbnail")],A.prototype,"castThumbnail",null),e([u({type:i,nonNullable:!0,json:{write:{isRequired:!0}}})],A.prototype,"viewpoint",void 0),e([u({type:t,json:{read:{source:"baseMap"},write:{target:"baseMap"}}})],A.prototype,"basemap",void 0),e([d("basemap")],A.prototype,"castBasemap",null),e([u({type:D,json:{write:!0}})],A.prototype,"ground",void 0),e([u({type:O,json:{write:{isRequired:!0}}})],A.prototype,"visibleLayers",null),e([d("visibleLayers")],A.prototype,"castVisibleLayers",null),e([u({type:x,json:{write:!0}})],A.prototype,"environment",void 0),A=e([y("esri.webscene.Slide")],A);const B=86400,F=43200;function G(e,t){let i=t-e;return i>F&&(i-=B),i<-F&&(i+=B),i}function H(e,t){return T(e+t,B)}const N=A;export{N as default};
|
package/webscene/Version.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{Version as s}from"../core/Version.js";class e extends s{constructor(s,e){super(s,e,"webscene")}get supportsGround(){return this.since(1,8)}get supportsVisibleElevationLayersInSlides(){return this.lessThan(1,8)}}export{e as Version
|
|
5
|
+
import{Version as s}from"../core/Version.js";class e extends s{constructor(s,e){super(s,e,"webscene")}get supportsGround(){return this.since(1,8)}get supportsVisibleElevationLayersInSlides(){return this.lessThan(1,8)}}export{e as Version};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as r}from"../../chunks/tslib.es6.js";import{JSONSupport as s}from"../../core/JSONSupport.js";import{clone as e}from"../../core/lang.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import{Integer as t}from"../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";var i;let c=i=class extends s{constructor(r){super(r),this.id="",this.sublayerIds=null}clone(){return new i({id:this.id,sublayerIds:e(this.sublayerIds)})}};r([o({type:String,json:{write:!0}})],c.prototype,"id",void 0),r([o({type:[t],json:{read:{source:"subLayerIds"},write:{target:"subLayerIds"}}})],c.prototype,"sublayerIds",void 0),c=i=r([p("esri.webscene.support.SlideVisibleLayer")],c);
|
|
5
|
+
import{_ as r}from"../../chunks/tslib.es6.js";import{JSONSupport as s}from"../../core/JSONSupport.js";import{clone as e}from"../../core/lang.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import{Integer as t}from"../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";var i;let c=i=class extends s{constructor(r){super(r),this.id="",this.sublayerIds=null}clone(){return new i({id:this.id,sublayerIds:e(this.sublayerIds)})}};r([o({type:String,json:{write:!0}})],c.prototype,"id",void 0),r([o({type:[t],json:{read:{source:"subLayerIds"},write:{target:"subLayerIds"}}})],c.prototype,"sublayerIds",void 0),c=i=r([p("esri.webscene.support.SlideVisibleLayer")],c);export{c as SlideVisibleLayer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../Viewpoint.js";import o from"../../core/Collection.js";import i from"../../core/Error.js";import r from"../../core/Evented.js";import a from"../../core/Logger.js";import{isSome as s}from"../../core/maybe.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{cast as c}from"../../core/accessorSupport/decorators/cast.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import p
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../Viewpoint.js";import o from"../../core/Collection.js";import i from"../../core/Error.js";import r from"../../core/Evented.js";import a from"../../core/Logger.js";import{isSome as s}from"../../core/maybe.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{cast as c}from"../../core/accessorSupport/decorators/cast.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import{SlideThumbnail as p}from"../../webdoc/support/SlideThumbnail.js";import m from"../../webmap/Bookmark.js";import{GoToMixin as u}from"../support/GoTo.js";const k="esri.widgets.Bookmarks.BookmarksViewModel",d=a.getLogger(k),v=o.ofType(m),w={width:128,height:128,format:"png"},h={takeScreenshot:!0,captureViewpoint:!0,captureRotation:!0,captureScale:!0,captureTimeExtent:!0},b={time:!0};let f=class extends(u(r.EventedAccessor)){constructor(t){super(t),this.abilities={...b},this.activeBookmark=null}destroy(){this.view=null,this._set("activeBookmark",null)}castAbilities(t){return{...b,...t}}set bookmarks(t){void 0!==t?this._override("bookmarks",t):this._clearOverride("bookmarks")}get bookmarks(){return this.get("view.map.bookmarks")||new v}set defaultCreateOptions(t){this._set("defaultCreateOptions",{...h,...t})}get defaultCreateOptions(){return h}set defaultEditOptions(t){this._set("defaultEditOptions",{...h,...t})}get defaultEditOptions(){return h}get state(){const t=this.get("view");return t&&!t.ready?"loading":"ready"}get view(){return this._get("view")}set view(t){t&&"2d"!==t.type&&d.error(new i("view:invalid-view","SceneView is not supported",{view:t})),this._set("view",t)}async createBookmark(t){const{view:e,defaultCreateOptions:o,abilities:r}=this;if(!e){const t=new i("create-bookmark:invalid-view","Cannot create a bookmark without a view.");return d.error(t),Promise.reject(t)}const{takeScreenshot:a,screenshotSettings:n,captureViewpoint:c,captureRotation:l,captureScale:p,captureTimeExtent:u}={...o,...t},k=a?await this._createThumbnail(n):void 0,v=r.time&&u&&s(e.timeExtent)?e.timeExtent.clone():void 0;return new m({...k&&{thumbnail:k},...u&&{timeExtent:v},...c&&{viewpoint:this._createViewpoint({view:e,captureScale:p,captureRotation:l})}})}async editBookmark(t,e){const{view:o,defaultEditOptions:r}=this;if(!o){const t=new i("edit-bookmark:invalid-view","Cannot edit a bookmark without a view.");return d.error(t),Promise.reject(t)}const{takeScreenshot:a,screenshotSettings:n,captureViewpoint:c,captureRotation:l,captureScale:p,captureTimeExtent:m}={...r,...e},u=a?await this._createThumbnail(n):void 0;return u&&(t.thumbnail=u),c&&(t.viewpoint=this._createViewpoint({view:o,captureScale:p,captureRotation:l})),m&&s(o.timeExtent)&&(t.timeExtent=o.timeExtent.clone()),this.emit("bookmark-edit",{bookmark:t}),t}goTo(t){const{abilities:e,view:o}=this;if(!o){const t=new i("go-to:invalid-view","Cannot go to a bookmark without a view");return d.error(t),Promise.reject(t)}const r=null==t?void 0:t.viewpoint;if(!r){const e=new i("go-to:invalid-bookmark","Cannot go to a bookmark that does not contain a 'viewpoint'.",{bookmark:t});return d.error(e),Promise.reject(e)}this._set("activeBookmark",t);const a={target:r},s=this.callGoTo(a),n=null==t?void 0:t.timeExtent;return e.time&&n&&(o.timeExtent=n),this.emit("bookmark-select",{bookmark:t}),s.catch((()=>{})).then((()=>this._set("activeBookmark",null))),s}async _createThumbnail(t){const e=await this.view.takeScreenshot({...w,...t});return new p({url:e.dataUrl})}_createViewpoint({view:t,captureRotation:o,captureScale:i}){var r,a;const s=null==(r=t.viewpoint)?void 0:r.clone();return new e({targetGeometry:null==(a=t.extent)?void 0:a.clone(),rotation:o&&(null==s?void 0:s.rotation)||0,scale:i&&(null==s?void 0:s.scale)||0})}};t([n()],f.prototype,"abilities",void 0),t([c("abilities")],f.prototype,"castAbilities",null),t([n({readOnly:!0})],f.prototype,"activeBookmark",void 0),t([n({type:v})],f.prototype,"bookmarks",null),t([n()],f.prototype,"defaultCreateOptions",null),t([n()],f.prototype,"defaultEditOptions",null),t([n({readOnly:!0})],f.prototype,"state",null),t([n({value:null})],f.prototype,"view",null),f=t([l(k)],f);const g=f;export{g as default};
|