@arcgis/core 5.1.0-next.74 → 5.1.0-next.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/arcade/ArcadePortal.js +1 -1
- package/arcade/functions/aiServices.js +1 -1
- package/arcade/functions/featuresetbase.js +1 -1
- package/arcade/functions/geomasync.js +1 -1
- package/arcade/functions/knowledgegraph.js +1 -1
- package/arcade/functions/string.js +1 -1
- package/arcade/languageUtils.js +1 -1
- package/arcade/portalUtils.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/07aca5ecad659d55e795.js +2 -0
- package/assets/esri/core/workers/chunks/09630888267cde87654f.js +1 -0
- package/assets/esri/core/workers/chunks/0fa207c68dfd7ddee160.js +1 -0
- package/assets/esri/core/workers/chunks/146424b5717d0a645ee1.js +1 -0
- package/assets/esri/core/workers/chunks/{d00dafad202450e6ee2e.js → 14eb2cc8e2ad6d8d03fd.js} +1 -1
- package/assets/esri/core/workers/chunks/1765dfeac20e34ce25b7.js +1 -0
- package/assets/esri/core/workers/chunks/176dd195f77b98cb0b0f.js +1 -0
- package/assets/esri/core/workers/chunks/1906416c84bab369bbd6.js +1 -0
- package/assets/esri/core/workers/chunks/{b98c24229463029504e8.js → 1f6b7626f333809837ef.js} +1 -1
- package/assets/esri/core/workers/chunks/1ff3c15a51c4dc991806.js +1 -0
- package/assets/esri/core/workers/chunks/2a2e97918524e0f436d7.js +1 -0
- package/assets/esri/core/workers/chunks/2b0b398180ed98c2c84c.js +1 -0
- package/assets/esri/core/workers/chunks/{bab23b905678e42815e5.js → 312036c89a6a09bb06c2.js} +1 -1
- package/assets/esri/core/workers/chunks/{37091cf498a16ccad7ff.js → 330b47ac0759c3c35cc5.js} +1 -1
- package/assets/esri/core/workers/chunks/34b6b5dd415c68f0b0d1.js +1 -0
- package/assets/esri/core/workers/chunks/{a270960d80d8344dd75f.js → 34ea3ed78041437a8fc8.js} +1 -1
- package/assets/esri/core/workers/chunks/384c235d36f32769e32b.js +1 -0
- package/assets/esri/core/workers/chunks/3a183259805638c25363.js +1 -0
- package/assets/esri/core/workers/chunks/{deaca3cd202851ecf9c2.js → 3cce9dad8ee0e4971d50.js} +1 -1
- package/assets/esri/core/workers/chunks/3efbb684c0409955186d.js +1 -0
- package/assets/esri/core/workers/chunks/40d251b6b42a41d68bd2.js +1 -0
- package/assets/esri/core/workers/chunks/42336e0d1ef88737b078.js +1 -0
- package/assets/esri/core/workers/chunks/47b3a5213539548ff3a6.js +1 -0
- package/assets/esri/core/workers/chunks/4a23b27bfbcfa08fd9a7.js +1 -0
- package/assets/esri/core/workers/chunks/52b3a11c962810bc6dbe.js +1 -0
- package/assets/esri/core/workers/chunks/53750e85f3128993a43a.js +1 -0
- package/assets/esri/core/workers/chunks/{4bbe684050b3b04681d0.js → 537fe2522dff1e6ce03b.js} +1 -1
- package/assets/esri/core/workers/chunks/55fd201ca5e10c6e4761.js +1 -0
- package/assets/esri/core/workers/chunks/56941e8bbd2d49bf2656.js +1 -0
- package/assets/esri/core/workers/chunks/5d8e944b192aad4cf986.js +1 -0
- package/assets/esri/core/workers/chunks/{5476c2f7b83f4ccd0335.js → 5e1b847b116d21908a54.js} +1 -1
- package/assets/esri/core/workers/chunks/5ed8d8b5336c81fbcda3.js +1 -0
- package/assets/esri/core/workers/chunks/60915a3708a34da1977e.js +1 -0
- package/assets/esri/core/workers/chunks/61c523dd9d8027922465.js +1 -0
- package/assets/esri/core/workers/chunks/65c61171e6c6be5c5c2f.js +1 -0
- package/assets/esri/core/workers/chunks/6a3d207308b29651f397.js +1 -0
- package/assets/esri/core/workers/chunks/6c35583707f5c339ee99.js +1 -0
- package/assets/esri/core/workers/chunks/702e8468836863abd81b.js +1 -0
- package/assets/esri/core/workers/chunks/7540f7df86620f067b5a.js +1 -0
- package/assets/esri/core/workers/chunks/76e34f81bb4a7b0e694c.js +1 -0
- package/assets/esri/core/workers/chunks/7b6c8be59ed87e386aa4.js +1 -0
- package/assets/esri/core/workers/chunks/7c820c5f6f05480d5050.js +1 -0
- package/assets/esri/core/workers/chunks/80f4f686ce403cb2693f.js +1 -0
- package/assets/esri/core/workers/chunks/852f4cd514008fee5a55.js +1 -0
- package/assets/esri/core/workers/chunks/8a3bff0f58483c1665f9.js +1 -0
- package/assets/esri/core/workers/chunks/8b046e28f879079caada.js +1 -0
- package/assets/esri/core/workers/chunks/8d738e9acc2f222235ea.js +1 -0
- package/assets/esri/core/workers/chunks/9103eb0b9078019d3a26.js +1 -0
- package/assets/esri/core/workers/chunks/915e2711d3a2cfa402b2.js +1 -0
- package/assets/esri/core/workers/chunks/91f9e0e3662d4bf9f163.js +1 -0
- package/assets/esri/core/workers/chunks/99c161fecae710b53b40.js +1 -0
- package/assets/esri/core/workers/chunks/99d298d0039c536fcf3e.js +1 -0
- package/assets/esri/core/workers/chunks/9a5ef33d99a8f89956ff.js +1 -0
- package/assets/esri/core/workers/chunks/9d10db72e342fe63c981.js +1 -0
- package/assets/esri/core/workers/chunks/{a36761e3122f70fbb3c9.js → 9d6491f996eeb0c646ed.js} +1 -1
- package/assets/esri/core/workers/chunks/a015c2f54eb91e43a1f4.js +1 -0
- package/assets/esri/core/workers/chunks/a242ec19a7508de436da.js +1 -0
- package/assets/esri/core/workers/chunks/a320998f18922a35899f.js +1 -0
- package/assets/esri/core/workers/chunks/a7f9f478bd1493fc3c76.js +1 -0
- package/assets/esri/core/workers/chunks/aac6a57edd7494125204.js +1 -0
- package/assets/esri/core/workers/chunks/b73c146d3e550eaf07eb.js +1 -0
- package/assets/esri/core/workers/chunks/b7af0e6b9aadbcaf6a0b.js +1 -0
- package/assets/esri/core/workers/chunks/b803e7b0d489bb628d72.js +1 -0
- package/assets/esri/core/workers/chunks/baeb96aef03d4c566af7.js +1 -0
- package/assets/esri/core/workers/chunks/bc75ab48f4c7609ef09d.js +1 -0
- package/assets/esri/core/workers/chunks/bc78937986854e500b8e.js +1 -0
- package/assets/esri/core/workers/chunks/bd10d21545bca9a49de0.js +1 -0
- package/assets/esri/core/workers/chunks/{b905e637a67fbb7af4ae.js → bf8f603848bad4a7deb4.js} +1 -1
- package/assets/esri/core/workers/chunks/bfe575da727ce7c8d331.js +2 -0
- package/assets/esri/core/workers/chunks/c31ee5617c61a933cb0e.js +1 -0
- package/assets/esri/core/workers/chunks/cb45e5d4a4ef82cda583.js +1 -0
- package/assets/esri/core/workers/chunks/ce7ef7c4ca14d66d96f6.js +1 -0
- package/assets/esri/core/workers/chunks/{5b324e572737a308500d.js → cf14b3a44705dacefac4.js} +1 -1
- package/assets/esri/core/workers/chunks/d3b086eb9aa8c7d09048.js +1 -0
- package/assets/esri/core/workers/chunks/d55cef8199b8246fea3f.js +1 -0
- package/assets/esri/core/workers/chunks/d8decaee2c780e1b5e35.js +1 -0
- package/assets/esri/core/workers/chunks/{41809c16544ec25120fa.js → d95ffd990b3a7df69e1e.js} +1 -1
- package/assets/esri/core/workers/chunks/dc54d4a9fe1691862356.js +1 -0
- package/assets/esri/core/workers/chunks/dda2cb5c073d1e65f14f.js +1 -0
- package/assets/esri/core/workers/chunks/e18badd11f360cc2912b.js +1 -0
- package/assets/esri/core/workers/chunks/{ad064583f8a836005098.js → e262c4864dc06c43b380.js} +1 -1
- package/assets/esri/core/workers/chunks/e610d24539a675fb054b.js +1 -0
- package/assets/esri/core/workers/chunks/e9c5c295b6bf10e942a4.js +1 -0
- package/assets/esri/core/workers/chunks/ea59b81299acaf0d85ee.js +1 -0
- package/assets/esri/core/workers/chunks/{873c1b705ac3d4e6c384.js → ea97619a4470f1540b99.js} +1 -1
- package/assets/esri/core/workers/chunks/eaab5ac049622986e3bc.js +1 -0
- package/assets/esri/core/workers/chunks/edee616b6f1b5be8fd39.js +1 -0
- package/assets/esri/core/workers/chunks/ef0085aa743b33cb549f.js +1 -0
- package/assets/esri/core/workers/chunks/f0250cecb243b32cdba7.js +1 -0
- package/assets/esri/core/workers/chunks/f518835b2dc89a48cfb1.js +1 -0
- package/assets/esri/core/workers/chunks/f6c8e93ca2987e83f925.js +1 -0
- package/assets/esri/themes/base/widgets/_Sketch.scss +32 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_en.json +1 -1
- package/chunks/MultiPathImpl.js +1 -1
- package/chunks/Point2D.js +1 -1
- package/chunks/SpatialReference.js +1 -1
- package/chunks/aiServices.js +1 -1
- package/chunks/languageUtils.js +1 -1
- package/config.js +1 -1
- package/core/workers/registry.js +1 -1
- package/form/elements/AttachmentElement.d.ts +15 -16
- package/form/elements/GroupElement.d.ts +3 -2
- package/form/elements/inputs/attachments/AttachmentInput.d.ts +7 -9
- package/form/elements/inputs/attachments/AudioInput.d.ts +6 -8
- package/form/elements/inputs/attachments/DocumentInput.d.ts +5 -7
- package/form/elements/inputs/attachments/ImageInput.d.ts +6 -8
- package/form/elements/inputs/attachments/Input.d.ts +2 -6
- package/form/elements/inputs/attachments/SignatureInput.d.ts +5 -7
- package/form/elements/inputs/attachments/VideoInput.d.ts +6 -8
- package/form/elements/inputs/attachments/types.d.ts +3 -3
- package/geometry/FlatGeometry.js +1 -1
- package/geometry/operators/projectOperator.js +1 -1
- package/graphic/ImageryGraphicOrigin.js +1 -1
- package/graphic/ImageryTileGraphicOrigin.js +1 -1
- package/graphic/WCSGraphicOrigin.js +1 -1
- package/kernel.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/package.json +4 -4
- package/popup/Features.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/CIMSymbolHelper.js +1 -1
- package/symbols/cim/CIMSymbolRasterizer.js +1 -1
- package/symbols/support/previewCIMSymbol.js +1 -1
- package/views/2d/analysis/AreaMeasurement/AreaMeasurementController.js +1 -1
- package/views/2d/engine/webgl/TextureManager.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/2d/layers/features/schema/processor/symbols/ComplexSymbolSchema.js +1 -1
- package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
- package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
- package/views/3d/analysis/Dimension/DimensionController.js +1 -1
- package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementController.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
- package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
- package/views/3d/interactive/editingTools/transform/extentTransform/ExtentMove.js +1 -1
- package/views/3d/interactive/editingTools/transform/extentTransform/ExtentScale.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/VideoView.js +1 -1
- package/views/draw/DrawGraphicTool.js +1 -1
- package/views/draw/DrawTool.js +1 -1
- package/views/draw/support/Box.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/views/draw/support/managers/MeasurementManager.js +1 -1
- package/views/interactive/SegmentLabels.js +1 -1
- package/views/interactive/snapping/SelfSnappingEngine.js +1 -1
- package/views/support/GeometryWorker.js +2 -0
- package/views/support/GeometryWorkerHandle.js +2 -0
- package/widgets/FeatureTable/FeatureTableViewModel.d.ts +1 -3
- package/widgets/FeatureTable/Grid/GridViewModel.d.ts +2 -11
- package/widgets/FeatureTable/support/types.d.ts +2 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerVisibleElements.d.ts +28 -0
- package/widgets/OrientedImageryViewer/OrientedImageryViewerVisibleElements.js +1 -1
- package/widgets/OrientedImageryViewer.d.ts +27 -0
- package/widgets/Sketch/SketchViewModel.d.ts +10 -2
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/Sketch/support/ResponsiveToolbar/MeasuredContentGroup.js +1 -1
- package/widgets/Sketch/support/ResponsiveToolbar/ResponsiveToolbar.js +1 -1
- package/widgets/Sketch.js +1 -1
- package/assets/esri/core/workers/chunks/00bae4b7e179336e0362.js +0 -1
- package/assets/esri/core/workers/chunks/041c372e98a6fba90b36.js +0 -1
- package/assets/esri/core/workers/chunks/0783890816bac45277b9.js +0 -1
- package/assets/esri/core/workers/chunks/07aac6245a0d1adbb2d4.js +0 -1
- package/assets/esri/core/workers/chunks/1286f41f245ef22b3a26.js +0 -1
- package/assets/esri/core/workers/chunks/12e575a6d2b008b8fc2b.js +0 -1
- package/assets/esri/core/workers/chunks/161d60fdac2013c15543.js +0 -1
- package/assets/esri/core/workers/chunks/168de44a789d1cecc1f8.js +0 -1
- package/assets/esri/core/workers/chunks/1d9d7915cf7449e5d468.js +0 -1
- package/assets/esri/core/workers/chunks/1db1656a033f3992f0d6.js +0 -1
- package/assets/esri/core/workers/chunks/235cb82952a18ff8d206.js +0 -1
- package/assets/esri/core/workers/chunks/27b80c386cebadcaca3c.js +0 -1
- package/assets/esri/core/workers/chunks/29d3890a5a43d934067a.js +0 -1
- package/assets/esri/core/workers/chunks/2f17438d215bea3ce70f.js +0 -1
- package/assets/esri/core/workers/chunks/356cb86606b8c674f947.js +0 -1
- package/assets/esri/core/workers/chunks/398e0dd2bc7e1ab84831.js +0 -1
- package/assets/esri/core/workers/chunks/3b1052aa30af3f6186cc.js +0 -1
- package/assets/esri/core/workers/chunks/3e87e3ad857d72f6ecbb.js +0 -1
- package/assets/esri/core/workers/chunks/42e483fde18f12da32a6.js +0 -1
- package/assets/esri/core/workers/chunks/43ab44d37bc0ea97ef98.js +0 -1
- package/assets/esri/core/workers/chunks/488ed9584b527ec47be3.js +0 -1
- package/assets/esri/core/workers/chunks/4ad32580e0c0699fde1f.js +0 -1
- package/assets/esri/core/workers/chunks/4c13869d260a902d3014.js +0 -1
- package/assets/esri/core/workers/chunks/54ed37ec9682ea739deb.js +0 -1
- package/assets/esri/core/workers/chunks/5511e640e171c294f52a.js +0 -2
- package/assets/esri/core/workers/chunks/55369c5bd65bcaf78da1.js +0 -1
- package/assets/esri/core/workers/chunks/56fd3da911c2c4511e5d.js +0 -1
- package/assets/esri/core/workers/chunks/59592bb25f226865e88a.js +0 -1
- package/assets/esri/core/workers/chunks/5d55b4449bcb24cd72b6.js +0 -1
- package/assets/esri/core/workers/chunks/5d8fe41a3c06ddb4094b.js +0 -1
- package/assets/esri/core/workers/chunks/608d707fd9d9f9088473.js +0 -1
- package/assets/esri/core/workers/chunks/6a21c9a4aeebe806ea39.js +0 -1
- package/assets/esri/core/workers/chunks/6c7ff968bd4fc816442d.js +0 -1
- package/assets/esri/core/workers/chunks/6d11ec355e5474b2968b.js +0 -1
- package/assets/esri/core/workers/chunks/6d25230dd85a4ba54c4f.js +0 -1
- package/assets/esri/core/workers/chunks/7027d93dc5a4595d70c6.js +0 -1
- package/assets/esri/core/workers/chunks/70b35b2446558d5280e3.js +0 -1
- package/assets/esri/core/workers/chunks/7349cb45a93e6916f115.js +0 -1
- package/assets/esri/core/workers/chunks/76edaeaf8fe344bb77a8.js +0 -1
- package/assets/esri/core/workers/chunks/76fe5b821d6b54db5721.js +0 -1
- package/assets/esri/core/workers/chunks/7951d93f5f15aa76f49c.js +0 -1
- package/assets/esri/core/workers/chunks/7a56c836c89a8b978800.js +0 -1
- package/assets/esri/core/workers/chunks/81d30c9062ad0120a863.js +0 -1
- package/assets/esri/core/workers/chunks/88c5f7c712c6b89b5109.js +0 -1
- package/assets/esri/core/workers/chunks/88e469b82d2594f23649.js +0 -1
- package/assets/esri/core/workers/chunks/8a8242e7cc7e6a9e7876.js +0 -1
- package/assets/esri/core/workers/chunks/9444ed8ea117861ae89b.js +0 -1
- package/assets/esri/core/workers/chunks/9a38fd68b02b617c45d3.js +0 -1
- package/assets/esri/core/workers/chunks/9be9ccce6369f67202bc.js +0 -1
- package/assets/esri/core/workers/chunks/a37c28e3c4a2be9fd1d5.js +0 -1
- package/assets/esri/core/workers/chunks/a8d7f59927bdad564141.js +0 -1
- package/assets/esri/core/workers/chunks/a94bd20551c1179c7ec5.js +0 -1
- package/assets/esri/core/workers/chunks/a9d2c83bb10b5ade0ca0.js +0 -1
- package/assets/esri/core/workers/chunks/abe22ae8ee0dcc9efbb7.js +0 -1
- package/assets/esri/core/workers/chunks/b702279c48f3009f6dd8.js +0 -1
- package/assets/esri/core/workers/chunks/bc887bd62579dba81e2b.js +0 -1
- package/assets/esri/core/workers/chunks/be0341567bb19e101a4f.js +0 -1
- package/assets/esri/core/workers/chunks/be1d6a571f76933dfbb0.js +0 -1
- package/assets/esri/core/workers/chunks/bfcdc5c315131aae34d8.js +0 -1
- package/assets/esri/core/workers/chunks/c0f624a2ca0d07ef8f8c.js +0 -1
- package/assets/esri/core/workers/chunks/c327fe276238af60fda4.js +0 -1
- package/assets/esri/core/workers/chunks/c5f155fe114a2a05aaf2.js +0 -2
- package/assets/esri/core/workers/chunks/c61002a117dc2218d6af.js +0 -1
- package/assets/esri/core/workers/chunks/c804a66ef7615aa8de89.js +0 -1
- package/assets/esri/core/workers/chunks/cb5e4b9b4a59c2622eb5.js +0 -1
- package/assets/esri/core/workers/chunks/d201a5dff18a5bb467ab.js +0 -1
- package/assets/esri/core/workers/chunks/d21fdd67477800101f3b.js +0 -1
- package/assets/esri/core/workers/chunks/db588bf3256e95c977b7.js +0 -1
- package/assets/esri/core/workers/chunks/dfdd474fddcd1d6091ce.js +0 -1
- package/assets/esri/core/workers/chunks/e235ea4293d5d463acfb.js +0 -1
- package/assets/esri/core/workers/chunks/e43486113aaf72ac4dc1.js +0 -1
- package/assets/esri/core/workers/chunks/ea4c3393c5757e309a71.js +0 -1
- package/assets/esri/core/workers/chunks/ed216ddeb7f59f510bd0.js +0 -1
- package/assets/esri/core/workers/chunks/ef8886dff54063928bcb.js +0 -1
- package/assets/esri/core/workers/chunks/f43a63094190d2074cd0.js +0 -1
- package/assets/esri/core/workers/chunks/f5223ffb3be548c9b0a1.js +0 -1
- package/views/support/MeasurementWorker.js +0 -2
- package/views/support/MeasurementWorkerHandle.js +0 -2
- /package/assets/esri/core/workers/chunks/{5511e640e171c294f52a.js.LICENSE.txt → 07aca5ecad659d55e795.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{c5f155fe114a2a05aaf2.js.LICENSE.txt → bfe575da727ce7c8d331.js.LICENSE.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{isSome as s}from"../../../../core/arrayUtils.js";import has from"../../../../core/has.js";import{IdentifiableMixin as r}from"../../../../core/Identifiable.js";import{assertIsSome as i}from"../../../../core/maybe.js";import{ignoreAbortErrors as o,throwIfAborted as a}from"../../../../core/promiseUtils.js";import{watch as n}from"../../../../core/reactiveUtils.js";import{property as h,subclass as d}from"../../../../core/accessorSupport/decorators.js";import{create as c}from"../../../../geometry/support/aaBoundingRect.js";import{isPolyline as l,isPolygon as p,isExtent as u,getJsonType as m}from"../../../../geometry/support/jsonTypeUtils.js";import g from"../../../../layers/support/FieldsIndex.js";import{symbolToCIM as f,CIMSymbolHelper as y}from"../../../../symbols/cim/CIMSymbolHelper.js";import{OverrideHelper as _}from"../../../../symbols/cim/OverrideHelper.js";import{errorPointSymbol2D as b,errorPolylineSymbol2D as w,errorPolygonSymbol2D as S}from"../../../../symbols/support/defaults.js";import{filterFlag0 as I}from"../../engine/webgl/definitions.js";import{FeatureTile as v}from"../../engine/webgl/FeatureTile.js";import{MeshData as T}from"../../engine/webgl/mesh/MeshData.js";import{ResourceProxy as M}from"../../engine/webgl/mesh/factories/ResourceProxy.js";import{createGraphicSymbolMeshSchemas as R}from"../../engine/webgl/shaderGraph/techniques/createGraphicSymbolMeshSchemas.js";import{createStorageSchema as j}from"../features/schema/processor/StorageSchema.js";import{AttributeStore as x}from"../features/support/AttributeStore.js";import{ComputedAttributeStorage as U}from"../features/support/ComputedAttributeStorage.js";import{GraphicsMetadata as C}from"../features/support/FeatureMetadata.js";import{GraphicsReader as q}from"../features/support/GraphicsReader.js";import G from"./GraphicStore.js";import{FeatureCommandQueue as k}from"../support/FeatureCommandQueue.js";import{UpdateTracking2D as P}from"../support/UpdateTracking2D.js";class F{static getOrCreate(e,t,s){let r=t.get(e.id);return r||(r=new F(e,s),t.set(e.id,r)),r}static fromItems(e,t,s){const r=new F(e,s);for(const i of t)r.append(i);return r}constructor(e,t){this.tile=e,this.metadata=t,this.addedOrModified=[],this.removed=[],this.objectIdMap=null}get reader(){return this._reader||(this._reader=q.from(this.addedOrModified,this.tile,this.metadata)),this._reader}append(e){this.addedOrModified.push(e),e.hasAnimations&&(this.objectIdMap=this.objectIdMap||{},this.objectIdMap[e.displayId]=e.objectId)}}let O=class extends(r(t)){constructor(e){super(e),this._attached=!1,this._tiles=new Map,this._controller=new AbortController,this._hashToSymbolInfo=new Map,this._lastCleanup=performance.now(),this._cleanupRequired=!0,this.lastUpdateId=-1,this.renderer=null,this._updateTracking=new P({debugName:"GraphicsView2D"}),this.updateRequested=!1,this.defaultPointSymbolEnabled=!0,this._commandQueue=new k({process:e=>{if("update"===e.type)return this._update();throw new Error("InternalError: Unsupported command")}}),this.graphicUpdateHandler=this.graphicUpdateHandler.bind(this)}destroy(){this.container.destroy(),this.view=null,this.renderer=null,this._set("graphics",null),this._controller.abort(),this._graphicStore.clear(),this._graphicStore.destroy(),this._attributeStore=null,this._hashToSymbolInfo.clear(),this._updateTracking.destroy(),this._commandQueue.destroy()}_initAttributeStore(){this._storage=new U({spatialReference:this.view.spatialReference,fields:new g}),this._attributeStore=new x({isLocal:!0,update:e=>{has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView2D.AttributeStoreView.updateStart`,{message:e}),this.container.attributeView.requestUpdate(e),this.container.requestRender(),has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView2D.AttributeStoreView.updateEnd`,{message:e})}});const e=j(null,[]);this._attributeStore.update(e,this._storage,null),this.container.checkHighlight=()=>this._attributeStore.hasHighlight}initialize(){this._initAttributeStore(),this._metadata=C.createGraphics(this.view.spatialReference),this._resourceProxy=new M({fetch:e=>Promise.all(e.map(e=>this.view.stage.textureManager.rasterizeItem(e))),fetchDictionary:e=>{throw new Error("InternalError: Graphics do not support Dictionary requests")}}),this.addHandles([n(()=>this._effectiveRenderer,()=>this._pushUpdate()),this.view.graphicsTileStore.on("update",this._onTileUpdate.bind(this)),this.container.on("attach",()=>{this.addHandles([this.graphics.on("change",()=>this._pushUpdate())]),this._graphicStore?.destroy(),this._graphicStore=new G(this.view.spatialReference,this._cimResourceManager,this.view.featuresTilingScheme,this.view.state.scale,this._attributeStore),this._attached=!0,this.requestUpdate(),this._pushUpdate()})]),this._updateTracking.addUpdateTracking("CommandQueue",this._commandQueue.updateTracking);const e=this.view.graphicsTileStore.tiles;this._onTileUpdate({added:e,removed:[]})}get _effectiveRenderer(){return"function"==typeof this.renderer?this.renderer():this.renderer}get _cimResourceManager(){return this.view.stage.textureManager.resourceManager}get updating(){const e=!this._attached||this._updateTracking.updating;return has("esri-2d-log-updating")&&console.log(`Updating GraphicsView2D: ${e}\n -> attaching ${!this._attached}\n -> updateTracking ${this._updateTracking.updating}`),e}hitTest(e){if(!this.view||this.view.suspended)return[];const{resolution:t,rotation:r}=this.view.state,i=this._graphicStore.hitTest(e.x,e.y,2,t,r),o=new Set(i),a=this.graphics.items.reduce((e,t)=>(o.has(t.uid)&&e.set(t.uid,t),e),new Map);return i.map(e=>a.get(e)).filter(s)}requestUpdate(){this.updateRequested||(this.updateRequested=!0,this.requestUpdateCallback()),this.notifyChange("updating")}processUpdate(e){this.updateRequested&&(this.updateRequested=!1,this.update(e))}viewChange(){this.requestUpdate()}setHighlight(e){const t=[];for(const{objectId:s,highlightFlags:r}of e){const e=this._graphicStore.getItem(s)?.displayId;t.push({objectId:s,highlightFlags:r,displayId:e})}this._attributeStore.setHighlight(t,e),this._pushUpdate()}graphicUpdateHandler(e){this._pushUpdate()}update(e){this.updateRequested=!1,this._attached&&this._graphicStore.updateLevel(e.state.resolution)&&this.pushUpdate()}pushUpdate(){this._pushUpdate()}_pushUpdate(){o(this._commandQueue.push({type:"update"}))}async _update(){try{if(has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView._update start`),this.graphics.destroyed)return;const e=await this._graphicStore.update(this.graphics,e=>this._getSymbolForGraphic(e),e=>this._ensureSymbolResource(e));for(const s of e.updated)this.container.restartAnimation(s.objectId);if(!e.hasAnyUpdate())return void this._attributeStore.sendUpdates();e.removed.length&&(this._cleanupRequired=!0),has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView updateMessage`,e);const t=this._createTileMessages(e);await this._densifyItemsForDisplay(t),await this._fetchResources(t),this._write(t);for(const s of e.added)this._setFilterState(s);for(const s of e.updated)this._setFilterState(s);has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView sendUpdate`,e),this._attributeStore.sendUpdates(),has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView sendUpdate.await`,e)}catch(e){}this._cleanupSharedResources()}_createTileMessages(e){const t=new Map;for(const s of e.added){const e=this.view.graphicsTileStore.getIntersectingTiles(s.symbolBounds);for(const r of e){F.getOrCreate(r,t,this._metadata).append(s)}}for(const s of e.updated){const e=this.view.graphicsTileStore.getIntersectingTiles(s.prevSymbolBounds),r=this.view.graphicsTileStore.getIntersectingTiles(s.symbolBounds);for(const i of e){F.getOrCreate(i,t,this._metadata).removed.push(s.displayId)}for(const i of r){F.getOrCreate(i,t,this._metadata).append(s)}}for(const s of e.removed){const e=this.view.graphicsTileStore.getIntersectingTiles(s.symbolBounds);for(const r of e){F.getOrCreate(r,t,this._metadata).removed.push(s.displayId)}}return Array.from(t.values())}async _densifyItemsForDisplay(e){const t=new Map;for(const s of e)for(const e of s.addedOrModified)t.has(e)||t.set(e,e.densifyCurvedGeometryForDisplay(this.view.spatialReference));await Promise.all(t.values())}async _fetchResources(e){const t={timeZone:null,timeExtent:null};for(const{tile:s,reader:r}of e){has("esri-2d-update-debug")&&console.debug(`Id[${this.layerId}] Tile[${s.id}] GraphicsView fetchResources`,e);const i=r.getCursor();for(;i.next();)for(const e of i.getMeshWriters())e.enqueueRequest(this._resourceProxy,i,s.createArcadeEvaluationOptions(t))}await this._resourceProxy.fetchEnqueuedResources()}_write(e){for(const t of e){has("esri-2d-update-debug")&&console.debug(`Id[${this.layerId}] Tile[${t.tile.id}] GraphicsView write`,t);const e=this._writeMeshes(t);let s=this._tiles.get(t.tile.key);s||(s=this._createFeatureTile(t.tile.key)),has("esri-2d-update-debug")&&console.debug(`Id[${this.layerId}] Tile[${t.tile.id}] GraphicsView onTileData`,t),this.container.onTileData(s,{type:"update",modify:e,remove:t.removed,end:!1,attributeEpoch:this._attributeStore.epoch,objectIdMap:t.objectIdMap}),this.container.requestRender()}}_writeMeshes(e){const t={timeZone:null,timeExtent:null},s=new T(e.tile.id),r=e.reader.getCursor();for(;r.next();){s.entityStart(r.getDisplayId(),r.getZOrder());for(const i of r.getMeshWriters())i.write(s,this._resourceProxy,r,e.tile.createArcadeEvaluationOptions(t),e.tile.level);s.entityEnd()}return{...s.serialize().message,tileId:e.tile.id,requiresRefresh:!1}}_setFilterState(e){const t=e.displayId,s=this._attributeStore.getHighlightFlags(e.objectId);this._attributeStore.setData(t,0,0,s|(e.visible?I:0))}_getSymbolForGraphic(e){return null!=e.symbol?e.symbol:null!=this._effectiveRenderer?this._effectiveRenderer.getSymbol(e):this._getNullSymbol(e)}async _ensureSymbolResource(e){if(!e.symbol)return;const t=await this._getSymbolInfo(e.symbol);if(!t)return;const s=t.linearCIM.filter(e=>"text"===e.type);if(s.length>0){const r=await this._getTextResources(e,s);return void(e.symbolResource={symbolInfo:t,textInfo:r})}e.symbolResource={symbolInfo:t}}_getSymbolInfo(e){const t=e.hash();return this._hashToSymbolInfo.has(t)||this._hashToSymbolInfo.set(t,this._createSymbolInfo(t,e).catch(e=>null)),this._hashToSymbolInfo.get(t)}async _createSymbolInfo(e,t){const s=await this._convertToCIMSymbol(t),r=await this._createLinearCIM(s);return{hash:e,cimSymbol:s,linearCIM:r,meshWriters:await this._createMeshWriters(s,r)}}async _convertToCIMSymbol(e){const t=f(e);return"web-style"===t.type?this._convertToCIMSymbol(await t.fetchSymbol({acceptedFormats:["cim","web"]})):t}async _createLinearCIM(e){return await Promise.all(y.fetchResources(e.symbol,this._cimResourceManager,[])),this.view.stage.cimAnalyzer.analyzeSymbolReference(e,!1)}async _createMeshWriters(e,t){a(this._controller.signal);const s=this.container.instanceStore,r=this.view.stage.meshWriterRegistry,i=await R(e,t,s);return Promise.all(i.map(e=>r.createMeshWriter(this._storage,this._resourceProxy,{tileInfo:this.view.featuresTilingScheme.tileInfo},e,null)))}_onTileUpdate(e){if(e.added&&e.added.length>0)for(const t of e.added)this._updateTracking.consumePromise(this._addTile(t));if(e.removed&&e.removed.length>0)for(const t of e.removed)this._removeTile(t.key)}_createFeatureTile(e){const t=this.view.featuresTilingScheme.getTileBounds(c(),e),s=this.view.featuresTilingScheme.getTileResolution(e.level),r=new v(e,s,t[0],t[3]);return this._tiles.set(e,r),this.container.addChild(r),r}async _addTile(e){if(!this._attached)return;const t=this._graphicStore.queryItems(e);if(!t.length)return;const s=this._createFeatureTile(e.key),r=F.fromItems(e,t,this._metadata);await this._densifyItemsForDisplay([r]),await this._fetchResources([r]);const i=this._writeMeshes(r);s.onMessage({type:"append",append:i,clear:!1,end:!0,attributeEpoch:this._attributeStore.epoch,objectIdMap:r.objectIdMap})}_removeTile(e){if(!this._tiles.has(e))return;const t=this._tiles.get(e);this.container.removeChild(t),t.destroy(),this._tiles.delete(e)}_getNullSymbol(e){const t=e.geometry;return t?l(t)?w:p(t)||u(t)?S:this.defaultPointSymbolEnabled?b:null:this.defaultPointSymbolEnabled?b:null}async _getTextResources(e,t){const s=new Array,r=new Array;for(let i=0;i<t.length;i++){const o=t[i],{resource:a,overrides:n}=o.textRasterizationParam;if(n?.length>0){const t=_.resolveSymbolOverrides({type:"CIMSymbolReference",primitiveOverrides:n,symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,size:a.symbol.height,anchorPointUnits:"Relative",frame:{xmin:-5,ymin:-5,xmax:5,ymax:5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{x:0,y:0},symbol:a.symbol,textString:a.textString}],scaleSymbolsProportionally:!0,respectFrame:!0}]}},e,this.view.spatialReference,null,m(e.projectedGeometry),null,null);t.then(e=>{const t=e.symbolLayers[0],{textString:s}=t.markerGraphics[0];r.push({type:"cim-rasterization-info",resource:{type:"text",textString:s||"",font:a.font}}),o.text=a.textString=s||""}),s.push(t)}else r.push({type:"cim-rasterization-info",resource:a})}s.length>0&&await Promise.all(s);const o=r.map(e=>this.view.stage.textureManager.rasterizeItem(e)),a=await Promise.all(o);i(a);const n=new Map;for(let i=0;i<t.length;i++){const e=t[i];n.set(e.textRasterizationParam.resource.symbol,{text:e.text,glyphMosaicItems:a[i]})}return n}_cleanupSharedResources(){if(!this._cleanupRequired)return;const e=performance.now();if(e-this._lastCleanup<5e3)return;this._cleanupRequired=!1,this._lastCleanup=e;const t=new Set;for(const r of this._graphicStore.items()){const e=r.symbolResource?.symbolInfo.hash;t.add(e)}const s=new Set(this._hashToSymbolInfo.keys());for(const r of s.values())t.has(r)||this._hashToSymbolInfo.delete(r)}};e([h()],O.prototype,"_effectiveRenderer",null),e([h({constructOnly:!0})],O.prototype,"layerId",void 0),e([h({constructOnly:!0})],O.prototype,"requestUpdateCallback",void 0),e([h()],O.prototype,"container",void 0),e([h({constructOnly:!0})],O.prototype,"graphics",void 0),e([h()],O.prototype,"renderer",void 0),e([h()],O.prototype,"_updateTracking",void 0),e([h()],O.prototype,"updating",null),e([h()],O.prototype,"view",void 0),e([h()],O.prototype,"updateRequested",void 0),e([h()],O.prototype,"defaultPointSymbolEnabled",void 0),O=e([d("esri.views.2d.layers.graphics.GraphicsView2D")],O);export{O as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{isSome as s}from"../../../../core/arrayUtils.js";import has from"../../../../core/has.js";import{IdentifiableMixin as r}from"../../../../core/Identifiable.js";import{assertIsSome as i}from"../../../../core/maybe.js";import{ignoreAbortErrors as o,throwIfAborted as a}from"../../../../core/promiseUtils.js";import{watch as n}from"../../../../core/reactiveUtils.js";import{property as h,subclass as d}from"../../../../core/accessorSupport/decorators.js";import{create as c}from"../../../../geometry/support/aaBoundingRect.js";import{isPolyline as l,isPolygon as p,isExtent as u,getJsonType as m}from"../../../../geometry/support/jsonTypeUtils.js";import g from"../../../../layers/support/FieldsIndex.js";import{symbolToCIM as f,CIMSymbolHelper as y}from"../../../../symbols/cim/CIMSymbolHelper.js";import{OverrideHelper as _}from"../../../../symbols/cim/OverrideHelper.js";import{errorPointSymbol2D as b,errorPolylineSymbol2D as w,errorPolygonSymbol2D as S}from"../../../../symbols/support/defaults.js";import{filterFlag0 as I}from"../../engine/webgl/definitions.js";import{FeatureTile as v}from"../../engine/webgl/FeatureTile.js";import{MeshData as T}from"../../engine/webgl/mesh/MeshData.js";import{ResourceProxy as M}from"../../engine/webgl/mesh/factories/ResourceProxy.js";import{createGraphicSymbolMeshSchemas as R}from"../../engine/webgl/shaderGraph/techniques/createGraphicSymbolMeshSchemas.js";import{createStorageSchema as j}from"../features/schema/processor/StorageSchema.js";import{AttributeStore as x}from"../features/support/AttributeStore.js";import{ComputedAttributeStorage as U}from"../features/support/ComputedAttributeStorage.js";import{GraphicsMetadata as C}from"../features/support/FeatureMetadata.js";import{GraphicsReader as q}from"../features/support/GraphicsReader.js";import G from"./GraphicStore.js";import{FeatureCommandQueue as k}from"../support/FeatureCommandQueue.js";import{UpdateTracking2D as F}from"../support/UpdateTracking2D.js";class P{static getOrCreate(e,t,s){let r=t.get(e.id);return r||(r=new P(e,s),t.set(e.id,r)),r}static fromItems(e,t,s){const r=new P(e,s);for(const i of t)r.append(i);return r}constructor(e,t){this.tile=e,this.metadata=t,this.addedOrModified=[],this.removed=[],this.objectIdMap=null}get reader(){return this._reader||(this._reader=q.from(this.addedOrModified,this.tile,this.metadata)),this._reader}append(e){this.addedOrModified.push(e),e.hasAnimations&&(this.objectIdMap=this.objectIdMap||{},this.objectIdMap[e.displayId]=e.objectId)}}let A=class extends(r(t)){constructor(e){super(e),this._attached=!1,this._tiles=new Map,this._controller=new AbortController,this._hashToSymbolInfo=new Map,this._lastCleanup=performance.now(),this._cleanupRequired=!0,this.lastUpdateId=-1,this.renderer=null,this._updateTracking=new F({debugName:"GraphicsView2D"}),this.updateRequested=!1,this.defaultPointSymbolEnabled=!0,this._commandQueue=new k({process:e=>{if("update"===e.type)return this._update();throw new Error("InternalError: Unsupported command")}}),this.graphicUpdateHandler=this.graphicUpdateHandler.bind(this)}destroy(){this.container.destroy(),this.view=null,this.renderer=null,this._set("graphics",null),this._controller.abort(),this._graphicStore.clear(),this._graphicStore.destroy(),this._attributeStore=null,this._hashToSymbolInfo.clear(),this._updateTracking.destroy(),this._commandQueue.destroy()}_initAttributeStore(){this._storage=new U({spatialReference:this.view.spatialReference,fields:new g}),this._attributeStore=new x({isLocal:!0,update:e=>{has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView2D.AttributeStoreView.updateStart`,{message:e}),this.container.attributeView.requestUpdate(e),this.container.requestRender(),has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView2D.AttributeStoreView.updateEnd`,{message:e})}});const e=j(null,[]);this._attributeStore.update(e,this._storage,null),this.container.checkHighlight=()=>this._attributeStore.hasHighlight}initialize(){this._initAttributeStore(),this._metadata=C.createGraphics(this.view.spatialReference),this._resourceProxy=new M({fetch:e=>Promise.all(e.map(e=>this.view.stage.textureManager.rasterizeItem(e))),fetchDictionary:e=>{throw new Error("InternalError: Graphics do not support Dictionary requests")}}),this.addHandles([n(()=>this._effectiveRenderer,()=>this._pushUpdate()),this.view.graphicsTileStore.on("update",this._onTileUpdate.bind(this)),this.container.on("attach",()=>{this.addHandles([this.graphics.on("change",()=>this._pushUpdate())]),this._graphicStore?.destroy(),this._graphicStore=new G(this.view.spatialReference,this._cimResourceManager,this.view.featuresTilingScheme,this.view.state.scale,this._attributeStore),this._attached=!0,this.requestUpdate(),this._pushUpdate()})]),this._updateTracking.addUpdateTracking("CommandQueue",this._commandQueue.updateTracking);const e=this.view.graphicsTileStore.tiles;this._onTileUpdate({added:e,removed:[]})}get _effectiveRenderer(){return"function"==typeof this.renderer?this.renderer():this.renderer}get _cimResourceManager(){return this.view.stage.textureManager.resourceManager}get updating(){const e=!this._attached||this._updateTracking.updating;return has("esri-2d-log-updating")&&console.log(`Updating GraphicsView2D: ${e}\n -> attaching ${!this._attached}\n -> updateTracking ${this._updateTracking.updating}`),e}hitTest(e){if(!this.view||this.view.suspended)return[];const{resolution:t,rotation:r}=this.view.state,i=this._graphicStore.hitTest(e.x,e.y,2,t,r),o=new Set(i),a=this.graphics.items.reduce((e,t)=>(o.has(t.uid)&&e.set(t.uid,t),e),new Map);return i.map(e=>a.get(e)).filter(s)}requestUpdate(){this.updateRequested||(this.updateRequested=!0,this.requestUpdateCallback()),this.notifyChange("updating")}processUpdate(e){this.updateRequested&&(this.updateRequested=!1,this.update(e))}viewChange(){this.requestUpdate()}setHighlight(e){const t=[];for(const{objectId:s,highlightFlags:r}of e){const e=this._graphicStore.getItem(s)?.displayId;t.push({objectId:s,highlightFlags:r,displayId:e})}this._attributeStore.setHighlight(t,e),this._pushUpdate()}graphicUpdateHandler(e){this._pushUpdate()}update(e){this.updateRequested=!1,this._attached&&this._graphicStore.updateLevel(e.state.resolution)&&this.pushUpdate()}pushUpdate(){this._pushUpdate()}_pushUpdate(){o(this._commandQueue.push({type:"update"}))}async _update(){try{if(has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView._update start`),this.graphics.destroyed)return;const e=await this._graphicStore.update(this.graphics,e=>this._getSymbolForGraphic(e),e=>this._ensureSymbolResource(e));for(const s of e.updated)this.container.restartAnimation(s.objectId);if(!e.hasAnyUpdate())return void this._attributeStore.sendUpdates();e.removed.length&&(this._cleanupRequired=!0),has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView updateMessage`,e);const t=this._createTileMessages(e);await this._densifyItemsForDisplay(t),await this._fetchResources(t),this._write(t);for(const s of e.added)this._setFilterState(s);for(const s of e.updated)this._setFilterState(s);has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView sendUpdate`,e),this._attributeStore.sendUpdates(),has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView sendUpdate.await`,e)}catch(e){}this._cleanupSharedResources()}_createTileMessages(e){const t=new Map;for(const s of e.added){const e=this.view.graphicsTileStore.getIntersectingTiles(s.symbolBounds);for(const r of e){P.getOrCreate(r,t,this._metadata).append(s)}}for(const s of e.updated){const e=this.view.graphicsTileStore.getIntersectingTiles(s.prevSymbolBounds),r=this.view.graphicsTileStore.getIntersectingTiles(s.symbolBounds);for(const i of e){P.getOrCreate(i,t,this._metadata).removed.push(s.displayId)}for(const i of r){P.getOrCreate(i,t,this._metadata).append(s)}}for(const s of e.removed){const e=this.view.graphicsTileStore.getIntersectingTiles(s.symbolBounds);for(const r of e){P.getOrCreate(r,t,this._metadata).removed.push(s.displayId)}}return Array.from(t.values())}async _densifyItemsForDisplay(e){const t=new Map;for(const s of e)for(const e of s.addedOrModified)t.has(e)||t.set(e,e.densifyCurvedGeometryForDisplay(this.view.spatialReference));await Promise.all(t.values())}async _fetchResources(e){const t={timeZone:null,timeExtent:null};for(const{tile:s,reader:r}of e){has("esri-2d-update-debug")&&console.debug(`Id[${this.layerId}] Tile[${s.id}] GraphicsView fetchResources`,e);const i=r.getCursor();for(;i.next();)for(const e of i.getMeshWriters())e.enqueueRequest(this._resourceProxy,i,s.createArcadeEvaluationOptions(t))}await this._resourceProxy.fetchEnqueuedResources()}_write(e){for(const t of e){has("esri-2d-update-debug")&&console.debug(`Id[${this.layerId}] Tile[${t.tile.id}] GraphicsView write`,t);const e=this._writeMeshes(t);let s=this._tiles.get(t.tile.key);s||(s=this._createFeatureTile(t.tile.key)),has("esri-2d-update-debug")&&console.debug(`Id[${this.layerId}] Tile[${t.tile.id}] GraphicsView onTileData`,t),this.container.onTileData(s,{type:"update",modify:e,remove:t.removed,end:!1,attributeEpoch:this._attributeStore.epoch,objectIdMap:t.objectIdMap}),this.container.requestRender()}}_writeMeshes(e){const t={timeZone:null,timeExtent:null},s=new T(e.tile.id),r=e.reader.getCursor();for(;r.next();){s.entityStart(r.getDisplayId(),r.getZOrder());for(const i of r.getMeshWriters())i.write(s,this._resourceProxy,r,e.tile.createArcadeEvaluationOptions(t),e.tile.level);s.entityEnd()}return{...s.serialize().message,tileId:e.tile.id,requiresRefresh:!1}}_setFilterState(e){const t=e.displayId,s=this._attributeStore.getHighlightFlags(e.objectId);this._attributeStore.setData(t,0,0,s|(e.visible?I:0))}_getSymbolForGraphic(e){return null!=e.symbol?e.symbol:null!=this._effectiveRenderer?this._effectiveRenderer.getSymbol(e):this._getNullSymbol(e)}async _ensureSymbolResource(e){if(!e.symbol)return;const t=await this._getSymbolInfo(e.symbol);if(!t)return;const s=t.linearCIM.filter(e=>"text"===e.type);if(s.length>0){const r=await this._getTextResources(e,s);return void(e.symbolResource={symbolInfo:t,textInfo:r})}e.symbolResource={symbolInfo:t}}_getSymbolInfo(e){const t=e.hash();return this._hashToSymbolInfo.has(t)||this._hashToSymbolInfo.set(t,this._createSymbolInfo(t,e).catch(e=>null)),this._hashToSymbolInfo.get(t)}async _createSymbolInfo(e,t){const s=await this._convertToCIMSymbol(t),r=await this._createLinearCIM(s);return{hash:e,cimSymbol:s,linearCIM:r,meshWriters:await this._createMeshWriters(s,r)}}async _convertToCIMSymbol(e){const t=f(e);return"web-style"===t.type?this._convertToCIMSymbol(await t.fetchSymbol({acceptedFormats:["cim","web"]})):t}async _createLinearCIM(e){return await y.normalizeSymbolAndFetchResources(e.symbol,this._cimResourceManager),this.view.stage.cimAnalyzer.analyzeSymbolReference(e,!1)}async _createMeshWriters(e,t){a(this._controller.signal);const s=this.container.instanceStore,r=this.view.stage.meshWriterRegistry,i=await R(e,t,s);return Promise.all(i.map(e=>r.createMeshWriter(this._storage,this._resourceProxy,{tileInfo:this.view.featuresTilingScheme.tileInfo},e,null)))}_onTileUpdate(e){if(e.added&&e.added.length>0)for(const t of e.added)this._updateTracking.consumePromise(this._addTile(t));if(e.removed&&e.removed.length>0)for(const t of e.removed)this._removeTile(t.key)}_createFeatureTile(e){const t=this.view.featuresTilingScheme.getTileBounds(c(),e),s=this.view.featuresTilingScheme.getTileResolution(e.level),r=new v(e,s,t[0],t[3]);return this._tiles.set(e,r),this.container.addChild(r),r}async _addTile(e){if(!this._attached)return;const t=this._graphicStore.queryItems(e);if(!t.length)return;const s=this._createFeatureTile(e.key),r=P.fromItems(e,t,this._metadata);await this._densifyItemsForDisplay([r]),await this._fetchResources([r]);const i=this._writeMeshes(r);s.onMessage({type:"append",append:i,clear:!1,end:!0,attributeEpoch:this._attributeStore.epoch,objectIdMap:r.objectIdMap})}_removeTile(e){if(!this._tiles.has(e))return;const t=this._tiles.get(e);this.container.removeChild(t),t.destroy(),this._tiles.delete(e)}_getNullSymbol(e){const t=e.geometry;return t?l(t)?w:p(t)||u(t)?S:this.defaultPointSymbolEnabled?b:null:this.defaultPointSymbolEnabled?b:null}async _getTextResources(e,t){const s=new Array,r=new Array;for(let i=0;i<t.length;i++){const o=t[i],{resource:a,overrides:n}=o.textRasterizationParam;if(n?.length>0){const t=_.resolveSymbolOverrides({type:"CIMSymbolReference",primitiveOverrides:n,symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,size:a.symbol.height,anchorPointUnits:"Relative",frame:{xmin:-5,ymin:-5,xmax:5,ymax:5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{x:0,y:0},symbol:a.symbol,textString:a.textString}],scaleSymbolsProportionally:!0,respectFrame:!0}]}},e,this.view.spatialReference,null,m(e.projectedGeometry),null,null);t.then(e=>{const t=e.symbolLayers[0],{textString:s}=t.markerGraphics[0];r.push({type:"cim-rasterization-info",resource:{type:"text",textString:s||"",font:a.font}}),o.text=a.textString=s||""}),s.push(t)}else r.push({type:"cim-rasterization-info",resource:a})}s.length>0&&await Promise.all(s);const o=r.map(e=>this.view.stage.textureManager.rasterizeItem(e)),a=await Promise.all(o);i(a);const n=new Map;for(let i=0;i<t.length;i++){const e=t[i];n.set(e.textRasterizationParam.resource.symbol,{text:e.text,glyphMosaicItems:a[i]})}return n}_cleanupSharedResources(){if(!this._cleanupRequired)return;const e=performance.now();if(e-this._lastCleanup<5e3)return;this._cleanupRequired=!1,this._lastCleanup=e;const t=new Set;for(const r of this._graphicStore.items()){const e=r.symbolResource?.symbolInfo.hash;t.add(e)}const s=new Set(this._hashToSymbolInfo.keys());for(const r of s.values())t.has(r)||this._hashToSymbolInfo.delete(r)}};e([h()],A.prototype,"_effectiveRenderer",null),e([h({constructOnly:!0})],A.prototype,"layerId",void 0),e([h({constructOnly:!0})],A.prototype,"requestUpdateCallback",void 0),e([h()],A.prototype,"container",void 0),e([h({constructOnly:!0})],A.prototype,"graphics",void 0),e([h()],A.prototype,"renderer",void 0),e([h()],A.prototype,"_updateTracking",void 0),e([h()],A.prototype,"updating",null),e([h()],A.prototype,"view",void 0),e([h()],A.prototype,"updateRequested",void 0),e([h()],A.prototype,"defaultPointSymbolEnabled",void 0),A=e([d("esri.views.2d.layers.graphics.GraphicsView2D")],A);export{A as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import e from"../../../../../core/Accessor.js";import{resizeFilled as r}from"../../../../../core/arrayUtils.js";import{deg2rad as s}from"../../../../../core/mathUtils.js";import{abortMaybe as i}from"../../../../../core/maybe.js";import{debounce as o,throwIfAborted as n,isPromiseLike as a}from"../../../../../core/promiseUtils.js";import{valueInUnit as l}from"../../../../../core/quantity.js";import{lengthUnitFromSpatialReference as d,areaUnitFromSpatialReference as h}from"../../../../../core/units.js";import{property as p}from"../../../../../core/accessorSupport/decorators/property.js";import{subclass as u}from"../../../../../core/accessorSupport/decorators/subclass.js";import{set as c}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as m}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{copy as _,set as g,cross as f,subtract as P,dot as j,scale as y,add as v}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as w}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as R}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as x}from"../../../../../core/support/UpdatingHandles.js";import U from"../../../../../geometry/Polygon.js";import C from"../../../../../geometry/SpatialReference.js";import{isPCPF as A}from"../../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectDirection as S}from"../../../../../geometry/projection/projectDirection.js";import{projectPointToVector as M}from"../../../../../geometry/projection/projectPointToVector.js";import{projectVectorToVector as W}from"../../../../../geometry/projection/projectVectorToVector.js";import{Sphere as V}from"../../../../../geometry/support/sphere.js";import{bestFitPlane as b,planePointDistance as D,boundingSphere as T}from"../../support/measurementUtils.js";import{getElevationAtPoint as I}from"../../../support/ElevationProvider.js";import{midpoint3d as L,makeOrthonormal as F}from"../../../support/mathUtils.js";import{polygonToRenderInfoNotElevationAligned as O}from"../../../support/renderInfoUtils/polygon.js";import{computeEuclideanMeasurementSR as H}from"../../../../support/measurementUtils.js";import{MeasurementWorkerHandle as k}from"../../../../support/MeasurementWorkerHandle.js";import{autoMeasurementMode as z}from"../../../../support/measurementWorkerUtils.js";class q{constructor(t){this.positionsWorld=[],this.positionsRender=[],this.positionsFittedRender=[],this.triangleIndices=null,this.areaPolygon=new U({rings:[[]],spatialReference:t}),this.positionsFittedWorldPlaneProjected=this.areaPolygon.rings[0],this.trianglePositions=this.positionsFittedRender,this.triangleUvs=this.positionsFittedWorldPlaneProjected}}class E{constructor(t,e=null,r=null,s=null,i=null,o=null,n=null){this.mode=t,this.area=e,this.geodesicArea=r,this.perimeter=s,this.geodesicPerimeter=i,this.areaCentroidRenderCoords=o,this.geodesicAreaCentroidRenderCoords=n}}let B=class extends e{get numVertices(){return this._length}get hasStagedVertex(){return null!=this._lastCursorPoint}get fittingMode(){return this._fittingMode}get measurements(){return this._measurements}get updating(){return this._updatingHandles.updating}get renderSpatialReference(){return this.view.renderSpatialReference}get updateId(){return this._updateId}constructor(t){super(t),this._length=0,this._lastCursorPoint=null,this._lastPath=null,this._lastPathVersion=-1,this._lastMode=null,this._updatingHandles=new x,this._fittingMode=null,this._measurements=null,this._updateId=0,this._centroidRenderCoords=w(),this._planeWorldCoords=R(),this._worldUp=w(),this._worldTangent=w(),this._frame=[w(),w(),w()],this._worldOrigin=w(),this._updateAxisU=w(),this._updateAxisV=w(),this._updateWorldOrigin=w(),this._tempU=w(),this._tempV=w(),this._tempVec3=w(),this._tempSphere=new V,this._measurementWorker=new k({preloadGeodetic:!0}),this._retryAfterLoadScheduled=!1,this._updateAbortController=null,this._retryAfterTessellationLoad=()=>{if(this._retryAfterLoadScheduled=!1,this.destroyed)return;const t=this._lastPath,e=this._lastCursorPoint,r=this._lastMode;t&&null!=r&&this._update(t,e,r)},this._updateMeasurements=o(async(t,e,r,s,i)=>{const o=this.view.spatialReference,a=0===z(o);_(this._updateAxisU,this._frame[0]),_(this._updateAxisV,this._frame[1]),_(this._updateWorldOrigin,this._worldOrigin);const l=(t,e)=>(t&&this.view.renderCoordsHelper.toRenderCoords(t,e)||g(e,0,0,0),e),d=t.areaMeasurement?.geometry,h=a&&1!==e&&d?await this._measurementWorker.geodeticLength(d,{stagedPoint:r?s:null}):null;n(i);const p=this._calculateMode(e,h),u="geodesic"===p,[c,m]=await Promise.all([u?null:this._measurementWorker.area2D(this.vertexData.areaPolygon,{unit:this._areaMeasurementUnit,lengthUnit:this._lengthMeasurementUnit,returnCentroid:!0,returnLength:!0}),u&&d?await this._measurementWorker.geodeticArea(d,{stagedPoint:r?s:null,returnCentroid:!0}):null]);n(i);const f=u?null:w();f&&c?.centroid&&this._projectWorldPlaneProjectedPointToRender(f,this._updateWorldOrigin,[c.centroid?.x??0,c.centroid?.y??0],this._updateAxisU,this._updateAxisV,this.view.renderSpatialReference,this._measurementSR);const P=m?.centroid?l(m.centroid,w()):null;this._measurements=new E(p,u?null:c?.area,u?m?.area:null,u?null:c?.length,u?h:null,u?null:f,u?P:null)});const e=H(t.view.spatialReference);this._measurementSR=e,this._lengthMeasurementUnit=d(e)??"meters",this._areaMeasurementUnit=h(e)??"square-meters";const r=A(e)?C.WebMercator:e;this.vertexData=new q(r)}destroy(){this._measurementWorker.destroy(),this._updatingHandles.destroy()}update(t,e,r){const s=this._lastPathVersion===t.version,i=e?e.equals(this._lastCursorPoint):null==this._lastCursorPoint,o=this._lastMode===r;return!(s&&o&&i)&&(this._lastPath=t,this._lastPathVersion=t.version,this._lastCursorPoint=e,this._lastMode=r,this._update(t,e,r),!0)}_scheduleRetryAfterTessellationLoad(t){this._retryAfterLoadScheduled||(this._retryAfterLoadScheduled=!0,this._updatingHandles.consumePromise(t.then(()=>this._retryAfterTessellationLoad(),()=>{this._retryAfterLoadScheduled=!1})))}_update(t,e,r){const s=this._measurementSR;let o=t.numVertices;const n=!(null==e||e.equals(t.lastPoint)||o>2&&e.equals(t.firstPoint)||t.polygonIsClosed);n&&(o+=1);const a=!t.polygonIsClosed&&o>2,l=t.polygonIsClosed||a;this._resize(o);const{positionsWorld:d,positionsRender:h}=this.vertexData,p=(t,e)=>{G(this.view.elevationProvider,t),M(t,d[e],s),M(t,h[e],this.renderSpatialReference)};if(t.forEachVertexPosition((t,e)=>p(t,e)),n&&p(e,o-1),this.vertexData.areaPolygon.clearCache(),!l)return this._measurements=null,this.vertexData.triangleIndices=null,this._updateId++,void(this._updateAbortController=i(this._updateAbortController));this._updateVertexData()&&(this._updateId++,this._updateAbortController??=new AbortController,this._updatingHandles.consumePromise(this._updateMeasurements(t,r,n,e,this._updateAbortController.signal)))}_resize(t){const{positionsWorld:e,positionsRender:s,positionsFittedWorldPlaneProjected:i,positionsFittedRender:o}=this.vertexData;r(e,t,w),r(s,t,w),r(i,t,m),r(o,t,w),this._length=t}_updateVertexData(){const t=this._measurementSR,e=this.view.renderCoordsHelper,{positionsWorld:r,positionsRender:s}=this.vertexData,i=this._planeWorldCoords,o=this._centroidRenderCoords;L(s,o),e.worldUpAtPosition(o,this._worldUp),e.worldBasisAtPosition(o,0,this._worldTangent),S(o,this._worldUp,this.renderSpatialReference,this._worldUp,t),S(o,this._worldTangent,this.renderSpatialReference,this._worldTangent,t),r.length>2&&b(r,i),this._fittingMode=this._selectFittingMode(i,r,this._worldUp,this.fittingSettings);let n=0;if("horizontal"===this._fittingMode){let t=-1/0;s.forEach((r,i)=>{const o=e.getAltitude(s[i]);o>t&&(t=o,n=i)})}const{_worldOrigin:a}=this;_(this._worldOrigin,r[n]);let l=i,d=this._worldTangent;"horizontal"===this._fittingMode?l=this._worldUp:"vertical"===this._fittingMode&&(l=this._tempVec3,d=this._worldUp,F(i,this._worldUp,l));const h=this._frame[0],p=this._frame[1];_(this._frame[2],l),F(d,l,h),f(p,h,this._frame[2]);const{positionsFittedRender:u,positionsFittedWorldPlaneProjected:m}=this.vertexData,g=this._tempVec3;for(let _=0;_<this._length;++_){const e=m[_],s=u[_];P(g,r[_],a),c(e,j(h,g),j(p,g)),this._projectWorldPlaneProjectedPointToRender(s,a,e,h,p,this.renderSpatialReference,t)}return this._triangulate(new J(a,h,p,this.renderSpatialReference,t))}_triangulate(t){const{worldOrigin:e,axisU:s,axisV:i,renderSR:o,worldSR:n}=t,{areaPolygon:l}=this.vertexData,d=O(l);if(a(d))return this._scheduleRetryAfterTessellationLoad(d),!1;const h=d;if(null==h)return!0;const{positions:p,polygonIndices:u,vertexCount:_}=h,g=[],f=[];r(f,_,w),r(g,_,m);for(let r=0,a=0;r<p.length;r+=3,a++){const t=f[a],l=g[a];c(l,p[r],p[r+1]),this._projectWorldPlaneProjectedPointToRender(t,e,l,s,i,o,n)}return this.vertexData.trianglePositions=f,this.vertexData.triangleIndices=u,this.vertexData.triangleUvs=g,!0}_projectWorldPlaneProjectedPointToRender(t,e,r,s,i,o,n){const a=this._tempU,l=this._tempV;y(a,s,r[0]),y(l,i,r[1]),v(t,a,l),v(t,t,e),W(t,n,t,o)}_selectFittingMode(t,e,r,i){const o=e.map(e=>Math.abs(D(t,e))).reduce((t,e)=>Math.max(t,e),0);T(e,this._tempSphere);const n=o/(2*this._tempSphere.radius),a=n<i.maxRelativeErrorCoplanar,l=n<i.maxRelativeErrorAlmostCoplanar;let d="horizontal";if(a)d="oblique";else if(l){d=Math.abs(j(r,t))>Math.cos(s(i.verticalAngleThreshold))?"horizontal":"vertical"}return d}_calculateMode(t,e){return null!=e&&0===t?l(e,"meters")>Z?"geodesic":"euclidean":null==e||1===t?"euclidean":"geodesic"}};function G(t,e){e.hasZ||(e.z=I(t,e,"ground")??0)}t([p()],B.prototype,"_measurements",void 0),t([p()],B.prototype,"updating",null),t([p()],B.prototype,"renderSpatialReference",null),t([p()],B.prototype,"_updateId",void 0),t([p()],B.prototype,"view",void 0),t([p({constructOnly:!0})],B.prototype,"fittingSettings",void 0),B=t([u("esri.views.3d.analysis.AreaMeasurement.support.MeasurementData")],B);const Z=1e5;class J{constructor(t,e,r,s,i){this.worldOrigin=t,this.axisU=e,this.axisV=r,this.renderSR=s,this.worldSR=i}}export{E as AreaMeasurementQuantities,B as MeasurementData};
|
|
2
|
+
import{__decorate as t}from"tslib";import e from"../../../../../core/Accessor.js";import{resizeFilled as r}from"../../../../../core/arrayUtils.js";import{deg2rad as s}from"../../../../../core/mathUtils.js";import{abortMaybe as i}from"../../../../../core/maybe.js";import{debounce as o,throwIfAborted as n,isPromiseLike as a}from"../../../../../core/promiseUtils.js";import{valueInUnit as l}from"../../../../../core/quantity.js";import{lengthUnitFromSpatialReference as d,areaUnitFromSpatialReference as h}from"../../../../../core/units.js";import{property as p}from"../../../../../core/accessorSupport/decorators/property.js";import{subclass as u}from"../../../../../core/accessorSupport/decorators/subclass.js";import{set as c}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as m}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{copy as _,set as g,cross as f,subtract as P,dot as j,scale as y,add as v}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as w}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as R}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as x}from"../../../../../core/support/UpdatingHandles.js";import U from"../../../../../geometry/Polygon.js";import C from"../../../../../geometry/SpatialReference.js";import{isPCPF as A}from"../../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectDirection as S}from"../../../../../geometry/projection/projectDirection.js";import{projectPointToVector as M}from"../../../../../geometry/projection/projectPointToVector.js";import{projectVectorToVector as W}from"../../../../../geometry/projection/projectVectorToVector.js";import{Sphere as V}from"../../../../../geometry/support/sphere.js";import{bestFitPlane as b,planePointDistance as D,boundingSphere as T}from"../../support/measurementUtils.js";import{getElevationAtPoint as I}from"../../../support/ElevationProvider.js";import{midpoint3d as L,makeOrthonormal as F}from"../../../support/mathUtils.js";import{polygonToRenderInfoNotElevationAligned as O}from"../../../support/renderInfoUtils/polygon.js";import{GeometryWorkerHandle as H}from"../../../../support/GeometryWorkerHandle.js";import{computeEuclideanMeasurementSR as k}from"../../../../support/measurementUtils.js";import{autoMeasurementMode as z}from"../../../../support/measurementWorkerUtils.js";class q{constructor(t){this.positionsWorld=[],this.positionsRender=[],this.positionsFittedRender=[],this.triangleIndices=null,this.areaPolygon=new U({rings:[[]],spatialReference:t}),this.positionsFittedWorldPlaneProjected=this.areaPolygon.rings[0],this.trianglePositions=this.positionsFittedRender,this.triangleUvs=this.positionsFittedWorldPlaneProjected}}class E{constructor(t,e=null,r=null,s=null,i=null,o=null,n=null){this.mode=t,this.area=e,this.geodesicArea=r,this.perimeter=s,this.geodesicPerimeter=i,this.areaCentroidRenderCoords=o,this.geodesicAreaCentroidRenderCoords=n}}let G=class extends e{get numVertices(){return this._length}get hasStagedVertex(){return null!=this._lastCursorPoint}get fittingMode(){return this._fittingMode}get measurements(){return this._measurements}get updating(){return this._updatingHandles.updating}get renderSpatialReference(){return this.view.renderSpatialReference}get updateId(){return this._updateId}constructor(t){super(t),this._length=0,this._lastCursorPoint=null,this._lastPath=null,this._lastPathVersion=-1,this._lastMode=null,this._updatingHandles=new x,this._fittingMode=null,this._measurements=null,this._updateId=0,this._centroidRenderCoords=w(),this._planeWorldCoords=R(),this._worldUp=w(),this._worldTangent=w(),this._frame=[w(),w(),w()],this._worldOrigin=w(),this._updateAxisU=w(),this._updateAxisV=w(),this._updateWorldOrigin=w(),this._tempU=w(),this._tempV=w(),this._tempVec3=w(),this._tempSphere=new V,this._measurementWorker=new H({preloadGeodetic:!0}),this._retryAfterLoadScheduled=!1,this._updateAbortController=null,this._retryAfterTessellationLoad=()=>{if(this._retryAfterLoadScheduled=!1,this.destroyed)return;const t=this._lastPath,e=this._lastCursorPoint,r=this._lastMode;t&&null!=r&&this._update(t,e,r)},this._updateMeasurements=o(async(t,e,r,s,i)=>{const o=this.view.spatialReference,a=0===z(o);_(this._updateAxisU,this._frame[0]),_(this._updateAxisV,this._frame[1]),_(this._updateWorldOrigin,this._worldOrigin);const l=(t,e)=>(t&&this.view.renderCoordsHelper.toRenderCoords(t,e)||g(e,0,0,0),e),d=t.areaMeasurement?.geometry,h=a&&1!==e&&d?await this._measurementWorker.geodeticLength(d,{stagedPoint:r?s:null}):null;n(i);const p=this._calculateMode(e,h),u="geodesic"===p,[c,m]=await Promise.all([u?null:this._measurementWorker.area2D(this.vertexData.areaPolygon,{unit:this._areaMeasurementUnit,lengthUnit:this._lengthMeasurementUnit,returnCentroid:!0,returnLength:!0}),u&&d?await this._measurementWorker.geodeticArea(d,{stagedPoint:r?s:null,returnCentroid:!0}):null]);n(i);const f=u?null:w();f&&c?.centroid&&this._projectWorldPlaneProjectedPointToRender(f,this._updateWorldOrigin,[c.centroid?.x??0,c.centroid?.y??0],this._updateAxisU,this._updateAxisV,this.view.renderSpatialReference,this._measurementSR);const P=m?.centroid?l(m.centroid,w()):null;this._measurements=new E(p,u?null:c?.area,u?m?.area:null,u?null:c?.length,u?h:null,u?null:f,u?P:null)});const e=k(t.view.spatialReference);this._measurementSR=e,this._lengthMeasurementUnit=d(e)??"meters",this._areaMeasurementUnit=h(e)??"square-meters";const r=A(e)?C.WebMercator:e;this.vertexData=new q(r)}destroy(){this._measurementWorker.destroy(),this._updatingHandles.destroy()}update(t,e,r){const s=this._lastPathVersion===t.version,i=e?e.equals(this._lastCursorPoint):null==this._lastCursorPoint,o=this._lastMode===r;return!(s&&o&&i)&&(this._lastPath=t,this._lastPathVersion=t.version,this._lastCursorPoint=e,this._lastMode=r,this._update(t,e,r),!0)}_scheduleRetryAfterTessellationLoad(t){this._retryAfterLoadScheduled||(this._retryAfterLoadScheduled=!0,this._updatingHandles.consumePromise(t.then(()=>this._retryAfterTessellationLoad(),()=>{this._retryAfterLoadScheduled=!1})))}_update(t,e,r){const s=this._measurementSR;let o=t.numVertices;const n=!(null==e||e.equals(t.lastPoint)||o>2&&e.equals(t.firstPoint)||t.polygonIsClosed);n&&(o+=1);const a=!t.polygonIsClosed&&o>2,l=t.polygonIsClosed||a;this._resize(o);const{positionsWorld:d,positionsRender:h}=this.vertexData,p=(t,e)=>{B(this.view.elevationProvider,t),M(t,d[e],s),M(t,h[e],this.renderSpatialReference)};if(t.forEachVertexPosition((t,e)=>p(t,e)),n&&p(e,o-1),this.vertexData.areaPolygon.clearCache(),!l)return this._measurements=null,this.vertexData.triangleIndices=null,this._updateId++,void(this._updateAbortController=i(this._updateAbortController));this._updateVertexData()&&(this._updateId++,this._updateAbortController??=new AbortController,this._updatingHandles.consumePromise(this._updateMeasurements(t,r,n,e,this._updateAbortController.signal)))}_resize(t){const{positionsWorld:e,positionsRender:s,positionsFittedWorldPlaneProjected:i,positionsFittedRender:o}=this.vertexData;r(e,t,w),r(s,t,w),r(i,t,m),r(o,t,w),this._length=t}_updateVertexData(){const t=this._measurementSR,e=this.view.renderCoordsHelper,{positionsWorld:r,positionsRender:s}=this.vertexData,i=this._planeWorldCoords,o=this._centroidRenderCoords;L(s,o),e.worldUpAtPosition(o,this._worldUp),e.worldBasisAtPosition(o,0,this._worldTangent),S(o,this._worldUp,this.renderSpatialReference,this._worldUp,t),S(o,this._worldTangent,this.renderSpatialReference,this._worldTangent,t),r.length>2&&b(r,i),this._fittingMode=this._selectFittingMode(i,r,this._worldUp,this.fittingSettings);let n=0;if("horizontal"===this._fittingMode){let t=-1/0;s.forEach((r,i)=>{const o=e.getAltitude(s[i]);o>t&&(t=o,n=i)})}const{_worldOrigin:a}=this;_(this._worldOrigin,r[n]);let l=i,d=this._worldTangent;"horizontal"===this._fittingMode?l=this._worldUp:"vertical"===this._fittingMode&&(l=this._tempVec3,d=this._worldUp,F(i,this._worldUp,l));const h=this._frame[0],p=this._frame[1];_(this._frame[2],l),F(d,l,h),f(p,h,this._frame[2]);const{positionsFittedRender:u,positionsFittedWorldPlaneProjected:m}=this.vertexData,g=this._tempVec3;for(let _=0;_<this._length;++_){const e=m[_],s=u[_];P(g,r[_],a),c(e,j(h,g),j(p,g)),this._projectWorldPlaneProjectedPointToRender(s,a,e,h,p,this.renderSpatialReference,t)}return this._triangulate(new J(a,h,p,this.renderSpatialReference,t))}_triangulate(t){const{worldOrigin:e,axisU:s,axisV:i,renderSR:o,worldSR:n}=t,{areaPolygon:l}=this.vertexData,d=O(l);if(a(d))return this._scheduleRetryAfterTessellationLoad(d),!1;const h=d;if(null==h)return!0;const{positions:p,polygonIndices:u,vertexCount:_}=h,g=[],f=[];r(f,_,w),r(g,_,m);for(let r=0,a=0;r<p.length;r+=3,a++){const t=f[a],l=g[a];c(l,p[r],p[r+1]),this._projectWorldPlaneProjectedPointToRender(t,e,l,s,i,o,n)}return this.vertexData.trianglePositions=f,this.vertexData.triangleIndices=u,this.vertexData.triangleUvs=g,!0}_projectWorldPlaneProjectedPointToRender(t,e,r,s,i,o,n){const a=this._tempU,l=this._tempV;y(a,s,r[0]),y(l,i,r[1]),v(t,a,l),v(t,t,e),W(t,n,t,o)}_selectFittingMode(t,e,r,i){const o=e.map(e=>Math.abs(D(t,e))).reduce((t,e)=>Math.max(t,e),0);T(e,this._tempSphere);const n=o/(2*this._tempSphere.radius),a=n<i.maxRelativeErrorCoplanar,l=n<i.maxRelativeErrorAlmostCoplanar;let d="horizontal";if(a)d="oblique";else if(l){d=Math.abs(j(r,t))>Math.cos(s(i.verticalAngleThreshold))?"horizontal":"vertical"}return d}_calculateMode(t,e){return null!=e&&0===t?l(e,"meters")>Z?"geodesic":"euclidean":null==e||1===t?"euclidean":"geodesic"}};function B(t,e){e.hasZ||(e.z=I(t,e,"ground")??0)}t([p()],G.prototype,"_measurements",void 0),t([p()],G.prototype,"updating",null),t([p()],G.prototype,"renderSpatialReference",null),t([p()],G.prototype,"_updateId",void 0),t([p()],G.prototype,"view",void 0),t([p({constructOnly:!0})],G.prototype,"fittingSettings",void 0),G=t([u("esri.views.3d.analysis.AreaMeasurement.support.MeasurementData")],G);const Z=1e5;class J{constructor(t,e,r,s,i){this.worldOrigin=t,this.axisU=e,this.axisV=r,this.renderSR=s,this.worldSR=i}}export{E as AreaMeasurementQuantities,G as MeasurementData};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import e from"../../../../core/Accessor.js";import{destroyHandle as s}from"../../../../core/handleUtils.js";import o from"../../../../core/Logger.js";import{mapCollection as r}from"../../../../core/mapCollectionUtils.js";import{debounce as i}from"../../../../core/promiseUtils.js";import{watch as n,syncAndInitial as a}from"../../../../core/reactiveUtils.js";import{convertUnit as m}from"../../../../core/units.js";import{property as p,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as d}from"../../../../core/support/UpdatingHandles.js";import{getDefaultUnitForView as c}from"../../../../support/getDefaultUnitForView.js";import{isGeodesicDimension as u,computeGeometryFromDimension as h,computationToGeometryDependencies as y,computeLength as g}from"./lengthDimensionUtils.js";import{
|
|
2
|
+
import{__decorate as t}from"tslib";import e from"../../../../core/Accessor.js";import{destroyHandle as s}from"../../../../core/handleUtils.js";import o from"../../../../core/Logger.js";import{mapCollection as r}from"../../../../core/mapCollectionUtils.js";import{debounce as i}from"../../../../core/promiseUtils.js";import{watch as n,syncAndInitial as a}from"../../../../core/reactiveUtils.js";import{convertUnit as m}from"../../../../core/units.js";import{property as p,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as d}from"../../../../core/support/UpdatingHandles.js";import{getDefaultUnitForView as c}from"../../../../support/getDefaultUnitForView.js";import{isGeodesicDimension as u,computeGeometryFromDimension as h,computationToGeometryDependencies as y,computeLength as g}from"./lengthDimensionUtils.js";import{GeometryWorkerHandle as f}from"../../../support/GeometryWorkerHandle.js";import{geodeticDistanceThresholdMeters as w}from"../../../support/measurementWorkerUtils.js";let _=class extends e{constructor(t){super(t),this._measurementWorker=new f({preloadGeodetic:!0}),this._updatingHandles=new d}initialize(){const t=r(()=>this.analysisViewData.computations,({computation:t})=>this._watchComputation(t));this.addHandles(s(t))}destroy(){this._measurementWorker.destroy(),this._updatingHandles.destroy()}get analysis(){return this.analysisViewData.analysis}get _defaultUnit(){return c(this.view)}get updating(){return this._updatingHandles.updating}_watchComputation(t){const e=i(this._computeLengthAsync.bind(this));return n(()=>y(t),s=>{const{measureType:r}=s;if(u(s)&&"direct"!==r){const e=Math.round(m(w,"meters","kilometers"));return o.getLogger(this).warnOnce(`A ${r} dimension in the analysis (id: '${this.analysis.id}') will not display, because only direct dimensions can measure lengths greater than ${e} km. Update the measureType of the affected dimension to "direct" to display it.`),void(t.geometry=null)}const i=h(s,this.view.renderCoordsHelper,t.geometry);this._updatingHandles.consumePromise(e(t,i,r))},a)}async _computeLengthAsync(t,e,s){t.geometry=e,t.result.length=await g(e,s,this._defaultUnit,this._measurementWorker)}};t([p({constructOnly:!0})],_.prototype,"analysisViewData",void 0),t([p({constructOnly:!0})],_.prototype,"view",void 0),t([p()],_.prototype,"analysis",null),t([p()],_.prototype,"_defaultUnit",null),_=t([l("esri.views.3d.analysis.Dimension.DimensionController")],_);export{_ as DimensionController};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import i from"../../../../core/Logger.js";import{debounce as n}from"../../../../core/promiseUtils.js";import{toUnit as o}from"../../../../core/quantity.js";import{watch as r,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{adaptiveLengthUnit as a,adaptiveVerticalLengthUnit as l}from"../../../../core/units.js";import{property as u,subclass as d}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as c}from"../../../../core/support/UpdatingHandles.js";import{applyProjectionAndElevationAlignment as p,logFailedGeometryProjectionError as m}from"../support/projectionUtils.js";import{euclideanDistanceBetweenPoints as v}from"../../../support/euclideanLengthMeasurementUtils.js";import{
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import i from"../../../../core/Logger.js";import{debounce as n}from"../../../../core/promiseUtils.js";import{toUnit as o}from"../../../../core/quantity.js";import{watch as r,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{adaptiveLengthUnit as a,adaptiveVerticalLengthUnit as l}from"../../../../core/units.js";import{property as u,subclass as d}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as c}from"../../../../core/support/UpdatingHandles.js";import{applyProjectionAndElevationAlignment as p,logFailedGeometryProjectionError as m}from"../support/projectionUtils.js";import{euclideanDistanceBetweenPoints as v}from"../../../support/euclideanLengthMeasurementUtils.js";import{GeometryWorkerHandle as g}from"../../../support/GeometryWorkerHandle.js";import{autoMeasurementMode as h}from"../../../support/measurementWorkerUtils.js";let y=class extends t{get updating(){return this._updatingHandles.updating}constructor(e){super(e),this._updatingHandles=new c,this._measurementWorker=new g({preloadGeodetic:!0}),this._computeResultDebounced=n(async({elevationAlignedStartPoint:e,elevationAlignedEndPoint:t,measurementMode:i,unit:n})=>{if(null==e||null==t)return null;const r=v(e,t);if(!r)return null;const s=1===i?"euclidean":2===i||0===h(this.view.spatialReference)?"geodesic":"euclidean",u="geodesic"===s?await this._measurementWorker.geodeticDistanceBetweenPoints(e,t):r?.horizontal,{direct:d,vertical:c}=r,p=a(d.value,d.unit,n),m=a(u.value,u.unit,n),g=l(c.value,c.unit,n);return{mode:s,directDistance:o(d,p),horizontalDistance:o(u,m),verticalDistance:o(c,g)}})}initialize(){this.addHandles([r(()=>({viewData:this.viewData,startPoint:this.analysis.startPoint}),({viewData:e,startPoint:t})=>{e.elevationAlignedStartPoint=this._applyProjectionAndElevationAlignment(t)},s),r(()=>({viewData:this.viewData,endPoint:this.analysis.endPoint}),({viewData:e,endPoint:t})=>{e.elevationAlignedEndPoint=this._applyProjectionAndElevationAlignment(t)},s),r(()=>{const{elevationAlignedStartPoint:e,elevationAlignedEndPoint:t,measurementMode:i,unit:n}=this.viewData;return{elevationAlignedStartPoint:e,elevationAlignedEndPoint:t,measurementMode:i,unit:n}},e=>{this._updatingHandles.consumePromise(this._computeResultDebounced(e).then(e=>{this.viewData.result=e}))},s)])}destroy(){this._updatingHandles.destroy(),this._measurementWorker.destroy()}_applyProjectionAndElevationAlignment(e){if(null==e)return e;const{spatialReference:t,elevationProvider:n}=this.view,o=p(e,t,n);return o??(m(this.analysis,e.spatialReference,i.getLogger(this)),null)}};e([u({constructOnly:!0})],y.prototype,"view",void 0),e([u({constructOnly:!0})],y.prototype,"analysis",void 0),e([u({constructOnly:!0})],y.prototype,"viewData",void 0),y=e([d("esri.views.3d.analysis.DirectLineMeasurement.DirectLineMeasurementController")],y);export{y as DirectLineMeasurementController};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{volumeMeasurementConfiguration as t}from"../../../../analysis/VolumeMeasurement/volumeMeasurementConfiguration.js";import r from"../../../../core/Accessor.js";import o from"../../../../core/Logger.js";import{debounce as i,isPromiseLike as n}from"../../../../core/promiseUtils.js";import{createVolume as s}from"../../../../core/quantity.js";import{whenOnce as a,watch as l,syncAndInitial as u}from"../../../../core/reactiveUtils.js";import{property as p,subclass as m}from"../../../../core/accessorSupport/decorators.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{sqrDist as d}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{scaleAndAdd as g}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as f,clone as y,create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as v}from"../../../../core/support/UpdatingHandles.js";import w from"../../../../geometry/Multipoint.js";import{projectOrLoad as j}from"../../../../geometry/projectionUtils.js";import{e as E}from"../../../../chunks/containsOperator.js";import{e as b}from"../../../../chunks/convexHullOperator.js";import{e as R}from"../../../../chunks/simplifyOperator.js";import{e as x}from"../../../../chunks/unionOperator.js";import{computeTranslationToOriginAndRotation as C}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBoundingRect as T}from"../../../../geometry/projection/projectBoundingRect.js";import{fromExtent as G,intersects as L,create as O,empty as P}from"../../../../geometry/support/aaBoundingRect.js";import{isClockwise as D}from"../../../../geometry/support/coordsUtils.js";import{newDoubleArray as H}from"../../../../geometry/support/DoubleArray.js";import{t as M}from"../../../../chunks/vec3.js";import V from"../../../../symbols/support/ElevationInfo.js";import{logFailedGeometryProjectionError as I}from"../support/projectionUtils.js";import{VolumeMeasurementCutFillComputation as U}from"./VolumeMeasurementCutFillComputation.js";import{VolumeMeasurementInsufficientDataError as N,VolumeMeasurementPerimeterTooLargeError as k,VolumeMeasurementUnsupportedCoordinateSystemError as A,VolumeMeasurementUnsupportedLayerTransparencyError as F}from"./volumeMeasurementErrors.js";import{VolumeMeasurementRawResult as S}from"./VolumeMeasurementRawResult.js";import W from"./VolumeMeasurementResult.js";import{ElevationContext as z}from"../../layers/graphics/ElevationContext.js";import{getElevationAtPoint as q}from"../../support/ElevationProvider.js";import{polygonToRenderInfoElevationAligned as B}from"../../support/renderInfoUtils/polygon.js";import{IteratorPreorder as Z}from"../../terrain/tileUtils.js";import{CutFillComputationRenderNode as J,TargetGeometryRenderInfo as K}from"../../webgl-engine/lib/CutFillComputationRenderNode.js";import{isIntegratedMeshLayerView as Q}from"../../../support/layerViewUtils.js";import{MeasurementWorkerHandle as X}from"../../../support/MeasurementWorkerHandle.js";let Y=class extends r{constructor(e){super(e),this._measurementWorkerHandle=new X,this._getElevationProvider=()=>this.view.elevationProvider,this.depthExtremaPositions=null,this._updatingHandles=new v,this._rawResult=null,this._sufficientDataCoverage=!0,this._tileIterator=new Z,this._intersectingObbs=[],this._intersectingTiles=[],this._debouncedUpdate=i(async(e,t,r,o)=>{if(!this._computationRenderNode.done)return;const{renderCoordsHelper:i}=this.view,n=new U({extent:t,localOrigin:r,renderCoordsHelper:i});this._computationRenderNode.update(n,o),this._determineDataCoverage(n);const[s]=await Promise.allSettled([this._measurementWorkerHandle.areaHorizontal(e,{returnLength:!0}),a(()=>this._computationRenderNode.done).then(()=>{this._updateDepthExtremaPositions(n,this._computationRenderNode.getResult())})]);if(this.error)return void(this._rawResult=null);const l=this._computationRenderNode.getResult();this._updateResult(n,l,"fulfilled"===s.status?s.value:null)}),this._determineDataCoverage=e=>{const{elevationAlignedGeometry:t}=this,{frustum:r}=this._computationRenderNode,{cameraDimensions:o}=e;t&&r&&(this._intersectingObbs.length=0,this._imLayerViewsAffectingMeasurement.forEach(e=>{this._findIntersectingObbs(e,r)}),this._intersectingObbs.length?this._sufficientDataCoverage=this._sufficientIntegratedMeshCoverage(t,o):(this._findIntersectingTerrainTiles(t),this._sufficientDataCoverage=this._sufficientTerrainCoverage(o)))}}initialize(){const e=this.view;this._computationRenderNode=new J({view:e}),this.addHandles([this._createElevationUpdateHandle(),l(()=>({projectedGeometry:this._projectedGeometry,localOrigin:this._localOrigin,targetGeometryRenderInfo:this._targetGeometryRenderInfo}),({projectedGeometry:e,localOrigin:t,targetGeometryRenderInfo:r})=>{const o=e?.extent;if(!(e&&o&&t&&r))return this._rawResult=null,void(this._sufficientDataCoverage=!0);this._updatingHandles.consumePromise(this._debouncedUpdate(e,o,t,r))},u)])}destroy(){this._updatingHandles.destroy(),this._computationRenderNode.destroy(),this._measurementWorkerHandle.destroy()}get _projectedGeometry(){const e=this.analysis.geometry;if(!e||!this.analysis.valid)return null;const t=R(e),r=j(t,this.view.spatialReference);return r.pending?(this._updatingHandles.consumePromise(r.pending),null):(t&&!r.geometry&&I(this.analysis,e.spatialReference,o.getLogger(this)),r.geometry)}get _localOrigin(){const e=this._projectedGeometry?.extent;return e?f(e.center.x,e.center.y,0):null}get elevationAlignedGeometry(){const e=this._projectedGeometry;if(!e)return null;const t=e.clone();return $(this._getElevationProvider(),t),t}get targetGeometry(){const{elevationAlignedGeometry:e}=this;if(!e)return null;const t=this.analysis.measureType,{effectiveTargetElevation:r}=this.analysisViewData;if("stockpile"===t||null==r)return e;const o=e.clone();return o.rings.forEach(e=>e.forEach(e=>e[2]=r)),o}get _targetGeometryRenderInfo(){const e=this.targetGeometry,t=this._projectedGeometry?.extent,r=this._localOrigin;if(!e||!t||!r)return null;const{elevationProvider:o,renderCoordsHelper:i}=this.view,s=B(e,o,i,z.fromElevationInfo(new V({mode:"absolute-height"})));if(n(s))return this._updatingHandles.consumePromise(s),null;if(null==s)return null;const{positions:a,polygonIndices:l,vertexCount:u}=s,p=H(3*u),m=c(),d=c();return C(t.spatialReference,r,m,i.spatialReference),d[12]=-m[12],d[13]=-m[13],d[14]=-m[14],M(p,a,d),new K(p,l)}get updating(){return this._computationRenderNode.updating||this._updatingHandles.updating}get result(){const e=this._rawResult,{volume:t,area:r,length:o}=this.analysisViewData.effectiveDisplayUnits;return e?new W({measureType:this.analysis.measureType,rawResult:e,volumeUnit:t,areaUnit:r,lengthUnit:o}):null}get error(){return this._unsupportedCoordinateSystemError??this._unsupportedLayerTransparencyError??this._perimeterTooLargeError??this._insufficientDataError}get _imLayerViewsAffectingMeasurement(){return this.view.allLayerViews.filter(e=>Q(e)).filter(e=>e.visible&&!e.suspended)}get _insufficientDataError(){return this._sufficientDataCoverage?null:new N}get _perimeterTooLargeError(){return this._perimeterTooLargeLocalError??this._perimeterTooLargeGlobalError}get _perimeterTooLargeLocalError(){const{spatialReference:e,state:{isLocal:r}}=this.view;if(!r||!e.isWebMercator)return null;const o=this._perimeterForError,{maxPerimeterLocalWebMercator:i}=t;return null!=o&&o>i?new k:null}get _perimeterTooLargeGlobalError(){if(!this.view.state.isGlobal)return null;const e=this._perimeterForError,{maxPerimeterGlobal:r}=t;return null!=e&&e>r?new k:null}get _unsupportedCoordinateSystemError(){return this.view.state.isLocal&&this.view.spatialReference.isGeographic?new A:null}get _unsupportedLayerTransparencyError(){return this.view.map.ground&&this.view.map.ground.opacity<1?new F:null}get _perimeterForError(){const{targetGeometry:e}=this;if(null==e)return null;let t=null;for(const r of e.rings){if(!D(r))continue;const e=te(re(r));t=e?Math.max(t??0,e):t}return null!=t?t*e.spatialReference.metersPerUnit:null}_createElevationUpdateHandle(){const e=e=>{const t=this._projectedGeometry?.extent;"ground"===e.context&&t&&(T(e.extent,e.spatialReference,ie,this.view.spatialReference),G(t,ne),L(ie,ne)&&(this._getElevationProvider=()=>this.view.elevationProvider))};return this.view.elevationProvider.on("elevation-change",t=>e(t))}_updateResult(e,t,r){const{unitInMeters:o}=this.view.renderCoordsHelper,{dimensions:{width:i,height:n},cameraNearFar:{near:a,far:l}}=e,u=i/t.width*(n/t.height),p=ee(t.cut.totalDepth,a,l)*u,m=ee(t.fill.totalDepth,a,l)*u,c=o**3;this._rawResult=new S({cutVolume:s(Math.abs(p*c),"cubic-meters"),fillVolume:s(m*c,"cubic-meters"),area:r?.area,perimeter:r?.length})}_updateDepthExtremaPositions(e,t){const{dimensions:{width:r,height:o},cameraNearFar:{near:i,far:n},cameraPositionRenderSpace:s,northVector:a,eastVector:l,upVector:u}=e,p=e=>{const{depthExtremum:p,depthExtremumCoords:[m,c],totalDepth:d}=e,h=y(s);return 0!==d&&(g(h,h,l,r*(m/t.width-.5)),g(h,h,a,o*(c/t.height-.5))),g(h,h,u,-ee(p,i,n)),h};this.depthExtremaPositions={cut:p(t.cut),fill:p(t.fill)}}_findIntersectingObbs(e,t){const r=this._intersectingObbs;"integrated-mesh-3d"===e.type&&e.getVisibleNodes().forEach(o=>{e.isNodeLoaded(o.index)&&o.geometryObbInRenderSR?.intersectsFrustum(t)&&r.push(o.geometryObbInRenderSR)}),"integrated-mesh-3dtiles"===e.type&&e.forEachVisibleComponentObject(({obb:e})=>{e.intersectsFrustum(t)&&r.push(e)})}_sufficientIntegratedMeshCoverage(e,t){const{renderCoordsHelper:r,spatialReference:o}=this.view,i=[],n=new w({spatialReference:o});if(this._intersectingObbs.forEach(e=>{if(oe(e.radius,t)&&(e.getCorners(ae),n.points.length=0,ae.forEach(e=>{const t=r.fromRenderCoords(e,le,o);t&&n.addPoint([t[0],t[1]])}),n.points.length)){const e=b(n);"polygon"===e?.type&&i.push(e)}}),!i.length)return!1;const s=x(i);return!!s&&E(s,e)}_findIntersectingTerrainTiles(e){const{basemapTerrain:t}=this.view;if(this._intersectingTiles.length=0,!e.extent)return;G(e.extent,se);const r=this._tileIterator;r.reset(t.rootTiles);for(let o=r.next();o;o=r.next())o.intersectsExtent(se)?o.rendered&&this._intersectingTiles.push(o):r.skipSubtree()}_sufficientTerrainCoverage(e){const{basemapTerrain:{tilingScheme:t}}=this.view;if(!this._intersectingTiles.length)return!1;const r=256/t.pixelSize;return this._intersectingTiles.every(t=>oe(t.radius*r,e))}};function $(e,t){t.hasZ=!0,t.rings.forEach(t=>t.forEach(t=>t[2]=q(e,t,"ground")??0))}function ee(e,t,r){return e*(r-t)+t}function te(e){if(!e)return null;let t=null,r=null,o=0;for(const i of e)t||(t=[i[0],i[1]]),r?o+=d(r,i):r=[0,0],r[0]=i[0],r[1]=i[1];return t&&r&&(o+=d(r,t)),Math.sqrt(o)}function*re(e){const t=h();for(let r=0;r<e.length;r++)t[0]=e[r][0],t[1]=e[r][1],yield t}e([p()],Y.prototype,"_projectedGeometry",null),e([p()],Y.prototype,"_localOrigin",null),e([p()],Y.prototype,"_getElevationProvider",void 0),e([p()],Y.prototype,"elevationAlignedGeometry",null),e([p()],Y.prototype,"targetGeometry",null),e([p()],Y.prototype,"_targetGeometryRenderInfo",null),e([p({constructOnly:!0})],Y.prototype,"analysis",void 0),e([p({constructOnly:!0})],Y.prototype,"analysisViewData",void 0),e([p({constructOnly:!0})],Y.prototype,"view",void 0),e([p()],Y.prototype,"updating",null),e([p()],Y.prototype,"result",null),e([p()],Y.prototype,"depthExtremaPositions",void 0),e([p()],Y.prototype,"error",null),e([p()],Y.prototype,"_imLayerViewsAffectingMeasurement",null),e([p()],Y.prototype,"_insufficientDataError",null),e([p()],Y.prototype,"_perimeterTooLargeError",null),e([p()],Y.prototype,"_perimeterTooLargeLocalError",null),e([p()],Y.prototype,"_perimeterTooLargeGlobalError",null),e([p()],Y.prototype,"_unsupportedCoordinateSystemError",null),e([p()],Y.prototype,"_unsupportedLayerTransparencyError",null),e([p()],Y.prototype,"_perimeterForError",null),e([p()],Y.prototype,"_computationRenderNode",void 0),e([p({readOnly:!0})],Y.prototype,"_updatingHandles",void 0),e([p()],Y.prototype,"_rawResult",void 0),e([p()],Y.prototype,"_sufficientDataCoverage",void 0),Y=e([m("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementCutFillController")],Y);const oe=(e,t)=>e<(t.width+t.height)/2,ie=P(),ne=P(),se=O(),ae=new Array(8).fill(0).map(()=>_()),le=_();export{Y as VolumeMeasurementCutFillController};
|
|
2
|
+
import{__decorate as e}from"tslib";import{volumeMeasurementConfiguration as t}from"../../../../analysis/VolumeMeasurement/volumeMeasurementConfiguration.js";import r from"../../../../core/Accessor.js";import o from"../../../../core/Logger.js";import{debounce as i,isPromiseLike as n}from"../../../../core/promiseUtils.js";import{createVolume as s}from"../../../../core/quantity.js";import{whenOnce as a,watch as l,syncAndInitial as u}from"../../../../core/reactiveUtils.js";import{property as p,subclass as m}from"../../../../core/accessorSupport/decorators.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{sqrDist as d}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{scaleAndAdd as g}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as f,clone as y,create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as v}from"../../../../core/support/UpdatingHandles.js";import w from"../../../../geometry/Multipoint.js";import{projectOrLoad as j}from"../../../../geometry/projectionUtils.js";import{e as E}from"../../../../chunks/containsOperator.js";import{e as b}from"../../../../chunks/convexHullOperator.js";import{e as R}from"../../../../chunks/simplifyOperator.js";import{e as x}from"../../../../chunks/unionOperator.js";import{computeTranslationToOriginAndRotation as C}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBoundingRect as T}from"../../../../geometry/projection/projectBoundingRect.js";import{fromExtent as G,intersects as L,create as O,empty as P}from"../../../../geometry/support/aaBoundingRect.js";import{isClockwise as D}from"../../../../geometry/support/coordsUtils.js";import{newDoubleArray as H}from"../../../../geometry/support/DoubleArray.js";import{t as V}from"../../../../chunks/vec3.js";import I from"../../../../symbols/support/ElevationInfo.js";import{logFailedGeometryProjectionError as M}from"../support/projectionUtils.js";import{VolumeMeasurementCutFillComputation as U}from"./VolumeMeasurementCutFillComputation.js";import{VolumeMeasurementInsufficientDataError as N,VolumeMeasurementPerimeterTooLargeError as k,VolumeMeasurementUnsupportedCoordinateSystemError as A,VolumeMeasurementUnsupportedLayerTransparencyError as F}from"./volumeMeasurementErrors.js";import{VolumeMeasurementRawResult as S}from"./VolumeMeasurementRawResult.js";import W from"./VolumeMeasurementResult.js";import{ElevationContext as z}from"../../layers/graphics/ElevationContext.js";import{getElevationAtPoint as q}from"../../support/ElevationProvider.js";import{polygonToRenderInfoElevationAligned as B}from"../../support/renderInfoUtils/polygon.js";import{IteratorPreorder as Z}from"../../terrain/tileUtils.js";import{CutFillComputationRenderNode as J,TargetGeometryRenderInfo as K}from"../../webgl-engine/lib/CutFillComputationRenderNode.js";import{GeometryWorkerHandle as Q}from"../../../support/GeometryWorkerHandle.js";import{isIntegratedMeshLayerView as X}from"../../../support/layerViewUtils.js";let Y=class extends r{constructor(e){super(e),this._measurementWorkerHandle=new Q,this._getElevationProvider=()=>this.view.elevationProvider,this.depthExtremaPositions=null,this._updatingHandles=new v,this._rawResult=null,this._sufficientDataCoverage=!0,this._tileIterator=new Z,this._intersectingObbs=[],this._intersectingTiles=[],this._debouncedUpdate=i(async(e,t,r,o)=>{if(!this._computationRenderNode.done)return;const{renderCoordsHelper:i}=this.view,n=new U({extent:t,localOrigin:r,renderCoordsHelper:i});this._computationRenderNode.update(n,o),this._determineDataCoverage(n);const[s]=await Promise.allSettled([this._measurementWorkerHandle.areaHorizontal(e,{returnLength:!0}),a(()=>this._computationRenderNode.done).then(()=>{this._updateDepthExtremaPositions(n,this._computationRenderNode.getResult())})]);if(this.error)return void(this._rawResult=null);const l=this._computationRenderNode.getResult();this._updateResult(n,l,"fulfilled"===s.status?s.value:null)}),this._determineDataCoverage=e=>{const{elevationAlignedGeometry:t}=this,{frustum:r}=this._computationRenderNode,{cameraDimensions:o}=e;t&&r&&(this._intersectingObbs.length=0,this._imLayerViewsAffectingMeasurement.forEach(e=>{this._findIntersectingObbs(e,r)}),this._intersectingObbs.length?this._sufficientDataCoverage=this._sufficientIntegratedMeshCoverage(t,o):(this._findIntersectingTerrainTiles(t),this._sufficientDataCoverage=this._sufficientTerrainCoverage(o)))}}initialize(){const e=this.view;this._computationRenderNode=new J({view:e}),this.addHandles([this._createElevationUpdateHandle(),l(()=>({projectedGeometry:this._projectedGeometry,localOrigin:this._localOrigin,targetGeometryRenderInfo:this._targetGeometryRenderInfo}),({projectedGeometry:e,localOrigin:t,targetGeometryRenderInfo:r})=>{const o=e?.extent;if(!(e&&o&&t&&r))return this._rawResult=null,void(this._sufficientDataCoverage=!0);this._updatingHandles.consumePromise(this._debouncedUpdate(e,o,t,r))},u)])}destroy(){this._updatingHandles.destroy(),this._computationRenderNode.destroy(),this._measurementWorkerHandle.destroy()}get _projectedGeometry(){const e=this.analysis.geometry;if(!e||!this.analysis.valid)return null;const t=R(e),r=j(t,this.view.spatialReference);return r.pending?(this._updatingHandles.consumePromise(r.pending),null):(t&&!r.geometry&&M(this.analysis,e.spatialReference,o.getLogger(this)),r.geometry)}get _localOrigin(){const e=this._projectedGeometry?.extent;return e?f(e.center.x,e.center.y,0):null}get elevationAlignedGeometry(){const e=this._projectedGeometry;if(!e)return null;const t=e.clone();return $(this._getElevationProvider(),t),t}get targetGeometry(){const{elevationAlignedGeometry:e}=this;if(!e)return null;const t=this.analysis.measureType,{effectiveTargetElevation:r}=this.analysisViewData;if("stockpile"===t||null==r)return e;const o=e.clone();return o.rings.forEach(e=>e.forEach(e=>e[2]=r)),o}get _targetGeometryRenderInfo(){const e=this.targetGeometry,t=this._projectedGeometry?.extent,r=this._localOrigin;if(!e||!t||!r)return null;const{elevationProvider:o,renderCoordsHelper:i}=this.view,s=B(e,o,i,z.fromElevationInfo(new I({mode:"absolute-height"})));if(n(s))return this._updatingHandles.consumePromise(s),null;if(null==s)return null;const{positions:a,polygonIndices:l,vertexCount:u}=s,p=H(3*u),m=c(),d=c();return C(t.spatialReference,r,m,i.spatialReference),d[12]=-m[12],d[13]=-m[13],d[14]=-m[14],V(p,a,d),new K(p,l)}get updating(){return this._computationRenderNode.updating||this._updatingHandles.updating}get result(){const e=this._rawResult,{volume:t,area:r,length:o}=this.analysisViewData.effectiveDisplayUnits;return e?new W({measureType:this.analysis.measureType,rawResult:e,volumeUnit:t,areaUnit:r,lengthUnit:o}):null}get error(){return this._unsupportedCoordinateSystemError??this._unsupportedLayerTransparencyError??this._perimeterTooLargeError??this._insufficientDataError}get _imLayerViewsAffectingMeasurement(){return this.view.allLayerViews.filter(e=>X(e)).filter(e=>e.visible&&!e.suspended)}get _insufficientDataError(){return this._sufficientDataCoverage?null:new N}get _perimeterTooLargeError(){return this._perimeterTooLargeLocalError??this._perimeterTooLargeGlobalError}get _perimeterTooLargeLocalError(){const{spatialReference:e,state:{isLocal:r}}=this.view;if(!r||!e.isWebMercator)return null;const o=this._perimeterForError,{maxPerimeterLocalWebMercator:i}=t;return null!=o&&o>i?new k:null}get _perimeterTooLargeGlobalError(){if(!this.view.state.isGlobal)return null;const e=this._perimeterForError,{maxPerimeterGlobal:r}=t;return null!=e&&e>r?new k:null}get _unsupportedCoordinateSystemError(){return this.view.state.isLocal&&this.view.spatialReference.isGeographic?new A:null}get _unsupportedLayerTransparencyError(){return this.view.map.ground&&this.view.map.ground.opacity<1?new F:null}get _perimeterForError(){const{targetGeometry:e}=this;if(null==e)return null;let t=null;for(const r of e.rings){if(!D(r))continue;const e=te(re(r));t=e?Math.max(t??0,e):t}return null!=t?t*e.spatialReference.metersPerUnit:null}_createElevationUpdateHandle(){const e=e=>{const t=this._projectedGeometry?.extent;"ground"===e.context&&t&&(T(e.extent,e.spatialReference,ie,this.view.spatialReference),G(t,ne),L(ie,ne)&&(this._getElevationProvider=()=>this.view.elevationProvider))};return this.view.elevationProvider.on("elevation-change",t=>e(t))}_updateResult(e,t,r){const{unitInMeters:o}=this.view.renderCoordsHelper,{dimensions:{width:i,height:n},cameraNearFar:{near:a,far:l}}=e,u=i/t.width*(n/t.height),p=ee(t.cut.totalDepth,a,l)*u,m=ee(t.fill.totalDepth,a,l)*u,c=o**3;this._rawResult=new S({cutVolume:s(Math.abs(p*c),"cubic-meters"),fillVolume:s(m*c,"cubic-meters"),area:r?.area,perimeter:r?.length})}_updateDepthExtremaPositions(e,t){const{dimensions:{width:r,height:o},cameraNearFar:{near:i,far:n},cameraPositionRenderSpace:s,northVector:a,eastVector:l,upVector:u}=e,p=e=>{const{depthExtremum:p,depthExtremumCoords:[m,c],totalDepth:d}=e,h=y(s);return 0!==d&&(g(h,h,l,r*(m/t.width-.5)),g(h,h,a,o*(c/t.height-.5))),g(h,h,u,-ee(p,i,n)),h};this.depthExtremaPositions={cut:p(t.cut),fill:p(t.fill)}}_findIntersectingObbs(e,t){const r=this._intersectingObbs;"integrated-mesh-3d"===e.type&&e.getVisibleNodes().forEach(o=>{e.isNodeLoaded(o.index)&&o.geometryObbInRenderSR?.intersectsFrustum(t)&&r.push(o.geometryObbInRenderSR)}),"integrated-mesh-3dtiles"===e.type&&e.forEachVisibleComponentObject(({obb:e})=>{e.intersectsFrustum(t)&&r.push(e)})}_sufficientIntegratedMeshCoverage(e,t){const{renderCoordsHelper:r,spatialReference:o}=this.view,i=[],n=new w({spatialReference:o});if(this._intersectingObbs.forEach(e=>{if(oe(e.radius,t)&&(e.getCorners(ae),n.points.length=0,ae.forEach(e=>{const t=r.fromRenderCoords(e,le,o);t&&n.addPoint([t[0],t[1]])}),n.points.length)){const e=b(n);"polygon"===e?.type&&i.push(e)}}),!i.length)return!1;const s=x(i);return!!s&&E(s,e)}_findIntersectingTerrainTiles(e){const{basemapTerrain:t}=this.view;if(this._intersectingTiles.length=0,!e.extent)return;G(e.extent,se);const r=this._tileIterator;r.reset(t.rootTiles);for(let o=r.next();o;o=r.next())o.intersectsExtent(se)?o.rendered&&this._intersectingTiles.push(o):r.skipSubtree()}_sufficientTerrainCoverage(e){const{basemapTerrain:{tilingScheme:t}}=this.view;if(!this._intersectingTiles.length)return!1;const r=256/t.pixelSize;return this._intersectingTiles.every(t=>oe(t.radius*r,e))}};function $(e,t){t.hasZ=!0,t.rings.forEach(t=>t.forEach(t=>t[2]=q(e,t,"ground")??0))}function ee(e,t,r){return e*(r-t)+t}function te(e){if(!e)return null;let t=null,r=null,o=0;for(const i of e)t||(t=[i[0],i[1]]),r?o+=d(r,i):r=[0,0],r[0]=i[0],r[1]=i[1];return t&&r&&(o+=d(r,t)),Math.sqrt(o)}function*re(e){const t=h();for(let r=0;r<e.length;r++)t[0]=e[r][0],t[1]=e[r][1],yield t}e([p()],Y.prototype,"_projectedGeometry",null),e([p()],Y.prototype,"_localOrigin",null),e([p()],Y.prototype,"_getElevationProvider",void 0),e([p()],Y.prototype,"elevationAlignedGeometry",null),e([p()],Y.prototype,"targetGeometry",null),e([p()],Y.prototype,"_targetGeometryRenderInfo",null),e([p({constructOnly:!0})],Y.prototype,"analysis",void 0),e([p({constructOnly:!0})],Y.prototype,"analysisViewData",void 0),e([p({constructOnly:!0})],Y.prototype,"view",void 0),e([p()],Y.prototype,"updating",null),e([p()],Y.prototype,"result",null),e([p()],Y.prototype,"depthExtremaPositions",void 0),e([p()],Y.prototype,"error",null),e([p()],Y.prototype,"_imLayerViewsAffectingMeasurement",null),e([p()],Y.prototype,"_insufficientDataError",null),e([p()],Y.prototype,"_perimeterTooLargeError",null),e([p()],Y.prototype,"_perimeterTooLargeLocalError",null),e([p()],Y.prototype,"_perimeterTooLargeGlobalError",null),e([p()],Y.prototype,"_unsupportedCoordinateSystemError",null),e([p()],Y.prototype,"_unsupportedLayerTransparencyError",null),e([p()],Y.prototype,"_perimeterForError",null),e([p()],Y.prototype,"_computationRenderNode",void 0),e([p({readOnly:!0})],Y.prototype,"_updatingHandles",void 0),e([p()],Y.prototype,"_rawResult",void 0),e([p()],Y.prototype,"_sufficientDataCoverage",void 0),Y=e([m("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementCutFillController")],Y);const oe=(e,t)=>e<(t.width+t.height)/2,ie=P(),ne=P(),se=O(),ae=new Array(8).fill(0).map(()=>_()),le=_();export{Y as VolumeMeasurementCutFillController};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import{isSome as o}from"../../../../../core/arrayUtils.js";import e from"../../../../../core/Collection.js";import{EventEmitter as i}from"../../../../../core/Evented.js";import{makeHandle as n}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as s}from"../../../../../core/maybe.js";import{debounce as a}from"../../../../../core/promiseUtils.js";import{scale as l,zeroMeters as r}from"../../../../../core/quantity.js";import{watch as p,initial as c,syncAndInitial as h}from"../../../../../core/reactiveUtils.js";import{property as m,subclass as u}from"../../../../../core/accessorSupport/decorators.js";import{ensureType as d}from"../../../../../core/accessorSupport/ensureType.js";import{UpdatingHandles as v}from"../../../../../core/support/UpdatingHandles.js";import f from"../../../../../geometry/Point.js";import{makeDehydratedPoint as _}from"../../../../../layers/graphics/dehydratedPoint.js";import{getConvertedElevation as g}from"../../../../../support/elevationInfoUtils.js";import{SnappingVisualizer3D as M}from"../../SnappingVisualizer3D.js";import{orientation as b}from"../geometryUtils.js";import{manipulatedObjectGeometry as j}from"../manipulatedObjectUtils.js";import{canMoveZOperations as y}from"../manipulatorUtils.js";import{meshTransformFastUpdateHandles as T}from"../meshFastUpdateUtils.js";import{connectTooltipToManipulatedObject as w}from"../tooltipUtils3D.js";import{createVisualElements as I}from"../visualElementUtils.js";import{discRadius as S}from"../manipulations/config.js";import{MoveManipulation as H}from"../manipulations/MoveManipulation.js";import{axisConstrainedDragSign as x}from"../manipulations/moveUtils.js";import{MoveXYObjectManipulation as O}from"../manipulations/MoveXYObjectManipulation.js";import{isSupportedObject as P}from"./isSupportedObject.js";import{OutlineVisualElement as k}from"../../visualElements/OutlineVisualElement.js";import{createElevationUpdateHandle as D}from"../../../support/elevationUpdateUtils.js";import{dragManipulatedObjectMany as E,resetManipulatedObjectMany as U}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as A}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as R}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import z from"../../../../interactive/sketch/SketchOptions.js";import{SnappingContext as X}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as Y}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as C,enterInputModeIfAvailable as Z}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{MovePointTooltipInfo as F}from"../../../../interactive/tooltip/infos/MovePointTooltipInfo.js";import{TranslateTooltipInfo as G}from"../../../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{TranslateXYTooltipInfo as V}from"../../../../interactive/tooltip/infos/TranslateXYTooltipInfo.js";import{TranslateZTooltipInfo as W}from"../../../../interactive/tooltip/infos/TranslateZTooltipInfo.js";import{verticalSignedDistanceBetweenPoints as B}from"../../../../support/euclideanLengthMeasurementUtils.js";import{MeasurementWorkerHandle as N}from"../../../../support/MeasurementWorkerHandle.js";class q{constructor(t){this.objects=t,this.type="move-start"}}class L{constructor(t,o,e){this.dx=t,this.dy=o,this.objects=e,this.type="move"}}class J{constructor(t){this.objects=t,this.type="move-stop"}}const K=Symbol("manipulators"),Q=Symbol("tooltips");let $=class extends A{constructor(t){super(t),this._infos=new Map,this.events=new i,this.objects=new e,this.enableZ=!0,this.sketchOptions=new z,this.type="move-3d",this._measurementWorker=new N({preloadGeodetic:!0}),this._latestTooltipInfo=null,this._translateTooltipInfo=null,this._translateXYTooltipInfo=null,this._translateZTooltipInfo=null,this._updatingHandles=new v,this._moveManipulation=null,this._updateMoveTooltipDistanceDebounced=a(this._updateMoveTooltipDistanceAsync.bind(this))}initialize(){const{view:t}=this;this.tooltip=C(()=>({view:t,options:this.sketchOptions.tooltips})),this.addHandles([this.objects.on("change",t=>{t.removed.forEach(t=>this.removeHandles(t)),this._updateObjectInfos(t),this._setupFastTransformUpdates(t.added),this._refreshManipulators()}),this.objects.on("change",()=>this._connectTooltips())]);const o=this.objects.toArray();this._updateObjectInfos({added:o,removed:[]}),this._setupFastTransformUpdates(o),this._refreshManipulators(),this._connectTooltips(),this.finishToolCreation()}destroy(){this.tooltip=s(this.tooltip),this._moveManipulation=s(this._moveManipulation),this._set("view",null),this._updatingHandles.destroy(),this._measurementWorker.destroy()}onInputEvent(t){if(!this.destroyed&&!Z(t,this.tooltip))return super.onInputEvent(t)}get updating(){return this._updatingHandles.updating}get _shouldShowMovePointTooltip(){const{objects:t}=this;if(1!==t.length)return!1;const o=j(t.at(0))?.type;return"point"===o||"mesh"===o}get activeTooltipInfo(){return this._shouldShowMovePointTooltip?this._movePointTooltipInfo:this._latestTooltipInfo}reset(){}_updateObjectInfos({added:t,removed:o}){for(const e of t){if(0!==P(e))continue;const t=new ot(e);this._infos.set(e,t)}for(const e of o)this._infos.delete(e)}_setupFastTransformUpdates(t){for(const o of t){const t=this._infos.get(o);this.addHandles(T(t.object),o)}}_refreshManipulators(){if(this.removeHandles(K),this._moveManipulation=s(this._moveManipulation),this.manipulators.removeAll(),0===this._infos.size)return;const t=Array.from(this._infos.values());this._createManipulators(t),this._createVisualElements(t),this._updateMoveManipulation(t)}_createManipulators(t){for(const o of t){const e=o.object;o.manipulationXY=new O({tool:this,view:this.view,object:e}),o.manipulationXY.forEachManipulator(t=>{this.addHandles([t.events.on("immediate-click",t=>{this.events.emit("immediate-click",{...t,object:e}),t.stopPropagation()}),t.events.on("grab-changed",({action:t})=>{"start"===t?this._showTooltip(0):this._hideTooltip()})],K)}),this.addHandles(o.manipulationXY.createDragPipeline((o,e,i,n)=>this._buildDragEventPipeline(t,0,o,e,i,n)),K)}this._createMoveManipulation(t)}_createMoveManipulation(t){const o=new H({tool:this,view:this.view,snapToScene:!1,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:!0,radius:1===t.length?H.radiusForSymbol(t[0].object.graphic?.symbol):S});this._moveManipulation=o,o.elevationInfo={mode:"absolute-height",offset:0},o.forEachManipulator(t=>{this.addHandles(t.events.on("immediate-click",e=>{const i=this.objects.at(0);!o.zManipulation.hasManipulator(t)&&1===this.objects.length&&i&&this.events.emit("immediate-click",{...e,object:i}),e.stopPropagation()}),K)});const e=t=>o=>{this.addHandles([o.events.on("focus-changed",({action:o})=>{"focus"===o?this._showTooltip(t):this._hideTooltip()}),o.events.on("grab-changed",()=>{this._latestTooltipInfo&&(this._latestTooltipInfo.distance=r)})],K)};this._moveManipulation.xyManipulation.forEachManipulator(e(0)),this._moveManipulation.xyAxisManipulation.forEachManipulator(e(1)),this._moveManipulation.zManipulation.forEachManipulator(e(2));const i=()=>this._updateMoveManipulation(t);for(const r of t){this.addHandles([r.object.on("committed",i),p(()=>r.object.visible,i)],K);const o=Symbol();this.addHandles(p(()=>r.object.isDraped,e=>{this._updateMoveManipulation(t),this.removeHandles(o),e&&this.addHandles(D({view:this.view,geometry:r.object.graphic?.geometry,elevationInfo:r.object.elevationInfo,onElevationChanges:()=>this._updateMoveManipulation(t)}),o)},c),K),this.addHandles(n(()=>this.removeHandles(o)),K)}const s=t[t.length-1];this.addHandles(s.object.on("committed",()=>this._updateMoveManipulationAngle(s)),K);const{object:a}=s,{operations:l}=a;if(l){const e=a.graphic;this.addHandles(o.createDragPipeline((o,e,i,n,s)=>this._buildDragEventPipeline(t,o,e,i,n,s),a.elevationInfo,l.data.spatialReference,e),K)}this._updateMoveManipulationAngle(s)}_createVisualElements(t){for(const o of t){const e=o.object,i=I({view:this.view,object:e,forEachManipulator:t=>{o.manipulationXY?.forEachManipulator(t),this._moveManipulation?.forEachManipulator(t)},onManipulatorsChanged:()=>n()});null!=i&&(o.geometryRepresentation=i.visualElement,o.geometryRepresentation instanceof k&&this.addHandles([o.geometryRepresentation.events.on("attachment-origin-changed",()=>{o.object.isDraped||this._updateMoveManipulation(t)}),p(()=>o.object.isDraped,()=>this._updateMoveManipulation(t))],K),this.addHandles(i,K))}}_updateMoveManipulationAngle(t){this._moveManipulation&&(this._moveManipulation.angle=b(j(t.object)))}_updateMoveManipulation(t){const o=_(0,0,0,this.view.spatialReference);let e=0,i=!1;const n=this._moveManipulation;if(n){for(const n of t){if(!n.object.visible)continue;this.enableZ&&y(n.object.operations,n.object.elevationInfo)&&(i=!0);const t=n.geometryRepresentation instanceof k&&!n.object.isDraped?n.geometryRepresentation.attachmentOrigin:n.object.origin;if(null!=t){const{x:i,y:n,z:s}=t;o.x+=i,o.y+=n,s&&(o.z??=0,o.z+=s),e++}}e>0?(o.x/=e,o.y/=e,o.z??=0,o.z/=e,n.location=o,n.xyManipulation.available=!0,n.xyAxisManipulation.available=!0,n.zManipulation.available=i):n.available=!1}}_buildDragEventPipeline(t,o,e,i,n,s){const a=[],l=[];let r=null,p=null;const c=()=>{for(const t of a)t.dragging=!1;a.length=0,l.length=0,r=null,p=null,this._moveManipulation&&(this._moveManipulation.interactive=!0)};if(1===t.length&&0===o){const o=t[0].object;({steps:i,cancel:n}=this._buildSnappingPipelineSteps(o,o.elevationInfo,i,n,s))}return n=n.next(t=>p?.(t)).next(()=>(l.length&&this.events.emit("move-stop",new J(l)),this.destroyed||c(),null)),{steps:i=i.next(o=>{if("start"===o.action){a.length=0,l.length=0;for(const o of t)o.dragging||!o.manipulationXY?.hasManipulator(e)&&o.manipulationXY?.grabbing||(a.push(o),l.push(o.object),o.dragging=!0);if(0!==l.length&&(this._moveManipulation&&(this._moveManipulation.interactive=!1),r=E(l),p=U(l),this._emitRecordUndo(),this.events.emit("move-start",new q(l)),this.destroyed))return null}return 0!==l.length?o:null}).next(t=>r?.(t)).next(t=>(this._updateMoveTooltip(o,t),t)).next(t=>{switch(t.action){case"start":case"update":if(t.translationX||t.translationY||t.translationZ){const o=this.view.toScreen(t.mapStart),e=this.view.toScreen(t.mapEnd);if(!o||!e)return null;const i=e.x-o.x,n=e.y-o.y;if(this.events.emit("move",new L(i,n,l)),this.destroyed)return null}break;case"end":if(this.events.emit("move-stop",new J(l)),this.destroyed)return null;c()}return null}),cancel:n}}_connectTooltips(){let t;if(this.removeHandles(Q),this._shouldShowMovePointTooltip){const o=this.objects.at(0),{events:e}=this;this._movePointTooltipInfo??=new F({viewType:this.view.type,sketchOptions:this.sketchOptions});const i={onBeforeUpdate:()=>this.endDrag(),onMoveStart:()=>{this._emitRecordUndo(),e.emit("move-start",new q([o]))},onMove:()=>e.emit("move",new L(0,0,[o])),onMoveStop:()=>e.emit("move-stop",new J([o])),onRotateStart:()=>{},onRotate:()=>{},onRotateStop:()=>{},onScaleStart:()=>{},onScale:()=>{},onScaleStop:()=>{}};t=w(this.tooltip,o,()=>({sketchOptions:this.sketchOptions,activeTooltipInfo:this._movePointTooltipInfo,callbacks:i}))}else t=p(()=>this.sketchOptions.tooltips.effectiveEnabled?this._latestTooltipInfo:null,t=>{this.tooltip.info=t},h);this.addHandles(t,Q)}_showTooltip(t){this._shouldShowMovePointTooltip||this._updateMoveTooltip(t)}_hideTooltip(){this._shouldShowMovePointTooltip||(this.tooltip?.clear(),this._latestTooltipInfo=null)}_updateMoveTooltip(t,o){if(this._shouldShowMovePointTooltip)return;const{sketchOptions:e}=this;switch(t){case 0:this._latestTooltipInfo=this._translateTooltipInfo??=new G({sketchOptions:e}),this._updatingHandles.consumePromise(this._updateMoveTooltipDistanceDebounced(this._latestTooltipInfo,o,(t,o)=>this._measurementWorker.autoDistance2DBetweenPoints(tt(t),tt(o))));break;case 1:this._latestTooltipInfo=this._translateXYTooltipInfo??=new V({sketchOptions:e}),this._updatingHandles.consumePromise(this._updateMoveTooltipDistanceDebounced(this._latestTooltipInfo,o,async(t,e)=>l(await this._measurementWorker.autoDistance2DBetweenPoints(tt(t),tt(e)),x(o))));break;case 2:this._latestTooltipInfo=this._translateZTooltipInfo??=new W({sketchOptions:e}),this._updatingHandles.consumePromise(this._updateMoveTooltipDistanceDebounced(this._latestTooltipInfo,o,B))}this._latestTooltipInfo.sketchOptions=e}async _updateMoveTooltipDistanceAsync(t,o,e){if(null!=o&&"end"!==o.action){const{mapStart:i,mapEnd:n}=o,s=await e(i,n);t.distance=s??r}else t.distance=r}_emitRecordUndo(){const t=this.objects.toArray().map(t=>t.createUndoRecord?.()).filter(o);t.length>0&&this.events.emit("record-undo",{updates:t})}_buildSnappingPipelineSteps(t,o,e,i,n){const s=j(t);if(null==s||"point"!==s.type&&"mesh"!==s.type)return{steps:e,cancel:i};const a=("point"===s.type?s:s.origin).clone(),l=new X({elevationInfo:o,pointer:n,editGeometryOperations:R.fromGeometry(a,this.view.state.viewingMode),visualizer:new M,excludeFeature:t.graphic}),r=this.snappingManager,{snappingStep:p,cancelSnapping:c}=Y({snappingContext:l,snappingManager:r,updatingHandles:this._updatingHandles});return i=i.next(c),{steps:e=e.next(o=>{a.z=g(this.view,a,t.elevationInfo,{mode:"absolute-height",offset:0});return{...o,snapOrigin:l.coordinateHelper.pointToVector(a)}}).next(...p),cancel:i}}get test(){}};t([m({constructOnly:!0,nonNullable:!0})],$.prototype,"view",void 0),t([m()],$.prototype,"objects",void 0),t([m({constructOnly:!0,nonNullable:!0})],$.prototype,"enableZ",void 0),t([m({constructOnly:!0,type:z})],$.prototype,"sketchOptions",void 0),t([m({constructOnly:!0})],$.prototype,"snappingManager",void 0),t([m()],$.prototype,"type",void 0),t([m()],$.prototype,"updating",null),t([m()],$.prototype,"_latestTooltipInfo",void 0),t([m()],$.prototype,"_shouldShowMovePointTooltip",null),t([m()],$.prototype,"activeTooltipInfo",null),$=t([u("esri.views.3d.interactive.editingTools.move.MoveTool3D")],$);const tt=d(f);class ot{constructor(t){this.object=t,this.geometryRepresentation=null,this.manipulationXY=null,this.dragging=!1}}export{L as MoveEvent,q as MoveStartEvent,J as MoveStopEvent,$ as MoveTool3D};
|
|
2
|
+
import{__decorate as t}from"tslib";import{isSome as o}from"../../../../../core/arrayUtils.js";import e from"../../../../../core/Collection.js";import{EventEmitter as i}from"../../../../../core/Evented.js";import{makeHandle as n}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as s}from"../../../../../core/maybe.js";import{debounce as a}from"../../../../../core/promiseUtils.js";import{scale as l,zeroMeters as r}from"../../../../../core/quantity.js";import{watch as p,initial as c,syncAndInitial as h}from"../../../../../core/reactiveUtils.js";import{property as m,subclass as u}from"../../../../../core/accessorSupport/decorators.js";import{ensureType as d}from"../../../../../core/accessorSupport/ensureType.js";import{UpdatingHandles as v}from"../../../../../core/support/UpdatingHandles.js";import f from"../../../../../geometry/Point.js";import{makeDehydratedPoint as _}from"../../../../../layers/graphics/dehydratedPoint.js";import{getConvertedElevation as g}from"../../../../../support/elevationInfoUtils.js";import{SnappingVisualizer3D as M}from"../../SnappingVisualizer3D.js";import{orientation as b}from"../geometryUtils.js";import{manipulatedObjectGeometry as j}from"../manipulatedObjectUtils.js";import{canMoveZOperations as y}from"../manipulatorUtils.js";import{meshTransformFastUpdateHandles as T}from"../meshFastUpdateUtils.js";import{connectTooltipToManipulatedObject as w}from"../tooltipUtils3D.js";import{createVisualElements as I}from"../visualElementUtils.js";import{discRadius as S}from"../manipulations/config.js";import{MoveManipulation as H}from"../manipulations/MoveManipulation.js";import{axisConstrainedDragSign as x}from"../manipulations/moveUtils.js";import{MoveXYObjectManipulation as O}from"../manipulations/MoveXYObjectManipulation.js";import{isSupportedObject as P}from"./isSupportedObject.js";import{OutlineVisualElement as k}from"../../visualElements/OutlineVisualElement.js";import{createElevationUpdateHandle as D}from"../../../support/elevationUpdateUtils.js";import{dragManipulatedObjectMany as E,resetManipulatedObjectMany as U}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as A}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as R}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import z from"../../../../interactive/sketch/SketchOptions.js";import{SnappingContext as X}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as Y}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as C,enterInputModeIfAvailable as Z}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{MovePointTooltipInfo as F}from"../../../../interactive/tooltip/infos/MovePointTooltipInfo.js";import{TranslateTooltipInfo as G}from"../../../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{TranslateXYTooltipInfo as V}from"../../../../interactive/tooltip/infos/TranslateXYTooltipInfo.js";import{TranslateZTooltipInfo as W}from"../../../../interactive/tooltip/infos/TranslateZTooltipInfo.js";import{verticalSignedDistanceBetweenPoints as B}from"../../../../support/euclideanLengthMeasurementUtils.js";import{GeometryWorkerHandle as N}from"../../../../support/GeometryWorkerHandle.js";class q{constructor(t){this.objects=t,this.type="move-start"}}class L{constructor(t,o,e){this.dx=t,this.dy=o,this.objects=e,this.type="move"}}class J{constructor(t){this.objects=t,this.type="move-stop"}}const K=Symbol("manipulators"),Q=Symbol("tooltips");let $=class extends A{constructor(t){super(t),this._infos=new Map,this.events=new i,this.objects=new e,this.enableZ=!0,this.sketchOptions=new z,this.type="move-3d",this._measurementWorker=new N({preloadGeodetic:!0}),this._latestTooltipInfo=null,this._translateTooltipInfo=null,this._translateXYTooltipInfo=null,this._translateZTooltipInfo=null,this._updatingHandles=new v,this._moveManipulation=null,this._updateMoveTooltipDistanceDebounced=a(this._updateMoveTooltipDistanceAsync.bind(this))}initialize(){const{view:t}=this;this.tooltip=C(()=>({view:t,options:this.sketchOptions.tooltips})),this.addHandles([this.objects.on("change",t=>{t.removed.forEach(t=>this.removeHandles(t)),this._updateObjectInfos(t),this._setupFastTransformUpdates(t.added),this._refreshManipulators()}),this.objects.on("change",()=>this._connectTooltips())]);const o=this.objects.toArray();this._updateObjectInfos({added:o,removed:[]}),this._setupFastTransformUpdates(o),this._refreshManipulators(),this._connectTooltips(),this.finishToolCreation()}destroy(){this.tooltip=s(this.tooltip),this._moveManipulation=s(this._moveManipulation),this._set("view",null),this._updatingHandles.destroy(),this._measurementWorker.destroy()}onInputEvent(t){if(!this.destroyed&&!Z(t,this.tooltip))return super.onInputEvent(t)}get updating(){return this._updatingHandles.updating}get _shouldShowMovePointTooltip(){const{objects:t}=this;if(1!==t.length)return!1;const o=j(t.at(0))?.type;return"point"===o||"mesh"===o}get activeTooltipInfo(){return this._shouldShowMovePointTooltip?this._movePointTooltipInfo:this._latestTooltipInfo}reset(){}_updateObjectInfos({added:t,removed:o}){for(const e of t){if(0!==P(e))continue;const t=new ot(e);this._infos.set(e,t)}for(const e of o)this._infos.delete(e)}_setupFastTransformUpdates(t){for(const o of t){const t=this._infos.get(o);this.addHandles(T(t.object),o)}}_refreshManipulators(){if(this.removeHandles(K),this._moveManipulation=s(this._moveManipulation),this.manipulators.removeAll(),0===this._infos.size)return;const t=Array.from(this._infos.values());this._createManipulators(t),this._createVisualElements(t),this._updateMoveManipulation(t)}_createManipulators(t){for(const o of t){const e=o.object;o.manipulationXY=new O({tool:this,view:this.view,object:e}),o.manipulationXY.forEachManipulator(t=>{this.addHandles([t.events.on("immediate-click",t=>{this.events.emit("immediate-click",{...t,object:e}),t.stopPropagation()}),t.events.on("grab-changed",({action:t})=>{"start"===t?this._showTooltip(0):this._hideTooltip()})],K)}),this.addHandles(o.manipulationXY.createDragPipeline((o,e,i,n)=>this._buildDragEventPipeline(t,0,o,e,i,n)),K)}this._createMoveManipulation(t)}_createMoveManipulation(t){const o=new H({tool:this,view:this.view,snapToScene:!1,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:!0,radius:1===t.length?H.radiusForSymbol(t[0].object.graphic?.symbol):S});this._moveManipulation=o,o.elevationInfo={mode:"absolute-height",offset:0},o.forEachManipulator(t=>{this.addHandles(t.events.on("immediate-click",e=>{const i=this.objects.at(0);!o.zManipulation.hasManipulator(t)&&1===this.objects.length&&i&&this.events.emit("immediate-click",{...e,object:i}),e.stopPropagation()}),K)});const e=t=>o=>{this.addHandles([o.events.on("focus-changed",({action:o})=>{"focus"===o?this._showTooltip(t):this._hideTooltip()}),o.events.on("grab-changed",()=>{this._latestTooltipInfo&&(this._latestTooltipInfo.distance=r)})],K)};this._moveManipulation.xyManipulation.forEachManipulator(e(0)),this._moveManipulation.xyAxisManipulation.forEachManipulator(e(1)),this._moveManipulation.zManipulation.forEachManipulator(e(2));const i=()=>this._updateMoveManipulation(t);for(const r of t){this.addHandles([r.object.on("committed",i),p(()=>r.object.visible,i)],K);const o=Symbol();this.addHandles(p(()=>r.object.isDraped,e=>{this._updateMoveManipulation(t),this.removeHandles(o),e&&this.addHandles(D({view:this.view,geometry:r.object.graphic?.geometry,elevationInfo:r.object.elevationInfo,onElevationChanges:()=>this._updateMoveManipulation(t)}),o)},c),K),this.addHandles(n(()=>this.removeHandles(o)),K)}const s=t[t.length-1];this.addHandles(s.object.on("committed",()=>this._updateMoveManipulationAngle(s)),K);const{object:a}=s,{operations:l}=a;if(l){const e=a.graphic;this.addHandles(o.createDragPipeline((o,e,i,n,s)=>this._buildDragEventPipeline(t,o,e,i,n,s),a.elevationInfo,l.data.spatialReference,e),K)}this._updateMoveManipulationAngle(s)}_createVisualElements(t){for(const o of t){const e=o.object,i=I({view:this.view,object:e,forEachManipulator:t=>{o.manipulationXY?.forEachManipulator(t),this._moveManipulation?.forEachManipulator(t)},onManipulatorsChanged:()=>n()});null!=i&&(o.geometryRepresentation=i.visualElement,o.geometryRepresentation instanceof k&&this.addHandles([o.geometryRepresentation.events.on("attachment-origin-changed",()=>{o.object.isDraped||this._updateMoveManipulation(t)}),p(()=>o.object.isDraped,()=>this._updateMoveManipulation(t))],K),this.addHandles(i,K))}}_updateMoveManipulationAngle(t){this._moveManipulation&&(this._moveManipulation.angle=b(j(t.object)))}_updateMoveManipulation(t){const o=_(0,0,0,this.view.spatialReference);let e=0,i=!1;const n=this._moveManipulation;if(n){for(const n of t){if(!n.object.visible)continue;this.enableZ&&y(n.object.operations,n.object.elevationInfo)&&(i=!0);const t=n.geometryRepresentation instanceof k&&!n.object.isDraped?n.geometryRepresentation.attachmentOrigin:n.object.origin;if(null!=t){const{x:i,y:n,z:s}=t;o.x+=i,o.y+=n,s&&(o.z??=0,o.z+=s),e++}}e>0?(o.x/=e,o.y/=e,o.z??=0,o.z/=e,n.location=o,n.xyManipulation.available=!0,n.xyAxisManipulation.available=!0,n.zManipulation.available=i):n.available=!1}}_buildDragEventPipeline(t,o,e,i,n,s){const a=[],l=[];let r=null,p=null;const c=()=>{for(const t of a)t.dragging=!1;a.length=0,l.length=0,r=null,p=null,this._moveManipulation&&(this._moveManipulation.interactive=!0)};if(1===t.length&&0===o){const o=t[0].object;({steps:i,cancel:n}=this._buildSnappingPipelineSteps(o,o.elevationInfo,i,n,s))}return n=n.next(t=>p?.(t)).next(()=>(l.length&&this.events.emit("move-stop",new J(l)),this.destroyed||c(),null)),{steps:i=i.next(o=>{if("start"===o.action){a.length=0,l.length=0;for(const o of t)o.dragging||!o.manipulationXY?.hasManipulator(e)&&o.manipulationXY?.grabbing||(a.push(o),l.push(o.object),o.dragging=!0);if(0!==l.length&&(this._moveManipulation&&(this._moveManipulation.interactive=!1),r=E(l),p=U(l),this._emitRecordUndo(),this.events.emit("move-start",new q(l)),this.destroyed))return null}return 0!==l.length?o:null}).next(t=>r?.(t)).next(t=>(this._updateMoveTooltip(o,t),t)).next(t=>{switch(t.action){case"start":case"update":if(t.translationX||t.translationY||t.translationZ){const o=this.view.toScreen(t.mapStart),e=this.view.toScreen(t.mapEnd);if(!o||!e)return null;const i=e.x-o.x,n=e.y-o.y;if(this.events.emit("move",new L(i,n,l)),this.destroyed)return null}break;case"end":if(this.events.emit("move-stop",new J(l)),this.destroyed)return null;c()}return null}),cancel:n}}_connectTooltips(){let t;if(this.removeHandles(Q),this._shouldShowMovePointTooltip){const o=this.objects.at(0),{events:e}=this;this._movePointTooltipInfo??=new F({viewType:this.view.type,sketchOptions:this.sketchOptions});const i={onBeforeUpdate:()=>this.endDrag(),onMoveStart:()=>{this._emitRecordUndo(),e.emit("move-start",new q([o]))},onMove:()=>e.emit("move",new L(0,0,[o])),onMoveStop:()=>e.emit("move-stop",new J([o])),onRotateStart:()=>{},onRotate:()=>{},onRotateStop:()=>{},onScaleStart:()=>{},onScale:()=>{},onScaleStop:()=>{}};t=w(this.tooltip,o,()=>({sketchOptions:this.sketchOptions,activeTooltipInfo:this._movePointTooltipInfo,callbacks:i}))}else t=p(()=>this.sketchOptions.tooltips.effectiveEnabled?this._latestTooltipInfo:null,t=>{this.tooltip.info=t},h);this.addHandles(t,Q)}_showTooltip(t){this._shouldShowMovePointTooltip||this._updateMoveTooltip(t)}_hideTooltip(){this._shouldShowMovePointTooltip||(this.tooltip?.clear(),this._latestTooltipInfo=null)}_updateMoveTooltip(t,o){if(this._shouldShowMovePointTooltip)return;const{sketchOptions:e}=this;switch(t){case 0:this._latestTooltipInfo=this._translateTooltipInfo??=new G({sketchOptions:e}),this._updatingHandles.consumePromise(this._updateMoveTooltipDistanceDebounced(this._latestTooltipInfo,o,(t,o)=>this._measurementWorker.autoDistance2DBetweenPoints(tt(t),tt(o))));break;case 1:this._latestTooltipInfo=this._translateXYTooltipInfo??=new V({sketchOptions:e}),this._updatingHandles.consumePromise(this._updateMoveTooltipDistanceDebounced(this._latestTooltipInfo,o,async(t,e)=>l(await this._measurementWorker.autoDistance2DBetweenPoints(tt(t),tt(e)),x(o))));break;case 2:this._latestTooltipInfo=this._translateZTooltipInfo??=new W({sketchOptions:e}),this._updatingHandles.consumePromise(this._updateMoveTooltipDistanceDebounced(this._latestTooltipInfo,o,B))}this._latestTooltipInfo.sketchOptions=e}async _updateMoveTooltipDistanceAsync(t,o,e){if(null!=o&&"end"!==o.action){const{mapStart:i,mapEnd:n}=o,s=await e(i,n);t.distance=s??r}else t.distance=r}_emitRecordUndo(){const t=this.objects.toArray().map(t=>t.createUndoRecord?.()).filter(o);t.length>0&&this.events.emit("record-undo",{updates:t})}_buildSnappingPipelineSteps(t,o,e,i,n){const s=j(t);if(null==s||"point"!==s.type&&"mesh"!==s.type)return{steps:e,cancel:i};const a=("point"===s.type?s:s.origin).clone(),l=new X({elevationInfo:o,pointer:n,editGeometryOperations:R.fromGeometry(a,this.view.state.viewingMode),visualizer:new M,excludeFeature:t.graphic}),r=this.snappingManager,{snappingStep:p,cancelSnapping:c}=Y({snappingContext:l,snappingManager:r,updatingHandles:this._updatingHandles});return i=i.next(c),{steps:e=e.next(o=>{a.z=g(this.view,a,t.elevationInfo,{mode:"absolute-height",offset:0});return{...o,snapOrigin:l.coordinateHelper.pointToVector(a)}}).next(...p),cancel:i}}get test(){}};t([m({constructOnly:!0,nonNullable:!0})],$.prototype,"view",void 0),t([m()],$.prototype,"objects",void 0),t([m({constructOnly:!0,nonNullable:!0})],$.prototype,"enableZ",void 0),t([m({constructOnly:!0,type:z})],$.prototype,"sketchOptions",void 0),t([m({constructOnly:!0})],$.prototype,"snappingManager",void 0),t([m()],$.prototype,"type",void 0),t([m()],$.prototype,"updating",null),t([m()],$.prototype,"_latestTooltipInfo",void 0),t([m()],$.prototype,"_shouldShowMovePointTooltip",null),t([m()],$.prototype,"activeTooltipInfo",null),$=t([u("esri.views.3d.interactive.editingTools.move.MoveTool3D")],$);const tt=d(f);class ot{constructor(t){this.object=t,this.geometryRepresentation=null,this.manipulationXY=null,this.dragging=!1}}export{L as MoveEvent,q as MoveStartEvent,J as MoveStopEvent,$ as MoveTool3D};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{removeUnordered as i}from"../../../../../core/arrayUtils.js";import{EventEmitter as n}from"../../../../../core/Evented.js";import a from"../../../../../core/Handles.js";import{handlesGroup as o,makeHandle as s,destroyHandle as r}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as l,removeMaybe as p}from"../../../../../core/maybe.js";import{watch as d,initial as h,on as u,syncAndInitial as c,when as m,sync as g}from"../../../../../core/reactiveUtils.js";import{property as f,subclass as _}from"../../../../../core/accessorSupport/decorators.js";import{IDENTITY as v}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{length as M,subtract as b,lerp as x,set as y,add as O,scale as E}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as j,create as I}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as S}from"../../../../../core/support/UpdatingHandles.js";import H from"../../../../../geometry/Point.js";import w from"../../../../../geometry/Polyline.js";import V from"../../../../../geometry/SpatialReference.js";import{makeDehydratedPoint as D}from"../../../../../layers/graphics/dehydratedPoint.js";import{isVolumetricSymbol as T}from"../../../../../symbols/support/utils.js";import{Manipulator3D as G}from"../../Manipulator3D.js";import{createManipulatorMaterial as A,createManipulatorOutlineMaterial as P,placeAtObject as k}from"../../manipulatorUtils.js";import{RenderObject as C}from"../../RenderObject.js";import{SegmentLabels3D as U}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as L}from"../../SnappingVisualizer3D.js";import{screenToMapXYAtLocation as R,screenToRenderPlaneFromEvent as z,convertToMapCoordinates as F}from"../dragEventPipeline3D.js";import{orientation as Z}from"../geometryUtils.js";import{canMoveZOperations as B}from"../manipulatorUtils.js";import{Settings as W}from"../settings.js";import{createVisualElements as N}from"../visualElementUtils.js";import{discRadiusSmall as q}from"../manipulations/config.js";import{MoveManipulation as X}from"../manipulations/MoveManipulation.js";import{MoveXYObjectManipulation as Y}from"../manipulations/MoveXYObjectManipulation.js";import{getMapPointAtEdgeOffsetManipulatorElevation as K,createEdgeOffsetIntersectionPlane as J,createEdgeOffsetOperation as Q,edgeOffsetRotationMatrix as $,screenEdgeLengthSquared as ee,getDistanceInGeometrySR as te}from"./edgeOffsetUtils.js";import{createTooltipInfos as ie,connectTooltipToManipulatedObject as ne,getUpdatedTranslateObjectTooltipInfo as ae,getUpdatedEdgeOffsetTooltipInfo as oe}from"./reshapeTooltipUtils3D.js";import{OutlineVisualElement as se}from"../../visualElements/OutlineVisualElement.js";import{createElevationUpdateHandle as re}from"../../../support/elevationUpdateUtils.js";import{createExtrudedTriangle as le,createSphereGeometry as pe}from"../../../webgl-engine/lib/GeometryUtil.js";import{mouseButtons as de}from"../../../../input/mouseButtons.js";import{sceneSnappingAtLocation as he,addMapDelta as ue,createManipulatorDragEventPipeline as ce,dragAtLocation as me,addScreenDelta as ge}from"../../../../interactive/dragEventPipeline.js";import{tooltipKeys as fe}from"../../../../interactive/keybindings.js";import{SnappingContext as _e}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as ve}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as Me,enterInputModeIfAvailable as be}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{MeasurementWorkerHandle as xe}from"../../../../support/MeasurementWorkerHandle.js";const ye=Symbol(),Oe=Symbol();let Ee=class extends t{get _operations(){return this.object.operations}constructor(e){super(e),this._selectedIndex=0,this._manipulatorHandles=new a,this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0,this._reshapeEventState=0,this._pendingEdgeOffsetInfo=null,this._updatingHandles=new S,this._recreatingManipulators=!1,this._settings=new W({getTheme:()=>this.view.effectiveTheme}),this.events=new n,this.activeTooltipInfo=null,this._measurementWorker=new xe({preloadGeodetic:!0}),this._vertexLaserLineVisualElement=null,this._tooltipCallbacks={onBeforeReshape:()=>this.tool.endDrag(),onReshapeStart:()=>this._updateEventState(2),onReshape:()=>this.events.emit("reshape",{type:"reshape",object:this.object}),onReshapeStop:()=>this._updateEventState(0,{forceEnd:!0}),onMoveStart:()=>this._updateEventState(1),onMove:()=>this.events.emit("move",{type:"move",object:this.object,dx:0,dy:0}),onMoveStop:()=>this._updateEventState(0,{forceEnd:!0})}}initialize(){const{view:e}=this,t=this._settings.manipulators,i=t.vertex;this.tooltipInfos=ie(this._sketchOptions,e),this._vertexManipulatorMaterial=A(i.color.toUnitRGBA(),i.renderOccluded),this._vertexManipulatorOutlineMaterial=P(i.outlineColor.toUnitRGBA(),i.renderOccluded),this._vertexManipulatorHoverOutlineMaterial=P(i.hoverOutlineColor.toUnitRGBA(),i.renderOccluded);const n=t.edge;this._edgeManipulatorMaterial=A(n.color.toUnitRGBA(),n.renderOccluded),this._edgeManipulatorOutlineMaterial=P(n.outlineColor.toUnitRGBA(),n.renderOccluded);const a=t.edgeOffset;this._edgeOffsetManipulatorMaterial=A(a.color.toUnitRGBA(),a.renderOccluded,!1),this._edgeOffsetManipulatorHoverMaterial=A(a.hoverColor.toUnitRGBA(),a.renderOccluded,!1);const o=t.selected;this._selectedManipulatorMaterial=A(o.color.toUnitRGBA(),o.renderOccluded),this._selectedManipulatorOutlineMaterial=P(o.outlineColor.toUnitRGBA(),o.renderOccluded),this._selectedManipulatorHoverOutlineMaterial=P(o.hoverOutlineColor.toUnitRGBA(),o.renderOccluded),this.tooltip=Me(()=>({view:e,options:this._sketchOptions.tooltips})),this.addHandles([d(()=>{const e=this._settings.manipulators;return{vertexSettings:e.vertex,edgeSettings:e.edge,edgeOffsetSettings:e.edgeOffset,selectedSettings:e.selected}},({vertexSettings:e,edgeSettings:t,edgeOffsetSettings:i,selectedSettings:n})=>{e.applyColor(this._vertexManipulatorMaterial),e.applyOutline(this._vertexManipulatorOutlineMaterial),e.applyHoverOutline(this._vertexManipulatorHoverOutlineMaterial),t.applyColor(this._edgeManipulatorMaterial),t.applyOutline(this._edgeManipulatorOutlineMaterial),i.applyColor(this._edgeOffsetManipulatorMaterial),i.applyHover(this._edgeOffsetManipulatorHoverMaterial),n.applyColor(this._selectedManipulatorMaterial),n.applyOutline(this._selectedManipulatorOutlineMaterial),n.applyHoverOutline(this._selectedManipulatorHoverOutlineMaterial)}),d(()=>this.object.visible,e=>{for(const t of this._manipulatorInfos)t.manipulator.available=e,we(t)&&(t.edgeManipulator.available=e)}),d(()=>this._numGrabbing+this._numDragging===0,e=>this._toggleAutoHideManipulators(e)),d(()=>({labels:this._segmentLabels,enabled:this._sketchOptions.labels.enabled,edgeOffsetEnabled:this.enableEdgeOffset}),({labels:e,enabled:t,edgeOffsetEnabled:i})=>{null!=e&&(e.visible=t,e.edgeDistance=i?"far":"default")},h),ne(this.tooltip,this.object,()=>this._tooltipsContext,this._updatingHandles),d(()=>this.tooltip.mode,(e,t)=>{"input"===t&&"input"!==e&&this._resetTooltip()}),u(()=>this._operations,"vertex-update",e=>this._updateManipulatorPositions(e.vertices),{onListenerAdd:()=>this._recreateManipulators()}),u(()=>this._operations?.data,"change",e=>{"undo"!==e.operation&&"redo"!==e.operation||this._recreateManipulators()})])}destroy(){this._removeManipulators(),this._updatingHandles.destroy(),this._segmentLabels=l(this._segmentLabels),this.tooltip=l(this.tooltip),this._measurementWorker.destroy()}get updating(){return this._updatingHandles.updating||!!this._segmentLabels?.updating}get manipulators(){return this.tool.manipulators}get view(){return this.tool.view}get object(){return this.tool.object}get enableZShape(){return this.tool.enableZShape}get enableDeleteVertices(){return this.tool.enableDeleteVertices}get enableZVertex(){return this.tool.enableZVertex}get autoHideManipulators(){return this.tool.autoHideManipulators}get enableMoveObject(){return this.tool.enableMoveObject}get enableMidpoints(){return this.tool.enableMidpoints}get enableEdgeOffset(){return this.tool.enableEdgeOffset}get _sketchOptions(){return this.tool.sketchOptions}get _accentColor(){return this.view.effectiveTheme.accentColor}enterInputModeIfAvailable(e){return"key-down"===e.type&&e.key===fe.enterInputMode&&("reshape-edge-offset"===this.activeTooltipInfo?.type?this._enterInputModeDuringEdgeOffset(e):!!be(e,this.tooltip)&&(this.tool.endDrag(),!0))}removeSelectedVertices(){const e=this._manipulatorInfos.filter(e=>e.manipulator.selected&&"vertex"===e.type);return this._removeVertices(e),e.length}onManipulatorSelectionChanged(){this.events.emit("manipulators-changed")}_removeManipulators(){this._manipulatorHandles.removeAll(),this._moveManipulation=l(this._moveManipulation),this._objectMoveManipulation=l(this._objectMoveManipulation),this.manipulators.removeAll(),this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0}_createManipulators(e){if(null==this._operations)return;const t=this.object.elevationInfo;for(const{vertices:i,segments:n,index:a}of this._operations.data.parts){const o=e?.byPartIndex.get(a);for(const e of i){const i=o?.has(e.index);this._createVertexOrEdgeManipulator(e,t,i)}for(const e of n)"line"===e.type&&this._createVertexOrEdgeManipulator(e,t)}this._createObjectMoveManipulation(),this._createMoveManipulation(t),this._createVisualElements()}recordUndo(e){this._operations?.recordUndo(e,!0)}get canRedo(){return this._operations?.canRedo??!1}get canUndo(){return this._operations?.canUndo??!1}redo(){return this._operations?.redo()}undo(){return this.events.emit("undo"),this._operations?.undo()}_recreateManipulators(){if(!this._recreatingManipulators){if(this._recreatingManipulators=!0,this._removeManipulators(),this._resetTooltip(),this._operations&&this._segmentLabels?.context?.editGeometryOperations===this._operations||(this._segmentLabels=l(this._segmentLabels)),this._createManipulators(),!this._segmentLabels&&this._operations){const e=this._sketchOptions.labels;this._segmentLabels=new U({context:{view:this.view,editGeometryOperations:this._operations,elevationInfo:this.object.elevationInfo,labelOptions:e},visible:e.enabled})}this._recreatingManipulators=!1}}_perObjectManipulatorDragAction(e,t){if("end"===t.action)return t;let i=0;const n=[],a=this._manipulatorInfos.some(e=>"vertex"===e.type&&e.manipulator.selected),o=1===e&&a;for(const s of this._manipulatorInfos)"vertex"===s.type&&(s.manipulator.grabbing||o&&!s.manipulator.selected||n.push(s),i++);this._moveVertices(n,t);if(n.length===i){if(this._updateEventState(1),this.destroyed)return t;this.events.emit("move",{type:"move",dx:t.screenDeltaX,dy:t.screenDeltaY,object:this.object})}else{if(this._updateEventState(2),this.destroyed)return t;this.events.emit("reshape",{type:"reshape",object:this.object})}return t}_toggleAutoHideManipulators(e){this.autoHideManipulators&&(e?this.removeHandles(ye):this.tool.manipulators.forEach(({manipulator:e})=>{const t=e.disableDisplay?.();t&&this.addHandles(t,ye)}))}_isMultiVertexSelection(){return this._manipulatorInfos.reduce((e,t)=>"vertex"===t.type&&t.manipulator.selected?e+1:e,0)>1}_perVertexManipulatorDragAction(e){if(this._updateEventState(2),this.destroyed)return;const{mapDeltaX:t,mapDeltaY:i,mapDeltaZ:n}=e;if(!t&&!i&&!n)return;const a=[];for(const o of this._manipulatorInfos)"vertex"===o.type&&(o.manipulator.selected&&!o.manipulator.grabbing||o===e.info)&&a.push(o);this._moveVertices(a,e,1),this.events.emit("reshape",{type:"reshape",object:this.object})}_updateEventState(e,t={}){if(e===this._reshapeEventState)return!1;switch(e){case 0:if(!t.forceEnd&&(0!==this._numGrabbing||0!==this._numDragging))return!1;switch(this._reshapeEventState){case 1:this.events.emit("move",{type:"move-stop",dx:0,dy:0,object:this.object});break;case 2:this.events.emit("reshape",{type:"reshape-stop",object:this.object})}break;case 1:switch(this._reshapeEventState){case 0:this.events.emit("move",{type:"move-start",dx:0,dy:0,object:this.object});break;case 2:this.events.emit("reshape",{type:"reshape-stop",object:this.object}),this.destroyed||this.events.emit("move",{type:"move-start",dx:0,dy:0,object:this.object})}break;case 2:switch(this._reshapeEventState){case 0:this.events.emit("reshape",{type:"reshape-start",object:this.object});break;case 1:this.events.emit("move",{type:"move-stop",dx:0,dy:0,object:this.object}),this.destroyed||this.events.emit("reshape",{type:"reshape-start",object:this.object})}}if(this.destroyed)return!1;const i=this._reshapeEventState!==e;return this._reshapeEventState=e,i}_createObjectMoveManipulation(){const{tool:e,view:t,object:i,_operations:n}=this;if(n){if(this._objectMoveManipulation=new Y({tool:e,view:t,object:i}),this.enableMoveObject){let e=null;this._manipulatorHandles.add(this._objectMoveManipulation.createDragPipeline((t,i,a)=>{i.next(e=>this._trackNumDragging(e)).next(t=>("start"===t.action&&(e=n.createUndoGroup()),t)).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(t=>{"end"===t.action&&(this._resetTooltip(),e=p(e))}),a.next(()=>this._onDragCancel(!0,()=>e=p(e)))})),this._objectMoveManipulation.forEachManipulator(e=>this._manipulatorHandles.add(this._watchAndUpdateGrabState(e,!1)))}else this._objectMoveManipulation.forEachManipulator(e=>{e.grabbable=!1,e.cursor=null});this._objectMoveManipulation.forEachManipulator(e=>this._manipulatorHandles.add(e.events.on("immediate-click",e=>{this._manipulatorInfos.some(e=>e.manipulator.selected)?this._clearSelection():this.events.emit("immediate-click",{...e,object:this.object}),e.stopPropagation()})))}}_createMoveManipulation(e){const{object:t,tool:i,view:n,_operations:a}=this;if(!a)return;this._moveManipulation=new X({tool:i,view:n,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZShape&&B(t.operations,t.elevationInfo),snapToScene:!1,radius:X.radiusForSymbol(t.graphic?.symbol)}),this._moveManipulation.forEachManipulator(e=>this.addHandles([e.events.on("immediate-click",t=>{this._moveManipulation.zManipulation.hasManipulator(e)||this._manipulatorInfos.some(e=>e.manipulator.selected)||this.events.emit("immediate-click",{...t,object:this.object}),t.stopPropagation()}),this._watchAndUpdateGrabState(e,!1)]));const o=e=>t=>{this.addHandles([t.events.on("focus-changed",({action:t})=>{"focus"===t?this._updateTranslateTooltip(e):this._resetTooltip()})])};this._moveManipulation.xyManipulation.forEachManipulator(o(0)),this._moveManipulation.xyAxisManipulation.forEachManipulator(o(1)),this._moveManipulation.zManipulation.forEachManipulator(o(2)),this._moveManipulation.elevationInfo={mode:"absolute-height",offset:0};const s=a.data.spatialReference;this.addHandles([this._moveManipulation.createDragPipeline((n,o,s,r,l)=>{const{snappingStep:p,cancelSnapping:d}=ve({predicate:e=>!!e.info,snappingManager:i.snappingManager,snappingContext:new _e({editGeometryOperations:a,elevationInfo:e,pointer:l,excludeFeature:t.graphic,visualizer:new L}),updatingHandles:this._updatingHandles,useZ:!1});return r=r.next(e=>(this._onDragCancel(),e)).next(d),{steps:s=s.next(e=>this._trackNumDragging(e)).next(e=>{const t=this._manipulatorInfos.filter(e=>"vertex"===e.type&&e.manipulator.selected);return 1===e.manipulatorType&&1===t.length?{...e,info:t[0],snapOrigin:t[0].handle.pos}:e}).next(he(this.view,e,t.graphic??void 0)).next(...p).next(ue()).next(e=>this._perObjectManipulatorDragAction(1,e)).next(e=>(this._updateTranslateTooltip(n,e),e)),cancel:r}},e,s,t.graphic),d(()=>t.visible,()=>this._updateMoveManipulationPosition(),h),t.on("committed",()=>{this._recreatingManipulators||this._updateMoveManipulationPosition()}),d(()=>t.isDraped,e=>{this._updateMoveManipulationPosition(),this.removeHandles(Oe),e&&this.addHandles(re({view:this.view,geometry:t.graphic?.geometry,elevationInfo:t.elevationInfo,onElevationChanges:()=>this._updateMoveManipulationPosition()}),Oe)},h)])}_createVisualElements(){const{object:e,view:t}=this,i=N({view:t,object:e,forEachManipulator:e=>{if(!this.destroyed&&!this._recreatingManipulators){this._objectMoveManipulation.forEachManipulator(e),this._moveManipulation.forEachManipulator(e);for(const t of this._manipulatorInfos)e(t.manipulator,1)}},onManipulatorsChanged:e=>this.events.on("manipulators-changed",e)});null!=i&&(this._outlineVisualElement=i.visualElement instanceof se?i.visualElement:null);const n=this._outlineVisualElement;if(null!=n){const t=()=>{e.isDraped||this._updateMoveManipulationPosition()};this._manipulatorHandles.add(u(()=>n.events,"attachment-origin-changed",t,{onListenerAdd:t}))}this._manipulatorHandles.add(i)}_createEdgeOffsetManipulator(e,t=this.object.elevationInfo){const i=this.view,n=this._operations;if(e.part.vertices.length<=2||!n)return null;const a=n.data.spatialReference,s=this._settings.manipulators.edgeOffset,r=s.size/2,l=r+s.collisionPadding,p=r/l,d=p/2,h=p*Math.sqrt(3)/2,{height:u,offset:c}=s,m=this._edgeOffsetManipulatorMaterial;if(!this._edgeOffsetManipulatorGeometryInside){const e=le(m,h,d,d,u,c);this._edgeOffsetManipulatorGeometryInside=e}if(!this._edgeOffsetManipulatorGeometryOutside){const e=le(m,-h,d,d,u,-c);this._edgeOffsetManipulatorGeometryOutside=e}const g=[new C(this._edgeOffsetManipulatorGeometryInside.instantiate(),1),new C(this._edgeOffsetManipulatorGeometryInside.instantiate({material:this._edgeOffsetManipulatorHoverMaterial}),2),new C(this._edgeOffsetManipulatorGeometryOutside.instantiate(),1),new C(this._edgeOffsetManipulatorGeometryOutside.instantiate({material:this._edgeOffsetManipulatorHoverMaterial}),2)],f=new G({view:i,renderObjects:g,elevationInfo:"on-the-ground"!==t.mode||T(this.object.graphic?.symbol)?{mode:"absolute-height",offset:0}:t,worldOriented:!1,focusMultiplier:1,radius:l,available:this.object.visible,collisionType:{type:"disc",direction:j(0,0,1)},collisionPriority:1,metadata:{deleting:!1},location:He(a)}),_=new G({view:i,worldSized:!0,worldOriented:!1,available:this.object.visible,collisionPriority:-10,cursor:this.enableMoveObject?"move":"default",metadata:{deleting:!1},location:He(a)}),v={manipulator:f,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0,edgeManipulator:_,visibilityHandle:null};this._autoHideEdgeOffsetManipulator(v,s.minSquaredEdgeLength);const M=()=>this._updateEdgeOffsetManipulator(v);M(),v.locationUpdateHandle=o([e.leftVertex,e.rightVertex].map(e=>{const t=this._getManipulatorInfoFromHandle(e);return t?.manipulator.events.on("location-update",M)}));const b=e=>{this._manipulatorInfos.some(e=>e.manipulator.selected)?this._clearSelection():this.events.emit("immediate-click",{...e,object:this.object}),e.stopPropagation()};return this._manipulatorHandles.add([v.locationUpdateHandle,this._watchAndUpdateGrabState(f,!0),this._watchAndUpdateGrabState(_,!0),ce(f,this._createEdgeOffsetPipeline(v,t,n)),ce(_,this._createEdgePipeline(v,t,n)),_.events.on("immediate-click",b),f.events.on("immediate-click",b),f.events.on("focus-changed",()=>this._resetTooltip()),f.events.on("grab-changed",({screenPoint:e,action:t})=>{v.grabMapPoint="start"===t?K(e,this.view,this.object,v):null})],f),this._manipulatorInfos.push(v),this.manipulators.addMany([f,_]),this.events.emit("manipulators-changed"),v}_autoHideEdgeOffsetManipulator(e,t){const i=e.manipulator,n=e.edgeManipulator,a=()=>{e.visibilityHandle=p(e.visibilityHandle);const a=this._getManipulatorInfoFromHandle(e.handle.leftVertex),r=this._getManipulatorInfoFromHandle(e.handle.rightVertex),l=null!=a&&null!=r&&ee(a.manipulator.renderLocation,r.manipulator.renderLocation,this.view.state.camera)<t;(!i.focused&&!n.focused||l)&&(i.grabbable=!l,n.grabbable=!l,e.visibilityHandle=o([i.disableDisplay(),s(()=>{i.grabbable=!0,n.grabbable=this.enableMoveObject})]))};this._manipulatorHandles.add([i.events.on("focus-changed",a),n.events.on("focus-changed",a),s(()=>{p(e.visibilityHandle),n.metadata.deleting=!0,this.manipulators.remove(n)})],i),a()}_updateEdgeOffsetManipulator(e){if(!this._operations)return;this._updateManipulatorPosition(e);const{coordinateHelper:t}=this._operations.data,i=J(this.view,e.manipulator.elevationAlignedLocation,Q(t,e.handle,e.manipulator.elevationInfo)),n=this._getManipulatorInfoFromHandle(e.handle.leftVertex),a=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(null==n||null==a)return;const o=n.manipulator.renderLocation,s=a.manipulator.renderLocation,r=null!=i?$(i,o,s):v;e.manipulator.modelTransform=r,e.edgeManipulator.elevationAlignedLocation=e.manipulator.elevationAlignedLocation,e.edgeManipulator.modelTransform=r;const l=M(b(De,o,s))/2;e.edgeManipulator.collisionType={type:"line",paths:[[[-l,0,0],[l,0,0]]]}}_createEdgePipeline(e,t,i){return(n,a,o,s)=>{if("touch"===s){this._createEdgeOffsetPipeline(e,t,i)(n,a,o)}else if(this.enableMoveObject){const e=this.object.graphic,s=i.data.spatialReference,{elevationAlignedLocation:r}=n;a.next(e=>this._trackNumDragging(e)).next(me(this.view,r)).next(R(this.view,r,t,s,e)).next(ge()).next(ue()).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(e=>{"end"===e.action&&this._resetTooltip()}),o.next(()=>this._onDragCancel(!n.metadata.deleting))}}}_createEdgeOffsetPipeline(e,t,i){return(n,a,o)=>{const s=this._pendingEdgeOffsetInfo;if(s?.manipulatorInfo===e&&"drag"!==s.mode)return void o.execute({action:"cancel"});this._clearSelection();const{initializeStep:r,cleanup:l}=this._initializeEdgeOffset(e,t,i,o),p=this._applyEdgeOffsetStep(e);a.next(e=>this._trackNumDragging(e)).next(me(this.view,n.elevationAlignedLocation)).next(r).next(z(this.view)).next(F(this.view,i.data.spatialReference)).next(ue()).next(je()).next(e=>this._pendingEdgeOffsetInfo?e:p(e)).next(e=>{"end"!==e.action||this._pendingEdgeOffsetInfo||l()}),o.next(()=>{this._exitEdgeOffsetInputMode(),n.metadata.deleting||(l(),this._onDragCancel())})}}_initializeEdgeOffset(e,t,i,n){const{view:a,object:s}=this,r=Q(i.data.coordinateHelper,e.handle,t),l=i.createUndoGroup(),d=J(a,e.manipulator.elevationAlignedLocation,r);let h;this._splitEdgesBeforeEdgeOffset(e,r),this._selectEdgeOffsetArrow(e,r);const u=()=>{this._cleanEdgeOffsetCollapsedEdges(e,i),h=p(h)},c=this.events.on("undo",u);return h=o([this._initializeEdgeOffsetVisualElement(e,s,t,i),l,c,this._connectEdgeOffsetTooltip(e,r,i,()=>{n.execute({action:"cancel"})})]),{initializeStep:e=>null==r||null==d?(u(),null):{...e,operation:r,plane:d},cleanup:u}}_initializeEdgeOffsetVisualElement(e,t,i,n){const a=()=>new w({paths:[[e.handle.leftVertex.pos,e.handle.rightVertex.pos]],spatialReference:n.data.spatialReference}),s=new se({view:this.view,isDraped:t.isDraped,geometry:a(),elevationInfo:i,width:this._settings.visualElements.lineObjects.outline.width,attached:!1,isDecoration:!0}),l=o([d(()=>({color:this._accentColor,draped:t.isDraped}),({color:e,draped:t})=>{s.color=e.toUnitRGBA(),s.isDraped=t},c),t.on("committed",()=>{s.geometry=a()}),r(s)]);return s.attached=!0,l}_applyEdgeOffsetStep(e){return t=>(this.destroyed||null==t.operation||!this._operations||(this._updateEventState(2),null==t.signedDistance?this._resetTooltip():((t.mapDeltaX||t.mapDeltaY||t.mapDeltaZ)&&(this._offsetEdge(e,t.operation,t.signedDistance),this.events.emit("reshape",{type:"reshape",object:this.object})),this._updateEdgeOffsetTooltip(t))),t)}_cleanEdgeOffsetCollapsedEdges(e,t){const i=e.handle.leftVertex.leftSegment?.leftVertex,n=e.handle.leftVertex,a=e.handle.rightVertex.rightSegment?.rightVertex,o=e.handle.rightVertex,s=t.data.coordinateHelper,r=this.view.pixelSizeAt(s.vectorToDehydratedPoint(n.pos),s.spatialReference),l=[];if(i&&s.distance(i.pos,n.pos)<Te){const e=this._getManipulatorInfoFromHandle(n);null!=e&&l.push(e)}if(s.distance(n.pos,o.pos)<r||a&&s.distance(a.pos,o.pos)<Te){const e=this._getManipulatorInfoFromHandle(o);null!=e&&l.push(e)}l.length&&this._removeVertices(l)}_enterInputModeDuringEdgeOffset(e){const t=this._findActiveEdgeOffsetManipulatorInfo();return!!t&&(!!be(e,this.tooltip)&&(t.manipulator.dragging?(this._pendingEdgeOffsetInfo={manipulatorInfo:t,mode:"drag"},!0):(this._clearSelection(),this._pendingEdgeOffsetInfo={manipulatorInfo:t,mode:"hover"},this._connectEdgeOffsetTooltipOnHover(t),!0)))}_exitEdgeOffsetInputMode(){this.tooltip&&(this._pendingEdgeOffsetInfo=null,this._resetTooltip(),this.tooltip.exitInputMode())}_findActiveEdgeOffsetManipulatorInfo(){return this._manipulatorInfos.filter(we).find(({manipulator:e})=>e.hovering||e.grabbing||e.dragging)}_connectEdgeOffsetTooltipOnHover(e){const{_operations:t,object:i}=this;if(!t)return;const{elevationInfo:n}=i,a=Q(t.data.coordinateHelper,e.handle,n);this._selectEdgeOffsetArrow(e,a),this.addHandles([this._initializeEdgeOffsetVisualElement(e,i,n,t),this._connectEdgeOffsetTooltip(e,a,t,()=>{this.removeHandles(a),this._exitEdgeOffsetInputMode()})],a)}_splitEdgesBeforeEdgeOffset(e,t){if(t.requiresSplitEdgeLeft){const t=this._getManipulatorInfoFromHandle(e.handle.leftVertex.leftSegment);null!=t&&this._splitEdgeManipulator(t,1)}if(t.requiresSplitEdgeRight){const t=this._getManipulatorInfoFromHandle(e.handle.rightVertex.rightSegment);null!=t&&this._splitEdgeManipulator(t,0)}}_selectEdgeOffsetArrow(e,t){const i=e.grabMapPoint??K(this.view.inputManager?.latestPointerInfo?.location,this.view,this.object,e);i&&t.selectArrowFromStartPoint(i)}_connectEdgeOffsetTooltip(e,t,i,n){const a=()=>this.tooltipInfos.edgeOffset.distance.actual,s=a=>{n(),queueMicrotask(()=>{this.view.focus();const n=i.createUndoGroup();this._tooltipCallbacks.onReshapeStart?.(),this._splitEdgesBeforeEdgeOffset(e,t),this._offsetEdge(e,t,te(a,e.manipulator.location,t,i)),this._tooltipCallbacks.onReshape?.(),this._tooltipCallbacks.onReshapeStop?.(),this._cleanEdgeOffsetCollapsedEdges(e,i),n.remove()})},r=()=>{const e=a();null!=e?s(e):n()};return o([m(()=>this.tooltip&&!this.tooltip.focused,()=>r(),g),this.tooltip.on("discard",n),this.tooltip.on("commit",e=>{"commit-and-exit"===e.type&&r()})])}_createVertexOrEdgeManipulator(e,t=this.object.elevationInfo,i=!1){const n=this.view,a=this._operations,s=this._settings;if(!a)return null;const r=a.data.type,l=a.data.spatialReference;if("line"===e.type){if(this.enableEdgeOffset)return this._createEdgeOffsetManipulator(e,t);if(!this.enableMidpoints)return null}if(null==this._vertexManipulatorGeometry||null==this._vertexManipulatorOutlineGeometry){const{size:e,outlineSize:t}=Ie(s.manipulators.vertex);this._vertexManipulatorGeometry=pe(this._vertexManipulatorMaterial,e,16,16),this._vertexManipulatorOutlineGeometry=pe(this._vertexManipulatorOutlineMaterial,t,16,16)}if(null==this._edgeManipulatorGeometry||null==this._edgeManipulatorOutlineGeometry){const{size:e,outlineSize:t}=Ie(s.manipulators.edge);this._edgeManipulatorGeometry=pe(this._edgeManipulatorMaterial,e,16,16),this._edgeManipulatorOutlineGeometry=pe(this._edgeManipulatorOutlineMaterial,t,16,16)}const d="point"===r||"mesh"===r?[]:[new C(this._vertexManipulatorGeometry.instantiate(),4|Ge),new C(this._vertexManipulatorOutlineGeometry.instantiate(),5|Ge),new C(this._vertexManipulatorOutlineGeometry.instantiate({material:this._vertexManipulatorHoverOutlineMaterial}),6|Ge),new C(this._vertexManipulatorGeometry.instantiate({material:this._selectedManipulatorMaterial}),8),new C(this._vertexManipulatorOutlineGeometry.instantiate({material:this._selectedManipulatorOutlineMaterial}),9),new C(this._vertexManipulatorOutlineGeometry.instantiate({material:this._selectedManipulatorHoverOutlineMaterial}),10)];this.enableMidpoints&&d.push(new C(this._edgeManipulatorGeometry.instantiate({material:this._vertexManipulatorMaterial}),6|Ae),new C(this._edgeManipulatorOutlineGeometry.instantiate({material:this._vertexManipulatorHoverOutlineMaterial}),6|Ae),new C(this._edgeManipulatorGeometry.instantiate(),5|Ae),new C(this._edgeManipulatorOutlineGeometry.instantiate(),5|Ae));const h=new G({view:n,renderObjects:d,elevationInfo:t,focusMultiplier:1,touchMultiplier:1,available:this.object.visible,metadata:{deleting:!1},location:He(l)});h.selected=i,this._setTypeSpecificManipulatorSettings(h,e,t);const u="vertex"===e.type?{manipulator:h,handle:e,type:"vertex",selectedIndex:0}:{manipulator:h,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0};if(this._manipulatorInfos.push(u),this.manipulators.add(h),this._updateManipulatorPosition(u),"edge"===u.type){const e=[];for(const t of[u.handle.leftVertex,u.handle.rightVertex]){const i=this._getManipulatorInfoFromHandle(t);null!=i&&e.push(i.manipulator.events.on("location-update",()=>this._updateManipulatorPosition(u)))}u.locationUpdateHandle=o(e),this._manipulatorHandles.add(u.locationUpdateHandle,h)}this._manipulatorHandles.add(this._watchAndUpdateGrabState(h,!0),h);const c=ce(h,(e,i,o,s)=>{let r=null;const{snappingStep:d,cancelSnapping:h}=ve({predicate:()=>!this._isMultiVertexSelection(),snappingManager:this.tool.snappingManager,snappingContext:new _e({editGeometryOperations:a,elevationInfo:t,pointer:s,excludeFeature:this.object.graphic,visualizer:new L}),updatingHandles:this._updatingHandles,useZ:!1});o.next(t=>(this._onDragCancel(!e.metadata.deleting,()=>r=p(r)),t)).next(h);const{elevationAlignedLocation:c}=e,m=this.object.graphic??void 0;i.next(e=>this._trackNumDragging(e)).next(e=>{if("start"===e.action&&a&&(r=a.createUndoGroup()),"edge"===u.type){const t=this._splitEdgeManipulator(u);return{...e,info:t,snapOrigin:t.handle.pos}}return{...e,info:u,snapOrigin:u.handle.pos}}).next(me(n,c)).next(R(n,c,t,l,m)).next(he(n,t,m)).next(...d).next(ue()).next(e=>{this._perVertexManipulatorDragAction(e),"end"===e.action&&(r=p(r)),this._resetTooltip()})});return this._manipulatorHandles.add([c,h.events.on("immediate-click",e=>this._manipulatorClickCallback(e,u)),h.events.on("select-changed",()=>{u.selectedIndex=++this._selectedIndex,this._updateMoveManipulationPosition(),this._resetTooltip()}),h.events.on("focus-changed",()=>{this._resetTooltip()})],h),this.events.emit("manipulators-changed"),u}_trackNumDragging(e){switch(e.action){case"start":this._numDragging++;break;case"end":this._numDragging--}return e}_onDragCancel(e=!0,t){switch(this._numDragging--,e&&this.undo(),this.tool.snappingManager?.doneSnapping(),this._resetTooltip(),this._reshapeEventState){case 0:break;case 1:this.events.emit("move",{type:"move",dx:0,dy:0,object:this.object});break;case 2:this.events.emit("reshape",{type:"reshape",object:this.object})}t?.(),this.destroyed||this._updateEventState(0)}_setTypeSpecificManipulatorSettings(e,t,i){const n=this._settings;switch(t.type){case"vertex":{e.state=Ge,e.selectable=!0,e.cursor="move",e.collisionPriority=2;const{size:t,collisionPadding:a}=n.manipulators.vertex;e.radius=t/2+a,e.elevationInfo=i;const o=this._operations?.data.type;e.interactive=null!=o&&"point"!==o&&"mesh"!==o;break}case"line":{e.state=Ae,e.selectable=!1,e.cursor="copy",e.collisionPriority=-1;const{size:t,collisionPadding:a}=n.manipulators.edge;e.radius=t/2+a,e.elevationInfo="on-the-ground"!==i.mode||T(this.object.graphic?.symbol)?{mode:"absolute-height",offset:0}:i;break}}}_watchAndUpdateGrabState(e,t){return e.events.on("grab-changed",i=>{this._onGrabStateChanged(e,t,i.action,i.pointerType)})}_onGrabStateChanged(e,t,i,n="mouse"){if(!this._recreatingManipulators){if("start"===i)t&&this._updateSelection(e),this._numGrabbing++;else if(this._numGrabbing--,this._updateEventState(0),this.destroyed)return;this._moveManipulation.interactive=!this._numGrabbing,("touch"!==n||this.enableEdgeOffset)&&(this._manipulatorInfos.forEach(e=>{const{manipulator:t}=e,i=this._operations?.data.type;t.interactive=t.grabbing||!this._numGrabbing&&null!=i&&"point"!==i&&"mesh"!==i,we(e)&&(e.edgeManipulator.interactive=e.edgeManipulator.grabbing||!this._numGrabbing)}),this._objectMoveManipulation.forEachManipulator(e=>{e.interactive=e.grabbing||!this._numGrabbing}))}}_clearSelection(){for(const e of this._manipulatorInfos)e.manipulator.grabbing||(e.manipulator.selected=!1);this._pendingEdgeOffsetInfo=null}_updateSelection(e){e.grabbing&&!e.selected&&e.selectable&&(this._clearSelection(),e.selected=!0,this.events.emit("manipulators-changed"))}_removeManipulator(e){null!=e&&(e.manipulator.metadata.deleting=!0,this.manipulators.remove(e.manipulator),this._manipulatorHandles.remove(e.manipulator),i(this._manipulatorInfos,e),this.events.emit("manipulators-changed"),this._resetTooltip())}_getManipulatorInfoFromHandle(e){return this._manipulatorInfos.find(t=>t.handle===e)}_updateManipulatorPositions(e){for(const t of e)this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(t))}_updateManipulatorPosition(e){const t=this._operations;if(null!=e&&t)if("vertex"===e.type)e.manipulator.location=t.data.coordinateHelper.vectorToDehydratedPoint(e.handle.pos,Ve),e.manipulator.grabbing&&null!=this._vertexLaserLineVisualElement&&(this._vertexLaserLineVisualElement.visualElement.intersectsWorldUpAtLocation=e.manipulator.renderLocation);else if("edge"===e.type){const i=this._getManipulatorInfoFromHandle(e.handle.leftVertex),n=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(null==i||null==n)return;const a=i.manipulator,o=n.manipulator;if("on-the-ground"===e.manipulator.elevationInfo?.mode){const i=a.location,n=o.location,s=.5,r=i.x+s*(n.x-i.x),l=i.y+s*(n.y-i.y),p=i.hasZ&&n.hasZ?0:void 0;e.manipulator.location=D(r,l,p,t.data.spatialReference)}else x(De,a.renderLocation,o.renderLocation,.5),e.manipulator.renderLocation=De}}_splitEdgeManipulator(e,t=.5){const i=this._operations,n=i.splitSegment(e.handle,t).createdVertex;e.locationUpdateHandle=p(e.locationUpdateHandle);const a=this.object.elevationInfo;let o;this.enableEdgeOffset?(this._removeManipulator(e),o=this._createVertexOrEdgeManipulator(n)):(o=e,o.handle=n,o.type="vertex",this._setTypeSpecificManipulatorSettings(e.manipulator,e.handle,a)),"line"===n.leftSegment?.type&&this._createVertexOrEdgeManipulator(n.leftSegment),"line"===n.rightSegment?.type&&this._createVertexOrEdgeManipulator(n.rightSegment),this._updateManipulatorPosition(o),this.enableEdgeOffset||this._resetTooltip(),this._updateSelection(e.manipulator);const s=this._updateEventState(2),r=i.data.coordinateHelper.vectorToArray(o.handle.pos),l=i.data.parts.indexOf(n.part);return this.events.emit("vertex-add",{type:"vertex-add",object:this.object,vertices:[{coordinates:r,componentIndex:l,vertexIndex:n.index}],added:r}),s&&this._updateEventState(0),o}_updateMoveManipulationPosition(){const e=y(De,0,0,0);let t=0,i=!1,n=null,a=null;for(const r of this._manipulatorInfos)"vertex"===r.type&&(r.manipulator.selected?(t++,O(e,e,r.manipulator.renderLocation),null==n||r.selectedIndex>n.selectedIndex?(a=n,n=r):(null==a||r.selectedIndex>a.selectedIndex)&&(a=r)):i=!0);const o=this.object,s=this._operations?.data.geometry;if(0===t){const e=o.visible&&this.enableMoveObject;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e,this._moveManipulation.zManipulation.available=e&&this.enableZShape&&B(this._operations,o.elevationInfo),this._moveManipulation.angle=Z(s),this._moveManipulation.radius=X.radiusForSymbol(o.graphic?.symbol)}else{const e=o.visible;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.zManipulation.available=e&&this.enableZVertex&&B(this._operations,this.object.elevationInfo),this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e&&1!==t;let i=0;if(null!=n){const e=n.handle.pos,t=null!=a?a.handle.pos:n.handle.leftSegment?.leftVertex?n.handle.leftSegment.leftVertex.pos:null,o=null==a&&n.handle.rightSegment?.rightVertex?n.handle.rightSegment.rightVertex.pos:null;t&&o?this._moveManipulation.xyAxisManipulation.available=!1:t?i=Se(t,e):o&&(i=Se(e,o))}this._moveManipulation.angle=i,this._moveManipulation.radius=q}0!==t&&i?(E(e,e,1/t),Ve.spatialReference=this._operations.data.spatialReference,Ve.hasZ=!0,this.view.renderCoordsHelper.fromRenderCoords(e,Ve),this._moveManipulation.elevationAlignedLocation=Ve):null==this._outlineVisualElement||this.object.isDraped||null==this._outlineVisualElement.attachmentOrigin?k(this._moveManipulation,this.object):this._moveManipulation.elevationAlignedLocation=this._outlineVisualElement.attachmentOrigin}_removeVertices(e){const t=new Array,i=this._operations;if(i){for(const n of e){const e=n.handle.part;if("vertex"===n.type&&i.canRemoveVertex(e)){t.push(n.handle),this._removeManipulator(n),this._removeManipulator(this._getManipulatorInfoFromHandle(n.handle.leftSegment)),this._removeManipulator(this._getManipulatorInfoFromHandle(n.handle.rightSegment));const a=i.removeVertices([n.handle]),o=a.removedVertices?.[0].createdSegment;o&&"line"===o.type?this._createVertexOrEdgeManipulator(o):this.enableEdgeOffset&&e.vertices.length<=2&&this._removeManipulator(this._getManipulatorInfoFromHandle(e.segments[0]))}}if(t.length>0){const e=t.map(e=>{const t=i.data.parts.indexOf(e.part);return{coordinates:i.data.coordinateHelper.vectorToArray(e.pos),componentIndex:t,vertexIndex:e.index}}),n=this._updateEventState(2);if(this.destroyed)return;if(this.events.emit("vertex-remove",{type:"vertex-remove",object:this.object,removed:e.map(e=>e.coordinates),vertices:e}),this.destroyed)return;if(n&&(this._updateEventState(0),this.destroyed))return;this._updateMoveManipulationPosition()}}}_moveVertices(e,t,i=("start"===t.action?0:1)){const n=this._operations;if(n){e.length>0&&n.moveVertices(e.map(e=>e.handle),t.mapDeltaX,t.mapDeltaY,t.mapDeltaZ,i);for(const t of e)this._updateManipulatorPosition(t)}}_offsetEdge(e,t,i){if(!this._operations)return;const n=t.clone();n.distance=i,this._operations.updateVertices([e.handle.leftVertex,e.handle.rightVertex],n),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.leftVertex)),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.rightVertex))}_manipulatorClickCallback(e,t){e.shiftKey||this._clearSelection(),"vertex"===t.type&&(t.manipulator.selected=!t.manipulator.selected,this.enableDeleteVertices&&e.button===de.Right&&this._removeVertices([t])),"edge"===t.type&&e.button===de.Left&&this._splitEdgeManipulator(t),e.stopPropagation()}_updateTranslateTooltip(e,t){null!=this._defaultTooltipInfo?this._resetTooltip():this._updateTranslateObjectTooltip(e,t)}_updateTranslateObjectTooltip(e,t){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=ae(e,t,this._tooltipsContext,this._updatingHandles))}_updateEdgeOffsetTooltip(e){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=oe(this.object,e,this._tooltipsContext,this._updatingHandles))}_resetTooltip(){const e=this.activeTooltipInfo;if(this._pendingEdgeOffsetInfo&&"reshape-edge-offset"===e?.type)return;let t=null;t=this._pendingEdgeOffsetInfo||null!=this._findActiveEdgeOffsetManipulatorInfo()?oe(this.object,null,this._tooltipsContext,this._updatingHandles):this._defaultTooltipInfo,t!==e&&(null!=e&&null!=t&&"input"===this.tooltip.mode||(this.activeTooltipInfo=t))}get _defaultTooltipInfo(){const e=this._operations?.data.type;switch(e){case"polyline":case"polygon":return this._selectedVertexManipulatorInfo?this.tooltipInfos.selectedVertex:null;case"point":case"mesh":return this.tooltipInfos.movePoint;default:return null}}get _selectedVertexManipulatorInfo(){const e=this._manipulatorInfos.filter(e=>"vertex"===e.type&&e.manipulator.selected);return 1===e.length?e[0]:null}get _tooltipsContext(){const{tooltipInfos:e,activeTooltipInfo:t}=this;return{sketchOptions:this._sketchOptions,tooltipInfos:e,activeTooltipInfo:t,selectedVertexManipulatorInfo:this._selectedVertexManipulatorInfo,callbacks:this._tooltipCallbacks,measurementWorker:this._measurementWorker}}get test(){}};function je(){return e=>{const{operation:t,mapEnd:i}=e;return null==t||null==i?e:{...e,signedDistance:t.signedDistanceToPoint(i)}}}function Ie(e){const t=e.size/2,i=t+e.collisionPadding;return{size:t/i,outlineSize:(t+e.outlineSize)/i}}function Se(e,t){return Math.atan2(t[1]-e[1],t[0]-e[0])+Math.PI/2}function He(e){return new H({x:0,y:0,z:0,spatialReference:e})}function we(e){return"edge"===e.type&&"edgeManipulator"in e}e([f()],Ee.prototype,"_numGrabbing",void 0),e([f()],Ee.prototype,"_numDragging",void 0),e([f()],Ee.prototype,"_pendingEdgeOffsetInfo",void 0),e([f()],Ee.prototype,"_operations",null),e([f()],Ee.prototype,"_segmentLabels",void 0),e([f({constructOnly:!0})],Ee.prototype,"tool",void 0),e([f()],Ee.prototype,"tooltip",void 0),e([f()],Ee.prototype,"activeTooltipInfo",void 0),e([f({readOnly:!0})],Ee.prototype,"updating",null),e([f()],Ee.prototype,"manipulators",null),e([f()],Ee.prototype,"view",null),e([f()],Ee.prototype,"object",null),e([f()],Ee.prototype,"enableZShape",null),e([f()],Ee.prototype,"enableDeleteVertices",null),e([f()],Ee.prototype,"enableZVertex",null),e([f()],Ee.prototype,"autoHideManipulators",null),e([f()],Ee.prototype,"enableMoveObject",null),e([f()],Ee.prototype,"enableMidpoints",null),e([f()],Ee.prototype,"enableEdgeOffset",null),e([f()],Ee.prototype,"_sketchOptions",null),e([f()],Ee.prototype,"_accentColor",null),e([f()],Ee.prototype,"_tooltipsContext",null),Ee=e([_("esri.views.3d.interactive.editingTools.reshape.ReshapeOperation")],Ee);const Ve=D(0,0,void 0,V.WGS84),De=I(),Te=1e-6,Ge=16,Ae=32;export{Ee as ReshapeOperation};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{removeUnordered as i}from"../../../../../core/arrayUtils.js";import{EventEmitter as n}from"../../../../../core/Evented.js";import a from"../../../../../core/Handles.js";import{handlesGroup as o,makeHandle as s,destroyHandle as r}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as l,removeMaybe as p}from"../../../../../core/maybe.js";import{watch as d,initial as h,on as u,syncAndInitial as c,when as m,sync as g}from"../../../../../core/reactiveUtils.js";import{property as f,subclass as _}from"../../../../../core/accessorSupport/decorators.js";import{IDENTITY as v}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{length as M,subtract as b,lerp as x,set as y,add as O,scale as E}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as j,create as I}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as S}from"../../../../../core/support/UpdatingHandles.js";import H from"../../../../../geometry/Point.js";import w from"../../../../../geometry/Polyline.js";import V from"../../../../../geometry/SpatialReference.js";import{makeDehydratedPoint as D}from"../../../../../layers/graphics/dehydratedPoint.js";import{isVolumetricSymbol as T}from"../../../../../symbols/support/utils.js";import{Manipulator3D as G}from"../../Manipulator3D.js";import{createManipulatorMaterial as A,createManipulatorOutlineMaterial as P,placeAtObject as k}from"../../manipulatorUtils.js";import{RenderObject as C}from"../../RenderObject.js";import{SegmentLabels3D as U}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as L}from"../../SnappingVisualizer3D.js";import{screenToMapXYAtLocation as R,screenToRenderPlaneFromEvent as z,convertToMapCoordinates as F}from"../dragEventPipeline3D.js";import{orientation as Z}from"../geometryUtils.js";import{canMoveZOperations as B}from"../manipulatorUtils.js";import{Settings as W}from"../settings.js";import{createVisualElements as N}from"../visualElementUtils.js";import{discRadiusSmall as q}from"../manipulations/config.js";import{MoveManipulation as X}from"../manipulations/MoveManipulation.js";import{MoveXYObjectManipulation as Y}from"../manipulations/MoveXYObjectManipulation.js";import{getMapPointAtEdgeOffsetManipulatorElevation as K,createEdgeOffsetIntersectionPlane as J,createEdgeOffsetOperation as Q,edgeOffsetRotationMatrix as $,screenEdgeLengthSquared as ee,getDistanceInGeometrySR as te}from"./edgeOffsetUtils.js";import{createTooltipInfos as ie,connectTooltipToManipulatedObject as ne,getUpdatedTranslateObjectTooltipInfo as ae,getUpdatedEdgeOffsetTooltipInfo as oe}from"./reshapeTooltipUtils3D.js";import{OutlineVisualElement as se}from"../../visualElements/OutlineVisualElement.js";import{createElevationUpdateHandle as re}from"../../../support/elevationUpdateUtils.js";import{createExtrudedTriangle as le,createSphereGeometry as pe}from"../../../webgl-engine/lib/GeometryUtil.js";import{mouseButtons as de}from"../../../../input/mouseButtons.js";import{sceneSnappingAtLocation as he,addMapDelta as ue,createManipulatorDragEventPipeline as ce,dragAtLocation as me,addScreenDelta as ge}from"../../../../interactive/dragEventPipeline.js";import{tooltipKeys as fe}from"../../../../interactive/keybindings.js";import{SnappingContext as _e}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as ve}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as Me,enterInputModeIfAvailable as be}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{GeometryWorkerHandle as xe}from"../../../../support/GeometryWorkerHandle.js";const ye=Symbol(),Oe=Symbol();let Ee=class extends t{get _operations(){return this.object.operations}constructor(e){super(e),this._selectedIndex=0,this._manipulatorHandles=new a,this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0,this._reshapeEventState=0,this._pendingEdgeOffsetInfo=null,this._updatingHandles=new S,this._recreatingManipulators=!1,this._settings=new W({getTheme:()=>this.view.effectiveTheme}),this.events=new n,this.activeTooltipInfo=null,this._measurementWorker=new xe({preloadGeodetic:!0}),this._vertexLaserLineVisualElement=null,this._tooltipCallbacks={onBeforeReshape:()=>this.tool.endDrag(),onReshapeStart:()=>this._updateEventState(2),onReshape:()=>this.events.emit("reshape",{type:"reshape",object:this.object}),onReshapeStop:()=>this._updateEventState(0,{forceEnd:!0}),onMoveStart:()=>this._updateEventState(1),onMove:()=>this.events.emit("move",{type:"move",object:this.object,dx:0,dy:0}),onMoveStop:()=>this._updateEventState(0,{forceEnd:!0})}}initialize(){const{view:e}=this,t=this._settings.manipulators,i=t.vertex;this.tooltipInfos=ie(this._sketchOptions,e),this._vertexManipulatorMaterial=A(i.color.toUnitRGBA(),i.renderOccluded),this._vertexManipulatorOutlineMaterial=P(i.outlineColor.toUnitRGBA(),i.renderOccluded),this._vertexManipulatorHoverOutlineMaterial=P(i.hoverOutlineColor.toUnitRGBA(),i.renderOccluded);const n=t.edge;this._edgeManipulatorMaterial=A(n.color.toUnitRGBA(),n.renderOccluded),this._edgeManipulatorOutlineMaterial=P(n.outlineColor.toUnitRGBA(),n.renderOccluded);const a=t.edgeOffset;this._edgeOffsetManipulatorMaterial=A(a.color.toUnitRGBA(),a.renderOccluded,!1),this._edgeOffsetManipulatorHoverMaterial=A(a.hoverColor.toUnitRGBA(),a.renderOccluded,!1);const o=t.selected;this._selectedManipulatorMaterial=A(o.color.toUnitRGBA(),o.renderOccluded),this._selectedManipulatorOutlineMaterial=P(o.outlineColor.toUnitRGBA(),o.renderOccluded),this._selectedManipulatorHoverOutlineMaterial=P(o.hoverOutlineColor.toUnitRGBA(),o.renderOccluded),this.tooltip=Me(()=>({view:e,options:this._sketchOptions.tooltips})),this.addHandles([d(()=>{const e=this._settings.manipulators;return{vertexSettings:e.vertex,edgeSettings:e.edge,edgeOffsetSettings:e.edgeOffset,selectedSettings:e.selected}},({vertexSettings:e,edgeSettings:t,edgeOffsetSettings:i,selectedSettings:n})=>{e.applyColor(this._vertexManipulatorMaterial),e.applyOutline(this._vertexManipulatorOutlineMaterial),e.applyHoverOutline(this._vertexManipulatorHoverOutlineMaterial),t.applyColor(this._edgeManipulatorMaterial),t.applyOutline(this._edgeManipulatorOutlineMaterial),i.applyColor(this._edgeOffsetManipulatorMaterial),i.applyHover(this._edgeOffsetManipulatorHoverMaterial),n.applyColor(this._selectedManipulatorMaterial),n.applyOutline(this._selectedManipulatorOutlineMaterial),n.applyHoverOutline(this._selectedManipulatorHoverOutlineMaterial)}),d(()=>this.object.visible,e=>{for(const t of this._manipulatorInfos)t.manipulator.available=e,we(t)&&(t.edgeManipulator.available=e)}),d(()=>this._numGrabbing+this._numDragging===0,e=>this._toggleAutoHideManipulators(e)),d(()=>({labels:this._segmentLabels,enabled:this._sketchOptions.labels.enabled,edgeOffsetEnabled:this.enableEdgeOffset}),({labels:e,enabled:t,edgeOffsetEnabled:i})=>{null!=e&&(e.visible=t,e.edgeDistance=i?"far":"default")},h),ne(this.tooltip,this.object,()=>this._tooltipsContext,this._updatingHandles),d(()=>this.tooltip.mode,(e,t)=>{"input"===t&&"input"!==e&&this._resetTooltip()}),u(()=>this._operations,"vertex-update",e=>this._updateManipulatorPositions(e.vertices),{onListenerAdd:()=>this._recreateManipulators()}),u(()=>this._operations?.data,"change",e=>{"undo"!==e.operation&&"redo"!==e.operation||this._recreateManipulators()})])}destroy(){this._removeManipulators(),this._updatingHandles.destroy(),this._segmentLabels=l(this._segmentLabels),this.tooltip=l(this.tooltip),this._measurementWorker.destroy()}get updating(){return this._updatingHandles.updating||!!this._segmentLabels?.updating}get manipulators(){return this.tool.manipulators}get view(){return this.tool.view}get object(){return this.tool.object}get enableZShape(){return this.tool.enableZShape}get enableDeleteVertices(){return this.tool.enableDeleteVertices}get enableZVertex(){return this.tool.enableZVertex}get autoHideManipulators(){return this.tool.autoHideManipulators}get enableMoveObject(){return this.tool.enableMoveObject}get enableMidpoints(){return this.tool.enableMidpoints}get enableEdgeOffset(){return this.tool.enableEdgeOffset}get _sketchOptions(){return this.tool.sketchOptions}get _accentColor(){return this.view.effectiveTheme.accentColor}enterInputModeIfAvailable(e){return"key-down"===e.type&&e.key===fe.enterInputMode&&("reshape-edge-offset"===this.activeTooltipInfo?.type?this._enterInputModeDuringEdgeOffset(e):!!be(e,this.tooltip)&&(this.tool.endDrag(),!0))}removeSelectedVertices(){const e=this._manipulatorInfos.filter(e=>e.manipulator.selected&&"vertex"===e.type);return this._removeVertices(e),e.length}onManipulatorSelectionChanged(){this.events.emit("manipulators-changed")}_removeManipulators(){this._manipulatorHandles.removeAll(),this._moveManipulation=l(this._moveManipulation),this._objectMoveManipulation=l(this._objectMoveManipulation),this.manipulators.removeAll(),this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0}_createManipulators(e){if(null==this._operations)return;const t=this.object.elevationInfo;for(const{vertices:i,segments:n,index:a}of this._operations.data.parts){const o=e?.byPartIndex.get(a);for(const e of i){const i=o?.has(e.index);this._createVertexOrEdgeManipulator(e,t,i)}for(const e of n)"line"===e.type&&this._createVertexOrEdgeManipulator(e,t)}this._createObjectMoveManipulation(),this._createMoveManipulation(t),this._createVisualElements()}recordUndo(e){this._operations?.recordUndo(e,!0)}get canRedo(){return this._operations?.canRedo??!1}get canUndo(){return this._operations?.canUndo??!1}redo(){return this._operations?.redo()}undo(){return this.events.emit("undo"),this._operations?.undo()}_recreateManipulators(){if(!this._recreatingManipulators){if(this._recreatingManipulators=!0,this._removeManipulators(),this._resetTooltip(),this._operations&&this._segmentLabels?.context?.editGeometryOperations===this._operations||(this._segmentLabels=l(this._segmentLabels)),this._createManipulators(),!this._segmentLabels&&this._operations){const e=this._sketchOptions.labels;this._segmentLabels=new U({context:{view:this.view,editGeometryOperations:this._operations,elevationInfo:this.object.elevationInfo,labelOptions:e},visible:e.enabled})}this._recreatingManipulators=!1}}_perObjectManipulatorDragAction(e,t){if("end"===t.action)return t;let i=0;const n=[],a=this._manipulatorInfos.some(e=>"vertex"===e.type&&e.manipulator.selected),o=1===e&&a;for(const s of this._manipulatorInfos)"vertex"===s.type&&(s.manipulator.grabbing||o&&!s.manipulator.selected||n.push(s),i++);this._moveVertices(n,t);if(n.length===i){if(this._updateEventState(1),this.destroyed)return t;this.events.emit("move",{type:"move",dx:t.screenDeltaX,dy:t.screenDeltaY,object:this.object})}else{if(this._updateEventState(2),this.destroyed)return t;this.events.emit("reshape",{type:"reshape",object:this.object})}return t}_toggleAutoHideManipulators(e){this.autoHideManipulators&&(e?this.removeHandles(ye):this.tool.manipulators.forEach(({manipulator:e})=>{const t=e.disableDisplay?.();t&&this.addHandles(t,ye)}))}_isMultiVertexSelection(){return this._manipulatorInfos.reduce((e,t)=>"vertex"===t.type&&t.manipulator.selected?e+1:e,0)>1}_perVertexManipulatorDragAction(e){if(this._updateEventState(2),this.destroyed)return;const{mapDeltaX:t,mapDeltaY:i,mapDeltaZ:n}=e;if(!t&&!i&&!n)return;const a=[];for(const o of this._manipulatorInfos)"vertex"===o.type&&(o.manipulator.selected&&!o.manipulator.grabbing||o===e.info)&&a.push(o);this._moveVertices(a,e,1),this.events.emit("reshape",{type:"reshape",object:this.object})}_updateEventState(e,t={}){if(e===this._reshapeEventState)return!1;switch(e){case 0:if(!t.forceEnd&&(0!==this._numGrabbing||0!==this._numDragging))return!1;switch(this._reshapeEventState){case 1:this.events.emit("move",{type:"move-stop",dx:0,dy:0,object:this.object});break;case 2:this.events.emit("reshape",{type:"reshape-stop",object:this.object})}break;case 1:switch(this._reshapeEventState){case 0:this.events.emit("move",{type:"move-start",dx:0,dy:0,object:this.object});break;case 2:this.events.emit("reshape",{type:"reshape-stop",object:this.object}),this.destroyed||this.events.emit("move",{type:"move-start",dx:0,dy:0,object:this.object})}break;case 2:switch(this._reshapeEventState){case 0:this.events.emit("reshape",{type:"reshape-start",object:this.object});break;case 1:this.events.emit("move",{type:"move-stop",dx:0,dy:0,object:this.object}),this.destroyed||this.events.emit("reshape",{type:"reshape-start",object:this.object})}}if(this.destroyed)return!1;const i=this._reshapeEventState!==e;return this._reshapeEventState=e,i}_createObjectMoveManipulation(){const{tool:e,view:t,object:i,_operations:n}=this;if(n){if(this._objectMoveManipulation=new Y({tool:e,view:t,object:i}),this.enableMoveObject){let e=null;this._manipulatorHandles.add(this._objectMoveManipulation.createDragPipeline((t,i,a)=>{i.next(e=>this._trackNumDragging(e)).next(t=>("start"===t.action&&(e=n.createUndoGroup()),t)).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(t=>{"end"===t.action&&(this._resetTooltip(),e=p(e))}),a.next(()=>this._onDragCancel(!0,()=>e=p(e)))})),this._objectMoveManipulation.forEachManipulator(e=>this._manipulatorHandles.add(this._watchAndUpdateGrabState(e,!1)))}else this._objectMoveManipulation.forEachManipulator(e=>{e.grabbable=!1,e.cursor=null});this._objectMoveManipulation.forEachManipulator(e=>this._manipulatorHandles.add(e.events.on("immediate-click",e=>{this._manipulatorInfos.some(e=>e.manipulator.selected)?this._clearSelection():this.events.emit("immediate-click",{...e,object:this.object}),e.stopPropagation()})))}}_createMoveManipulation(e){const{object:t,tool:i,view:n,_operations:a}=this;if(!a)return;this._moveManipulation=new X({tool:i,view:n,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZShape&&B(t.operations,t.elevationInfo),snapToScene:!1,radius:X.radiusForSymbol(t.graphic?.symbol)}),this._moveManipulation.forEachManipulator(e=>this.addHandles([e.events.on("immediate-click",t=>{this._moveManipulation.zManipulation.hasManipulator(e)||this._manipulatorInfos.some(e=>e.manipulator.selected)||this.events.emit("immediate-click",{...t,object:this.object}),t.stopPropagation()}),this._watchAndUpdateGrabState(e,!1)]));const o=e=>t=>{this.addHandles([t.events.on("focus-changed",({action:t})=>{"focus"===t?this._updateTranslateTooltip(e):this._resetTooltip()})])};this._moveManipulation.xyManipulation.forEachManipulator(o(0)),this._moveManipulation.xyAxisManipulation.forEachManipulator(o(1)),this._moveManipulation.zManipulation.forEachManipulator(o(2)),this._moveManipulation.elevationInfo={mode:"absolute-height",offset:0};const s=a.data.spatialReference;this.addHandles([this._moveManipulation.createDragPipeline((n,o,s,r,l)=>{const{snappingStep:p,cancelSnapping:d}=ve({predicate:e=>!!e.info,snappingManager:i.snappingManager,snappingContext:new _e({editGeometryOperations:a,elevationInfo:e,pointer:l,excludeFeature:t.graphic,visualizer:new L}),updatingHandles:this._updatingHandles,useZ:!1});return r=r.next(e=>(this._onDragCancel(),e)).next(d),{steps:s=s.next(e=>this._trackNumDragging(e)).next(e=>{const t=this._manipulatorInfos.filter(e=>"vertex"===e.type&&e.manipulator.selected);return 1===e.manipulatorType&&1===t.length?{...e,info:t[0],snapOrigin:t[0].handle.pos}:e}).next(he(this.view,e,t.graphic??void 0)).next(...p).next(ue()).next(e=>this._perObjectManipulatorDragAction(1,e)).next(e=>(this._updateTranslateTooltip(n,e),e)),cancel:r}},e,s,t.graphic),d(()=>t.visible,()=>this._updateMoveManipulationPosition(),h),t.on("committed",()=>{this._recreatingManipulators||this._updateMoveManipulationPosition()}),d(()=>t.isDraped,e=>{this._updateMoveManipulationPosition(),this.removeHandles(Oe),e&&this.addHandles(re({view:this.view,geometry:t.graphic?.geometry,elevationInfo:t.elevationInfo,onElevationChanges:()=>this._updateMoveManipulationPosition()}),Oe)},h)])}_createVisualElements(){const{object:e,view:t}=this,i=N({view:t,object:e,forEachManipulator:e=>{if(!this.destroyed&&!this._recreatingManipulators){this._objectMoveManipulation.forEachManipulator(e),this._moveManipulation.forEachManipulator(e);for(const t of this._manipulatorInfos)e(t.manipulator,1)}},onManipulatorsChanged:e=>this.events.on("manipulators-changed",e)});null!=i&&(this._outlineVisualElement=i.visualElement instanceof se?i.visualElement:null);const n=this._outlineVisualElement;if(null!=n){const t=()=>{e.isDraped||this._updateMoveManipulationPosition()};this._manipulatorHandles.add(u(()=>n.events,"attachment-origin-changed",t,{onListenerAdd:t}))}this._manipulatorHandles.add(i)}_createEdgeOffsetManipulator(e,t=this.object.elevationInfo){const i=this.view,n=this._operations;if(e.part.vertices.length<=2||!n)return null;const a=n.data.spatialReference,s=this._settings.manipulators.edgeOffset,r=s.size/2,l=r+s.collisionPadding,p=r/l,d=p/2,h=p*Math.sqrt(3)/2,{height:u,offset:c}=s,m=this._edgeOffsetManipulatorMaterial;if(!this._edgeOffsetManipulatorGeometryInside){const e=le(m,h,d,d,u,c);this._edgeOffsetManipulatorGeometryInside=e}if(!this._edgeOffsetManipulatorGeometryOutside){const e=le(m,-h,d,d,u,-c);this._edgeOffsetManipulatorGeometryOutside=e}const g=[new C(this._edgeOffsetManipulatorGeometryInside.instantiate(),1),new C(this._edgeOffsetManipulatorGeometryInside.instantiate({material:this._edgeOffsetManipulatorHoverMaterial}),2),new C(this._edgeOffsetManipulatorGeometryOutside.instantiate(),1),new C(this._edgeOffsetManipulatorGeometryOutside.instantiate({material:this._edgeOffsetManipulatorHoverMaterial}),2)],f=new G({view:i,renderObjects:g,elevationInfo:"on-the-ground"!==t.mode||T(this.object.graphic?.symbol)?{mode:"absolute-height",offset:0}:t,worldOriented:!1,focusMultiplier:1,radius:l,available:this.object.visible,collisionType:{type:"disc",direction:j(0,0,1)},collisionPriority:1,metadata:{deleting:!1},location:He(a)}),_=new G({view:i,worldSized:!0,worldOriented:!1,available:this.object.visible,collisionPriority:-10,cursor:this.enableMoveObject?"move":"default",metadata:{deleting:!1},location:He(a)}),v={manipulator:f,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0,edgeManipulator:_,visibilityHandle:null};this._autoHideEdgeOffsetManipulator(v,s.minSquaredEdgeLength);const M=()=>this._updateEdgeOffsetManipulator(v);M(),v.locationUpdateHandle=o([e.leftVertex,e.rightVertex].map(e=>{const t=this._getManipulatorInfoFromHandle(e);return t?.manipulator.events.on("location-update",M)}));const b=e=>{this._manipulatorInfos.some(e=>e.manipulator.selected)?this._clearSelection():this.events.emit("immediate-click",{...e,object:this.object}),e.stopPropagation()};return this._manipulatorHandles.add([v.locationUpdateHandle,this._watchAndUpdateGrabState(f,!0),this._watchAndUpdateGrabState(_,!0),ce(f,this._createEdgeOffsetPipeline(v,t,n)),ce(_,this._createEdgePipeline(v,t,n)),_.events.on("immediate-click",b),f.events.on("immediate-click",b),f.events.on("focus-changed",()=>this._resetTooltip()),f.events.on("grab-changed",({screenPoint:e,action:t})=>{v.grabMapPoint="start"===t?K(e,this.view,this.object,v):null})],f),this._manipulatorInfos.push(v),this.manipulators.addMany([f,_]),this.events.emit("manipulators-changed"),v}_autoHideEdgeOffsetManipulator(e,t){const i=e.manipulator,n=e.edgeManipulator,a=()=>{e.visibilityHandle=p(e.visibilityHandle);const a=this._getManipulatorInfoFromHandle(e.handle.leftVertex),r=this._getManipulatorInfoFromHandle(e.handle.rightVertex),l=null!=a&&null!=r&&ee(a.manipulator.renderLocation,r.manipulator.renderLocation,this.view.state.camera)<t;(!i.focused&&!n.focused||l)&&(i.grabbable=!l,n.grabbable=!l,e.visibilityHandle=o([i.disableDisplay(),s(()=>{i.grabbable=!0,n.grabbable=this.enableMoveObject})]))};this._manipulatorHandles.add([i.events.on("focus-changed",a),n.events.on("focus-changed",a),s(()=>{p(e.visibilityHandle),n.metadata.deleting=!0,this.manipulators.remove(n)})],i),a()}_updateEdgeOffsetManipulator(e){if(!this._operations)return;this._updateManipulatorPosition(e);const{coordinateHelper:t}=this._operations.data,i=J(this.view,e.manipulator.elevationAlignedLocation,Q(t,e.handle,e.manipulator.elevationInfo)),n=this._getManipulatorInfoFromHandle(e.handle.leftVertex),a=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(null==n||null==a)return;const o=n.manipulator.renderLocation,s=a.manipulator.renderLocation,r=null!=i?$(i,o,s):v;e.manipulator.modelTransform=r,e.edgeManipulator.elevationAlignedLocation=e.manipulator.elevationAlignedLocation,e.edgeManipulator.modelTransform=r;const l=M(b(De,o,s))/2;e.edgeManipulator.collisionType={type:"line",paths:[[[-l,0,0],[l,0,0]]]}}_createEdgePipeline(e,t,i){return(n,a,o,s)=>{if("touch"===s){this._createEdgeOffsetPipeline(e,t,i)(n,a,o)}else if(this.enableMoveObject){const e=this.object.graphic,s=i.data.spatialReference,{elevationAlignedLocation:r}=n;a.next(e=>this._trackNumDragging(e)).next(me(this.view,r)).next(R(this.view,r,t,s,e)).next(ge()).next(ue()).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(e=>{"end"===e.action&&this._resetTooltip()}),o.next(()=>this._onDragCancel(!n.metadata.deleting))}}}_createEdgeOffsetPipeline(e,t,i){return(n,a,o)=>{const s=this._pendingEdgeOffsetInfo;if(s?.manipulatorInfo===e&&"drag"!==s.mode)return void o.execute({action:"cancel"});this._clearSelection();const{initializeStep:r,cleanup:l}=this._initializeEdgeOffset(e,t,i,o),p=this._applyEdgeOffsetStep(e);a.next(e=>this._trackNumDragging(e)).next(me(this.view,n.elevationAlignedLocation)).next(r).next(z(this.view)).next(F(this.view,i.data.spatialReference)).next(ue()).next(je()).next(e=>this._pendingEdgeOffsetInfo?e:p(e)).next(e=>{"end"!==e.action||this._pendingEdgeOffsetInfo||l()}),o.next(()=>{this._exitEdgeOffsetInputMode(),n.metadata.deleting||(l(),this._onDragCancel())})}}_initializeEdgeOffset(e,t,i,n){const{view:a,object:s}=this,r=Q(i.data.coordinateHelper,e.handle,t),l=i.createUndoGroup(),d=J(a,e.manipulator.elevationAlignedLocation,r);let h;this._splitEdgesBeforeEdgeOffset(e,r),this._selectEdgeOffsetArrow(e,r);const u=()=>{this._cleanEdgeOffsetCollapsedEdges(e,i),h=p(h)},c=this.events.on("undo",u);return h=o([this._initializeEdgeOffsetVisualElement(e,s,t,i),l,c,this._connectEdgeOffsetTooltip(e,r,i,()=>{n.execute({action:"cancel"})})]),{initializeStep:e=>null==r||null==d?(u(),null):{...e,operation:r,plane:d},cleanup:u}}_initializeEdgeOffsetVisualElement(e,t,i,n){const a=()=>new w({paths:[[e.handle.leftVertex.pos,e.handle.rightVertex.pos]],spatialReference:n.data.spatialReference}),s=new se({view:this.view,isDraped:t.isDraped,geometry:a(),elevationInfo:i,width:this._settings.visualElements.lineObjects.outline.width,attached:!1,isDecoration:!0}),l=o([d(()=>({color:this._accentColor,draped:t.isDraped}),({color:e,draped:t})=>{s.color=e.toUnitRGBA(),s.isDraped=t},c),t.on("committed",()=>{s.geometry=a()}),r(s)]);return s.attached=!0,l}_applyEdgeOffsetStep(e){return t=>(this.destroyed||null==t.operation||!this._operations||(this._updateEventState(2),null==t.signedDistance?this._resetTooltip():((t.mapDeltaX||t.mapDeltaY||t.mapDeltaZ)&&(this._offsetEdge(e,t.operation,t.signedDistance),this.events.emit("reshape",{type:"reshape",object:this.object})),this._updateEdgeOffsetTooltip(t))),t)}_cleanEdgeOffsetCollapsedEdges(e,t){const i=e.handle.leftVertex.leftSegment?.leftVertex,n=e.handle.leftVertex,a=e.handle.rightVertex.rightSegment?.rightVertex,o=e.handle.rightVertex,s=t.data.coordinateHelper,r=this.view.pixelSizeAt(s.vectorToDehydratedPoint(n.pos),s.spatialReference),l=[];if(i&&s.distance(i.pos,n.pos)<Te){const e=this._getManipulatorInfoFromHandle(n);null!=e&&l.push(e)}if(s.distance(n.pos,o.pos)<r||a&&s.distance(a.pos,o.pos)<Te){const e=this._getManipulatorInfoFromHandle(o);null!=e&&l.push(e)}l.length&&this._removeVertices(l)}_enterInputModeDuringEdgeOffset(e){const t=this._findActiveEdgeOffsetManipulatorInfo();return!!t&&(!!be(e,this.tooltip)&&(t.manipulator.dragging?(this._pendingEdgeOffsetInfo={manipulatorInfo:t,mode:"drag"},!0):(this._clearSelection(),this._pendingEdgeOffsetInfo={manipulatorInfo:t,mode:"hover"},this._connectEdgeOffsetTooltipOnHover(t),!0)))}_exitEdgeOffsetInputMode(){this.tooltip&&(this._pendingEdgeOffsetInfo=null,this._resetTooltip(),this.tooltip.exitInputMode())}_findActiveEdgeOffsetManipulatorInfo(){return this._manipulatorInfos.filter(we).find(({manipulator:e})=>e.hovering||e.grabbing||e.dragging)}_connectEdgeOffsetTooltipOnHover(e){const{_operations:t,object:i}=this;if(!t)return;const{elevationInfo:n}=i,a=Q(t.data.coordinateHelper,e.handle,n);this._selectEdgeOffsetArrow(e,a),this.addHandles([this._initializeEdgeOffsetVisualElement(e,i,n,t),this._connectEdgeOffsetTooltip(e,a,t,()=>{this.removeHandles(a),this._exitEdgeOffsetInputMode()})],a)}_splitEdgesBeforeEdgeOffset(e,t){if(t.requiresSplitEdgeLeft){const t=this._getManipulatorInfoFromHandle(e.handle.leftVertex.leftSegment);null!=t&&this._splitEdgeManipulator(t,1)}if(t.requiresSplitEdgeRight){const t=this._getManipulatorInfoFromHandle(e.handle.rightVertex.rightSegment);null!=t&&this._splitEdgeManipulator(t,0)}}_selectEdgeOffsetArrow(e,t){const i=e.grabMapPoint??K(this.view.inputManager?.latestPointerInfo?.location,this.view,this.object,e);i&&t.selectArrowFromStartPoint(i)}_connectEdgeOffsetTooltip(e,t,i,n){const a=()=>this.tooltipInfos.edgeOffset.distance.actual,s=a=>{n(),queueMicrotask(()=>{this.view.focus();const n=i.createUndoGroup();this._tooltipCallbacks.onReshapeStart?.(),this._splitEdgesBeforeEdgeOffset(e,t),this._offsetEdge(e,t,te(a,e.manipulator.location,t,i)),this._tooltipCallbacks.onReshape?.(),this._tooltipCallbacks.onReshapeStop?.(),this._cleanEdgeOffsetCollapsedEdges(e,i),n.remove()})},r=()=>{const e=a();null!=e?s(e):n()};return o([m(()=>this.tooltip&&!this.tooltip.focused,()=>r(),g),this.tooltip.on("discard",n),this.tooltip.on("commit",e=>{"commit-and-exit"===e.type&&r()})])}_createVertexOrEdgeManipulator(e,t=this.object.elevationInfo,i=!1){const n=this.view,a=this._operations,s=this._settings;if(!a)return null;const r=a.data.type,l=a.data.spatialReference;if("line"===e.type){if(this.enableEdgeOffset)return this._createEdgeOffsetManipulator(e,t);if(!this.enableMidpoints)return null}if(null==this._vertexManipulatorGeometry||null==this._vertexManipulatorOutlineGeometry){const{size:e,outlineSize:t}=Ie(s.manipulators.vertex);this._vertexManipulatorGeometry=pe(this._vertexManipulatorMaterial,e,16,16),this._vertexManipulatorOutlineGeometry=pe(this._vertexManipulatorOutlineMaterial,t,16,16)}if(null==this._edgeManipulatorGeometry||null==this._edgeManipulatorOutlineGeometry){const{size:e,outlineSize:t}=Ie(s.manipulators.edge);this._edgeManipulatorGeometry=pe(this._edgeManipulatorMaterial,e,16,16),this._edgeManipulatorOutlineGeometry=pe(this._edgeManipulatorOutlineMaterial,t,16,16)}const d="point"===r||"mesh"===r?[]:[new C(this._vertexManipulatorGeometry.instantiate(),4|Ge),new C(this._vertexManipulatorOutlineGeometry.instantiate(),5|Ge),new C(this._vertexManipulatorOutlineGeometry.instantiate({material:this._vertexManipulatorHoverOutlineMaterial}),6|Ge),new C(this._vertexManipulatorGeometry.instantiate({material:this._selectedManipulatorMaterial}),8),new C(this._vertexManipulatorOutlineGeometry.instantiate({material:this._selectedManipulatorOutlineMaterial}),9),new C(this._vertexManipulatorOutlineGeometry.instantiate({material:this._selectedManipulatorHoverOutlineMaterial}),10)];this.enableMidpoints&&d.push(new C(this._edgeManipulatorGeometry.instantiate({material:this._vertexManipulatorMaterial}),6|Ae),new C(this._edgeManipulatorOutlineGeometry.instantiate({material:this._vertexManipulatorHoverOutlineMaterial}),6|Ae),new C(this._edgeManipulatorGeometry.instantiate(),5|Ae),new C(this._edgeManipulatorOutlineGeometry.instantiate(),5|Ae));const h=new G({view:n,renderObjects:d,elevationInfo:t,focusMultiplier:1,touchMultiplier:1,available:this.object.visible,metadata:{deleting:!1},location:He(l)});h.selected=i,this._setTypeSpecificManipulatorSettings(h,e,t);const u="vertex"===e.type?{manipulator:h,handle:e,type:"vertex",selectedIndex:0}:{manipulator:h,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0};if(this._manipulatorInfos.push(u),this.manipulators.add(h),this._updateManipulatorPosition(u),"edge"===u.type){const e=[];for(const t of[u.handle.leftVertex,u.handle.rightVertex]){const i=this._getManipulatorInfoFromHandle(t);null!=i&&e.push(i.manipulator.events.on("location-update",()=>this._updateManipulatorPosition(u)))}u.locationUpdateHandle=o(e),this._manipulatorHandles.add(u.locationUpdateHandle,h)}this._manipulatorHandles.add(this._watchAndUpdateGrabState(h,!0),h);const c=ce(h,(e,i,o,s)=>{let r=null;const{snappingStep:d,cancelSnapping:h}=ve({predicate:()=>!this._isMultiVertexSelection(),snappingManager:this.tool.snappingManager,snappingContext:new _e({editGeometryOperations:a,elevationInfo:t,pointer:s,excludeFeature:this.object.graphic,visualizer:new L}),updatingHandles:this._updatingHandles,useZ:!1});o.next(t=>(this._onDragCancel(!e.metadata.deleting,()=>r=p(r)),t)).next(h);const{elevationAlignedLocation:c}=e,m=this.object.graphic??void 0;i.next(e=>this._trackNumDragging(e)).next(e=>{if("start"===e.action&&a&&(r=a.createUndoGroup()),"edge"===u.type){const t=this._splitEdgeManipulator(u);return{...e,info:t,snapOrigin:t.handle.pos}}return{...e,info:u,snapOrigin:u.handle.pos}}).next(me(n,c)).next(R(n,c,t,l,m)).next(he(n,t,m)).next(...d).next(ue()).next(e=>{this._perVertexManipulatorDragAction(e),"end"===e.action&&(r=p(r)),this._resetTooltip()})});return this._manipulatorHandles.add([c,h.events.on("immediate-click",e=>this._manipulatorClickCallback(e,u)),h.events.on("select-changed",()=>{u.selectedIndex=++this._selectedIndex,this._updateMoveManipulationPosition(),this._resetTooltip()}),h.events.on("focus-changed",()=>{this._resetTooltip()})],h),this.events.emit("manipulators-changed"),u}_trackNumDragging(e){switch(e.action){case"start":this._numDragging++;break;case"end":this._numDragging--}return e}_onDragCancel(e=!0,t){switch(this._numDragging--,e&&this.undo(),this.tool.snappingManager?.doneSnapping(),this._resetTooltip(),this._reshapeEventState){case 0:break;case 1:this.events.emit("move",{type:"move",dx:0,dy:0,object:this.object});break;case 2:this.events.emit("reshape",{type:"reshape",object:this.object})}t?.(),this.destroyed||this._updateEventState(0)}_setTypeSpecificManipulatorSettings(e,t,i){const n=this._settings;switch(t.type){case"vertex":{e.state=Ge,e.selectable=!0,e.cursor="move",e.collisionPriority=2;const{size:t,collisionPadding:a}=n.manipulators.vertex;e.radius=t/2+a,e.elevationInfo=i;const o=this._operations?.data.type;e.interactive=null!=o&&"point"!==o&&"mesh"!==o;break}case"line":{e.state=Ae,e.selectable=!1,e.cursor="copy",e.collisionPriority=-1;const{size:t,collisionPadding:a}=n.manipulators.edge;e.radius=t/2+a,e.elevationInfo="on-the-ground"!==i.mode||T(this.object.graphic?.symbol)?{mode:"absolute-height",offset:0}:i;break}}}_watchAndUpdateGrabState(e,t){return e.events.on("grab-changed",i=>{this._onGrabStateChanged(e,t,i.action,i.pointerType)})}_onGrabStateChanged(e,t,i,n="mouse"){if(!this._recreatingManipulators){if("start"===i)t&&this._updateSelection(e),this._numGrabbing++;else if(this._numGrabbing--,this._updateEventState(0),this.destroyed)return;this._moveManipulation.interactive=!this._numGrabbing,("touch"!==n||this.enableEdgeOffset)&&(this._manipulatorInfos.forEach(e=>{const{manipulator:t}=e,i=this._operations?.data.type;t.interactive=t.grabbing||!this._numGrabbing&&null!=i&&"point"!==i&&"mesh"!==i,we(e)&&(e.edgeManipulator.interactive=e.edgeManipulator.grabbing||!this._numGrabbing)}),this._objectMoveManipulation.forEachManipulator(e=>{e.interactive=e.grabbing||!this._numGrabbing}))}}_clearSelection(){for(const e of this._manipulatorInfos)e.manipulator.grabbing||(e.manipulator.selected=!1);this._pendingEdgeOffsetInfo=null}_updateSelection(e){e.grabbing&&!e.selected&&e.selectable&&(this._clearSelection(),e.selected=!0,this.events.emit("manipulators-changed"))}_removeManipulator(e){null!=e&&(e.manipulator.metadata.deleting=!0,this.manipulators.remove(e.manipulator),this._manipulatorHandles.remove(e.manipulator),i(this._manipulatorInfos,e),this.events.emit("manipulators-changed"),this._resetTooltip())}_getManipulatorInfoFromHandle(e){return this._manipulatorInfos.find(t=>t.handle===e)}_updateManipulatorPositions(e){for(const t of e)this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(t))}_updateManipulatorPosition(e){const t=this._operations;if(null!=e&&t)if("vertex"===e.type)e.manipulator.location=t.data.coordinateHelper.vectorToDehydratedPoint(e.handle.pos,Ve),e.manipulator.grabbing&&null!=this._vertexLaserLineVisualElement&&(this._vertexLaserLineVisualElement.visualElement.intersectsWorldUpAtLocation=e.manipulator.renderLocation);else if("edge"===e.type){const i=this._getManipulatorInfoFromHandle(e.handle.leftVertex),n=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(null==i||null==n)return;const a=i.manipulator,o=n.manipulator;if("on-the-ground"===e.manipulator.elevationInfo?.mode){const i=a.location,n=o.location,s=.5,r=i.x+s*(n.x-i.x),l=i.y+s*(n.y-i.y),p=i.hasZ&&n.hasZ?0:void 0;e.manipulator.location=D(r,l,p,t.data.spatialReference)}else x(De,a.renderLocation,o.renderLocation,.5),e.manipulator.renderLocation=De}}_splitEdgeManipulator(e,t=.5){const i=this._operations,n=i.splitSegment(e.handle,t).createdVertex;e.locationUpdateHandle=p(e.locationUpdateHandle);const a=this.object.elevationInfo;let o;this.enableEdgeOffset?(this._removeManipulator(e),o=this._createVertexOrEdgeManipulator(n)):(o=e,o.handle=n,o.type="vertex",this._setTypeSpecificManipulatorSettings(e.manipulator,e.handle,a)),"line"===n.leftSegment?.type&&this._createVertexOrEdgeManipulator(n.leftSegment),"line"===n.rightSegment?.type&&this._createVertexOrEdgeManipulator(n.rightSegment),this._updateManipulatorPosition(o),this.enableEdgeOffset||this._resetTooltip(),this._updateSelection(e.manipulator);const s=this._updateEventState(2),r=i.data.coordinateHelper.vectorToArray(o.handle.pos),l=i.data.parts.indexOf(n.part);return this.events.emit("vertex-add",{type:"vertex-add",object:this.object,vertices:[{coordinates:r,componentIndex:l,vertexIndex:n.index}],added:r}),s&&this._updateEventState(0),o}_updateMoveManipulationPosition(){const e=y(De,0,0,0);let t=0,i=!1,n=null,a=null;for(const r of this._manipulatorInfos)"vertex"===r.type&&(r.manipulator.selected?(t++,O(e,e,r.manipulator.renderLocation),null==n||r.selectedIndex>n.selectedIndex?(a=n,n=r):(null==a||r.selectedIndex>a.selectedIndex)&&(a=r)):i=!0);const o=this.object,s=this._operations?.data.geometry;if(0===t){const e=o.visible&&this.enableMoveObject;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e,this._moveManipulation.zManipulation.available=e&&this.enableZShape&&B(this._operations,o.elevationInfo),this._moveManipulation.angle=Z(s),this._moveManipulation.radius=X.radiusForSymbol(o.graphic?.symbol)}else{const e=o.visible;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.zManipulation.available=e&&this.enableZVertex&&B(this._operations,this.object.elevationInfo),this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e&&1!==t;let i=0;if(null!=n){const e=n.handle.pos,t=null!=a?a.handle.pos:n.handle.leftSegment?.leftVertex?n.handle.leftSegment.leftVertex.pos:null,o=null==a&&n.handle.rightSegment?.rightVertex?n.handle.rightSegment.rightVertex.pos:null;t&&o?this._moveManipulation.xyAxisManipulation.available=!1:t?i=Se(t,e):o&&(i=Se(e,o))}this._moveManipulation.angle=i,this._moveManipulation.radius=q}0!==t&&i?(E(e,e,1/t),Ve.spatialReference=this._operations.data.spatialReference,Ve.hasZ=!0,this.view.renderCoordsHelper.fromRenderCoords(e,Ve),this._moveManipulation.elevationAlignedLocation=Ve):null==this._outlineVisualElement||this.object.isDraped||null==this._outlineVisualElement.attachmentOrigin?k(this._moveManipulation,this.object):this._moveManipulation.elevationAlignedLocation=this._outlineVisualElement.attachmentOrigin}_removeVertices(e){const t=new Array,i=this._operations;if(i){for(const n of e){const e=n.handle.part;if("vertex"===n.type&&i.canRemoveVertex(e)){t.push(n.handle),this._removeManipulator(n),this._removeManipulator(this._getManipulatorInfoFromHandle(n.handle.leftSegment)),this._removeManipulator(this._getManipulatorInfoFromHandle(n.handle.rightSegment));const a=i.removeVertices([n.handle]),o=a.removedVertices?.[0].createdSegment;o&&"line"===o.type?this._createVertexOrEdgeManipulator(o):this.enableEdgeOffset&&e.vertices.length<=2&&this._removeManipulator(this._getManipulatorInfoFromHandle(e.segments[0]))}}if(t.length>0){const e=t.map(e=>{const t=i.data.parts.indexOf(e.part);return{coordinates:i.data.coordinateHelper.vectorToArray(e.pos),componentIndex:t,vertexIndex:e.index}}),n=this._updateEventState(2);if(this.destroyed)return;if(this.events.emit("vertex-remove",{type:"vertex-remove",object:this.object,removed:e.map(e=>e.coordinates),vertices:e}),this.destroyed)return;if(n&&(this._updateEventState(0),this.destroyed))return;this._updateMoveManipulationPosition()}}}_moveVertices(e,t,i=("start"===t.action?0:1)){const n=this._operations;if(n){e.length>0&&n.moveVertices(e.map(e=>e.handle),t.mapDeltaX,t.mapDeltaY,t.mapDeltaZ,i);for(const t of e)this._updateManipulatorPosition(t)}}_offsetEdge(e,t,i){if(!this._operations)return;const n=t.clone();n.distance=i,this._operations.updateVertices([e.handle.leftVertex,e.handle.rightVertex],n),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.leftVertex)),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.rightVertex))}_manipulatorClickCallback(e,t){e.shiftKey||this._clearSelection(),"vertex"===t.type&&(t.manipulator.selected=!t.manipulator.selected,this.enableDeleteVertices&&e.button===de.Right&&this._removeVertices([t])),"edge"===t.type&&e.button===de.Left&&this._splitEdgeManipulator(t),e.stopPropagation()}_updateTranslateTooltip(e,t){null!=this._defaultTooltipInfo?this._resetTooltip():this._updateTranslateObjectTooltip(e,t)}_updateTranslateObjectTooltip(e,t){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=ae(e,t,this._tooltipsContext,this._updatingHandles))}_updateEdgeOffsetTooltip(e){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=oe(this.object,e,this._tooltipsContext,this._updatingHandles))}_resetTooltip(){const e=this.activeTooltipInfo;if(this._pendingEdgeOffsetInfo&&"reshape-edge-offset"===e?.type)return;let t=null;t=this._pendingEdgeOffsetInfo||null!=this._findActiveEdgeOffsetManipulatorInfo()?oe(this.object,null,this._tooltipsContext,this._updatingHandles):this._defaultTooltipInfo,t!==e&&(null!=e&&null!=t&&"input"===this.tooltip.mode||(this.activeTooltipInfo=t))}get _defaultTooltipInfo(){const e=this._operations?.data.type;switch(e){case"polyline":case"polygon":return this._selectedVertexManipulatorInfo?this.tooltipInfos.selectedVertex:null;case"point":case"mesh":return this.tooltipInfos.movePoint;default:return null}}get _selectedVertexManipulatorInfo(){const e=this._manipulatorInfos.filter(e=>"vertex"===e.type&&e.manipulator.selected);return 1===e.length?e[0]:null}get _tooltipsContext(){const{tooltipInfos:e,activeTooltipInfo:t}=this;return{sketchOptions:this._sketchOptions,tooltipInfos:e,activeTooltipInfo:t,selectedVertexManipulatorInfo:this._selectedVertexManipulatorInfo,callbacks:this._tooltipCallbacks,measurementWorker:this._measurementWorker}}get test(){}};function je(){return e=>{const{operation:t,mapEnd:i}=e;return null==t||null==i?e:{...e,signedDistance:t.signedDistanceToPoint(i)}}}function Ie(e){const t=e.size/2,i=t+e.collisionPadding;return{size:t/i,outlineSize:(t+e.outlineSize)/i}}function Se(e,t){return Math.atan2(t[1]-e[1],t[0]-e[0])+Math.PI/2}function He(e){return new H({x:0,y:0,z:0,spatialReference:e})}function we(e){return"edge"===e.type&&"edgeManipulator"in e}e([f()],Ee.prototype,"_numGrabbing",void 0),e([f()],Ee.prototype,"_numDragging",void 0),e([f()],Ee.prototype,"_pendingEdgeOffsetInfo",void 0),e([f()],Ee.prototype,"_operations",null),e([f()],Ee.prototype,"_segmentLabels",void 0),e([f({constructOnly:!0})],Ee.prototype,"tool",void 0),e([f()],Ee.prototype,"tooltip",void 0),e([f()],Ee.prototype,"activeTooltipInfo",void 0),e([f({readOnly:!0})],Ee.prototype,"updating",null),e([f()],Ee.prototype,"manipulators",null),e([f()],Ee.prototype,"view",null),e([f()],Ee.prototype,"object",null),e([f()],Ee.prototype,"enableZShape",null),e([f()],Ee.prototype,"enableDeleteVertices",null),e([f()],Ee.prototype,"enableZVertex",null),e([f()],Ee.prototype,"autoHideManipulators",null),e([f()],Ee.prototype,"enableMoveObject",null),e([f()],Ee.prototype,"enableMidpoints",null),e([f()],Ee.prototype,"enableEdgeOffset",null),e([f()],Ee.prototype,"_sketchOptions",null),e([f()],Ee.prototype,"_accentColor",null),e([f()],Ee.prototype,"_tooltipsContext",null),Ee=e([_("esri.views.3d.interactive.editingTools.reshape.ReshapeOperation")],Ee);const Ve=D(0,0,void 0,V.WGS84),De=I(),Te=1e-6,Ge=16,Ae=32;export{Ee as ReshapeOperation};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{makeHandle as t}from"../../../../../../core/handleUtils.js";import{zeroMeters as e}from"../../../../../../core/quantity.js";import{rotateZ as o}from"../../../../../../core/libs/gl-matrix-2/math/mat4.js";import{subtract as i}from"../../../../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as n}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as a}from"../../../../../../core/support/UpdatingHandles.js";import r from"../../../../../../geometry/Point.js";import{sm4d as s,sv3d as p}from"../../../../../../geometry/support/vectorStacks.js";import{IsShiftEdgeOnScreenFlag as l}from"../../../../analysis/Slice/sliceToolUtils.js";import{screenToZConstrained as m}from"../../dragEventPipeline3D.js";import{MoveXYObjectManipulation as c}from"../../manipulations/MoveXYObjectManipulation.js";import{ShiftManipulator as u}from"../../../manipulators/ShiftManipulator.js";import{createManipulatorDragEventPipeline as d,addMapDelta as h,addScreenDelta as v}from"../../../../../interactive/dragEventPipeline.js";import{TranslateTooltipInfo as f}from"../../../../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{TranslateZTooltipInfo as _}from"../../../../../interactive/tooltip/infos/TranslateZTooltipInfo.js";import{verticalSignedDistance as g}from"../../../../../support/euclideanLengthMeasurementUtils.js";import{
|
|
2
|
+
import{makeHandle as t}from"../../../../../../core/handleUtils.js";import{zeroMeters as e}from"../../../../../../core/quantity.js";import{rotateZ as o}from"../../../../../../core/libs/gl-matrix-2/math/mat4.js";import{subtract as i}from"../../../../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as n}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as a}from"../../../../../../core/support/UpdatingHandles.js";import r from"../../../../../../geometry/Point.js";import{sm4d as s,sv3d as p}from"../../../../../../geometry/support/vectorStacks.js";import{IsShiftEdgeOnScreenFlag as l}from"../../../../analysis/Slice/sliceToolUtils.js";import{screenToZConstrained as m}from"../../dragEventPipeline3D.js";import{MoveXYObjectManipulation as c}from"../../manipulations/MoveXYObjectManipulation.js";import{ShiftManipulator as u}from"../../../manipulators/ShiftManipulator.js";import{createManipulatorDragEventPipeline as d,addMapDelta as h,addScreenDelta as v}from"../../../../../interactive/dragEventPipeline.js";import{TranslateTooltipInfo as f}from"../../../../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{TranslateZTooltipInfo as _}from"../../../../../interactive/tooltip/infos/TranslateZTooltipInfo.js";import{verticalSignedDistance as g}from"../../../../../support/euclideanLengthMeasurementUtils.js";import{GeometryWorkerHandle as M}from"../../../../../support/GeometryWorkerHandle.js";class j{get _object(){return this._tool.object}get _operations(){return this._object.operations}get updating(){return this._updatingHandles.updating}constructor(t,e){this._tool=t,this._bounds=e,this._moveXYTooltipInfo=null,this._moveZTooltipInfo=null,this._measurementWorker=new M({preloadGeodetic:!0}),this._updatingHandles=new a;const o=this._tool,i=o.view;this.moveXYObjectManipulation=new c({view:i,tool:o,object:this._object}),o.addHandles(this._createMoveXYObjectDragPipeline()),this.moveZManipulator=new u(i,0),this.moveZManipulator.state|=l,o.manipulators.add(this.moveZManipulator),o.addHandles(this._createMoveZDragPipeline()),o.addHandles(o.events.on("translate-stop",()=>{this._moveXYTooltipInfo=null,this._moveZTooltipInfo=null}))}destroy(){this.moveXYObjectManipulation.destroy(),this._tool.manipulators.remove(this.moveZManipulator),this.moveZManipulator.destroy(),this._measurementWorker.destroy(),this._updatingHandles.destroy()}forEachManipulator(t){this.moveXYObjectManipulation.forEachManipulator(t),t(this.moveZManipulator,0)}updateManipulators(t,e){const n=this.moveZManipulator,a=o(s.get(),t,Math.PI);a[12]=0,a[13]=0,a[14]=0,n.modelTransform=a,n.renderLocation=i(p.get(),e.origin,e.basis1)}getUpdatedTooltipInfo(){return this.moveXYObjectManipulation.grabbing||this.moveXYObjectManipulation.dragging?this._computeMoveXYTooltipInfo():this.moveZManipulator.focused?this._computeMoveZTooltipInfo():null}_computeMoveXYTooltipInfo(){const t=this._tool,o=this._moveXYTooltipInfo??=new f({sketchOptions:t.sketchOptions});if(this.moveXYObjectManipulation.dragging){const t=this._bounds,e=t.mapBoundsStart.origin,i=t.mapBounds.origin,n=t.spatialReference,a=new r({x:e[0],y:e[1],spatialReference:n}),s=new r({x:i[0],y:i[1],spatialReference:n});this._updatingHandles.consumePromise(this._measurementWorker.autoDistance2DBetweenPoints(a,s).then(t=>o.distance=t))}else o.distance=e;return o}_computeMoveZTooltipInfo(){const t=this._tool,o=this._moveZTooltipInfo??=new _({sketchOptions:t.sketchOptions});if(this.moveZManipulator.dragging){const e=this._bounds,i=e.mapBoundsStart.origin,n=e.mapBounds.origin,{renderSpatialReference:a}=t.view;if(!a)return null;const r=g(i,n,a);if(null==r)return null;o.distance=r}else o.distance=e;return o}_createMoveXYObjectDragPipeline(){return this.moveXYObjectManipulation.createDragPipeline((t,e,o)=>this._buildMoveDragPipeline(e,o))}_createMoveZDragPipeline(){if(!this._operations)return t();const e=this._operations.data.spatialReference;return d(this.moveZManipulator,(t,o,i)=>{const a=n(t.renderLocation),r=o.next(m(this._tool.view,a,e)).next(v());this._buildMoveDragPipeline(r,i)})}_buildMoveDragPipeline(t,e){const{_tool:o,_object:i}=this;t.next(t=>("start"===t.action&&(o.inputState={type:"move"},this._bounds.backupMapBounds(),o.events.emit("translate-start",{object:i,dxScreen:t.screenDeltaX,dyScreen:t.screenDeltaY})),t)).next(h()).next(this._updateGeometry()).next(t=>{const e={object:i,dxScreen:t.screenDeltaX,dyScreen:t.screenDeltaY};switch(t.action){case"start":case"update":(t.mapEnd.x-t.mapStart.x||t.mapEnd.y-t.mapStart.y||(t.mapEnd.z??0)-(t.mapStart.z??0))&&o.events.emit("translate",e);break;case"end":o.inputState=null,o.events.emit("translate-stop",e)}return t}),e.next(()=>{null!=o.inputState&&o.events.emit("translate-stop",{object:i,dxScreen:0,dyScreen:0}),o.cancelDrag()})}_updateGeometry(){const t=this._tool;return e=>{if(null==t.inputState||"move"!==t.inputState.type)return e;const o="start"===e.action?0:1;if(this._operations){const t=this._operations.move(e.mapDeltaX,e.mapDeltaY,e.mapDeltaZ,o);this._bounds.updateMapBoundsFromOperation(t)}return e}}}export{j as ExtentMove};
|