@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{set as t,normalize as e}from"../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as s}from"../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{copy as i,scaleAndAdd as a,subtract as o,length as r,dot as n}from"../../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as p}from"../../../../../../core/support/UpdatingHandles.js";import{d,c as l}from"../../../../../../chunks/boundedPlane.js";import{intersectRay as u}from"../../../../../../geometry/support/plane.js";import{sv3d as h}from"../../../../../../geometry/support/vectorStacks.js";import{updateResizeHandle as m,isDiagonalResizeHandle as _,calculateDiagonalResizeHandleScale as f}from"../../../../analysis/Slice/sliceToolUtils.js";import{screenToRenderPlane as g}from"../../dragEventPipeline3D.js";import{mapPlaneAutoSize2D as y}from"./extentUtils.js";import{ResizeManipulator as x}from"../../../manipulators/ResizeManipulator.js";import{fromScreenNormalized as S}from"../../../../support/geometryUtils/ray.js";import{createManipulatorDragEventPipeline as M}from"../../../../../interactive/dragEventPipeline.js";import{ExtentScaleTooltipInfo as b}from"../../../../../interactive/tooltip/infos/ExtentScaleTooltipInfo.js";import{
|
|
2
|
+
import{set as t,normalize as e}from"../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as s}from"../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{copy as i,scaleAndAdd as a,subtract as o,length as r,dot as n}from"../../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as p}from"../../../../../../core/support/UpdatingHandles.js";import{d,c as l}from"../../../../../../chunks/boundedPlane.js";import{intersectRay as u}from"../../../../../../geometry/support/plane.js";import{sv3d as h}from"../../../../../../geometry/support/vectorStacks.js";import{updateResizeHandle as m,isDiagonalResizeHandle as _,calculateDiagonalResizeHandleScale as f}from"../../../../analysis/Slice/sliceToolUtils.js";import{screenToRenderPlane as g}from"../../dragEventPipeline3D.js";import{mapPlaneAutoSize2D as y}from"./extentUtils.js";import{ResizeManipulator as x}from"../../../manipulators/ResizeManipulator.js";import{fromScreenNormalized as S}from"../../../../support/geometryUtils/ray.js";import{createManipulatorDragEventPipeline as M}from"../../../../../interactive/dragEventPipeline.js";import{ExtentScaleTooltipInfo as b}from"../../../../../interactive/tooltip/infos/ExtentScaleTooltipInfo.js";import{GeometryWorkerHandle as z}from"../../../../../support/GeometryWorkerHandle.js";class j{get _object(){return this._tool.object}get _operations(){return this._object.operations}get updating(){return this._updatingHandles.updating}get zMax(){if(!this._zMaxDirty||!this._operations)return this._zMax;const t=this._operations.data;if(t.geometry.hasZ){const e=t.coordinateHelper;this._zMax=Number.NEGATIVE_INFINITY;for(const s of t.parts)for(const t of s.vertices){const s=e.getZ(t.pos)??0;this._zMax=Math.max(s,this._zMax)}}else this._zMax=0;return this._zMaxDirty=!1,this._zMax}constructor(t,e,s){this._tool=t,this._bounds=e,this._preserveAspectRatioStep=s,this._resizeHandles=[{direction:[1,0]},{direction:[1,1]},{direction:[0,1]},{direction:[-1,1]},{direction:[-1,0]},{direction:[-1,-1]},{direction:[0,-1]},{direction:[1,-1]}],this._displayBoundsStart=d(),this._displayBoundsMarginStart=0,this._updatingHandles=new p,this._measurementWorker=new z({preloadGeodetic:!0}),this._zMax=0,this._zMaxDirty=!0;const i=this._tool,a=i.view;this.resizeManipulators=this._resizeHandles.map(t=>{const e=new x(a,t);return i.addHandles([e.events.on("grab-changed",t=>this._onGrabChanged(t)),this._createResizeDragPipeline(e,t)]),e}),i.manipulators.addMany(this.resizeManipulators),this._operations&&i.addHandles(this._operations.data.on("change",()=>{"resize"!==i.inputState?.type&&(this._zMaxDirty=!0)}))}destroy(){this.forEachManipulator(t=>{this._tool.manipulators.remove(t),t.destroy()}),this._measurementWorker.destroy(),this._updatingHandles.destroy()}forEachManipulator(t){this.resizeManipulators.forEach(e=>t(e,2))}updateManipulators(t,e){this.resizeManipulators.forEach((s,i)=>{m(s,this._resizeHandles[i],t,e)})}getUpdatedTooltipInfo(){if(!this.resizeManipulators.some(t=>t.focused))return null;const t=this._tooltipInfo??=new b({sketchOptions:this._tool.sketchOptions});return this.resizeManipulators.some(t=>t.dragging)||(t.xScale=1,t.yScale=1),this._updatingHandles.consumePromise(y(this._bounds.mapBounds,this.zMax,this._bounds.spatialReference,this._measurementWorker).then(({width:e,height:s})=>{t.xSize=e,t.ySize=s})),t}_onGrabChanged({action:t,screenPoint:e}){const s=this._tool,i=this._bounds;if("start"!==t||!e)return;const a=S(s.view.state.camera,e);u(i.displayBounds.plane,a,h.get())&&(i.backupMapBounds(),l(i.displayBounds,this._displayBoundsStart),this._displayBoundsMarginStart=i.displayBoundsMargin,s.inputState={type:"resize"})}_createResizeDragPipeline(t,e){const{_tool:s,_object:i}=this;return M(t,(t,a,o)=>{null!=s.inputState&&(a.next(t=>("start"===t.action&&s.events.emit("scale-start",{object:i,xScale:1,yScale:1}),{...t,handle:e})).next(g(s.view,this._displayBoundsStart.plane)).next(this._renderPlaneToFactors()).next(...this._preserveAspectRatioStep()).next(this._updateGeometry()).next(t=>{const e=this._tooltipInfo;e&&(e.xScale=t.factor1,e.yScale=t.factor2);const a={object:i,xScale:t.factor1,yScale:t.factor2};switch(t.action){case"start":case"update":s.events.emit("scale",a);break;case"end":s.inputState=null,s.events.emit("scale-stop",a)}return t}),o.next(()=>{null!=s.inputState&&s.events.emit("scale-stop",{object:i,xScale:1,yScale:1}),s.cancelDrag()}))})}_renderPlaneToFactors(){const t=this._bounds;return e=>{const s=this._displayBoundsStart,c=e.handle.direction,p=t.displayBoundsMargin,d=this._displayBoundsMarginStart,l=i(h.get(),s.origin);a(l,l,s.basis1,-c[0]),a(l,l,s.basis2,-c[1]);const u=o(h.get(),e.renderEnd,l),m=o(h.get(),e.renderStart,l),g=_(e.handle),y=f(s),x=f(t.displayBounds)/y,S=(t,e)=>{if(0===t)return 1;let s=r(e),i=.5*t*n(e,u)/s;const a=i<0?-1:1;if(g){i+=(s-.5*t*n(e,m)/s)*a*x}const o=s<1.5*d?1:B;return s=Math.max(s-d,B),a>0&&(i-=p),a*Math.max(a*(i/s),o)};return{...e,factor1:S(c[0],s.basis1),factor2:S(c[1],s.basis2)}}}_updateGeometry(){const o=this._bounds;return r=>{const n=i(c(),o.mapBoundsStart.origin);a(n,n,o.mapBoundsStart.basis1,-r.handle.direction[0]),a(n,n,o.mapBoundsStart.basis2,-r.handle.direction[1]);const p=t(s(),o.mapBoundsStart.basis1[0],o.mapBoundsStart.basis1[1]);e(p,p);const d="start"===r.action?0:1;if(this._operations){const t=this._operations.scale(n,p,r.factor1,r.factor2,d,1);l(o.mapBoundsStart,o.mapBounds),o.updateMapBoundsFromOperation(t)}return r}}}const B=1e-6;export{j as ExtentScale,B as scaleEpsilon};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import has from"../../../core/has.js";import t from"../../../core/Logger.js";import{destroyMaybe as i,removeMaybe as s}from"../../../core/maybe.js";import{throwIfAborted as r}from"../../../core/promiseUtils.js";import{initial as o,watch as n,when as a}from"../../../core/reactiveUtils.js";import{schedule as l}from"../../../core/scheduling.js";import{property as d,subclass as c}from"../../../core/accessorSupport/decorators.js";import{fromMat4 as h,invert as u,fromQuat as m}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as p,IDENTITY as f}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as b}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as y}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{normalize as g,sub as _,dot as v,set as w,transformMat3 as j,add as C}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as T,freeze as x,fromValues as R,clone as E,ZEROS as O}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as M,clone as V,fromValues as S}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMoon as U,isMars as A,getReferenceEllipsoid as H,SphericalECEFSpatialReferenceLike as L}from"../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as k}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as P}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as I}from"../../../geometry/projection/projectVectorToVector.js";import{create as D}from"../../../geometry/support/aaBoundingRect.js";import{getContinuousIndexArray as F}from"../../../geometry/support/Indices.js";import{isCGCS2000 as B}from"../../../geometry/support/spatialReferenceUtils.js";import{BufferViewVec4f as G,BufferViewVec4u8 as z,BufferViewVec4u16 as N,BufferViewVec3f as q,BufferViewVec3u8 as W,BufferViewVec3u16 as $,BufferViewVec2f as Q,BufferViewInt16 as J,BufferViewUint32 as Z,BufferViewUint16 as X,BufferViewVec2i16 as Y}from"../../../geometry/support/buffer/BufferView.js";import K from"../../../layers/support/SceneModification.js";import{getElevationOffsetInMeters as ee}from"../../../support/elevationInfoUtils.js";import{addNormals as te}from"./IntegratedMeshNormals.js";import{LayerView3D as ie}from"./LayerView3D.js";import{Lyr3DViewPerformanceInfo as se}from"./Lyr3DViewPerformanceInfo.js";import{addLayerViewToWasm as re,removeLayerViewFromWasm as oe,getLyr3DWasm as ne}from"./Lyr3DWasm.js";import{toWasmModification as ae}from"./SceneLayerWorkerHandle.js";import{LayerElevationProvider as le}from"./i3s/LayerElevationProvider.js";import{IntegratedMesh3DTilesLayerView3DSymbol as de}from"./support/integratedMesh3DTilesLayerViewInstanceUtils.js";import{primTypeConversion as ce,alphaModeConversion as he,faceCullingConversion as ue,wrapModeConversion as me,lyr3DTypeToByteSize as pe}from"./support/lyr3dTypeConversions.js";import{Tiles3DMeshIntersectionHandler as fe}from"./support/Tiles3DMeshIntersectionHandler.js";import{Frustum as be}from"../state/Frustum.js";import{ElevationRange as ye}from"../support/ElevationRange.js";import{toBoundingRect as ge}from"../support/extentUtils.js";import{Obb as _e,compute as ve}from"../support/orientedBoundingBox.js";import{glLayout as we}from"../support/buffer/glUtil.js";import{VertexBufferLayoutCreationParameters as je,createVertexBufferLayout as Ce,ComponentGeometryParameters as Te,SourceGeometry as xe}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as Re}from"../webgl-engine/collections/Component/Transform.js";import{RenderTexture as Ee}from"../webgl-engine/core/material/RenderTexture.js";import{Attribute as Oe}from"../webgl-engine/lib/Attribute.js";import{ManagedTexture as Me}from"../webgl-engine/lib/ManagedTexture.js";import{compressAndTransformNormals as Ve}from"../webgl-engine/lib/Normals.js";import{advancedMRRFactors as Se}from"../webgl-engine/materials/pbrUtils.js";import Ue from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as Ae,isInEffectiveScaleRange as He,validateScaleRange as Le}from"../../support/layerViewUtils.js";import{PromiseQueue as ke}from"../../support/PromiseQueue.js";import{TaskPriority as Pe}from"../../support/Scheduler.js";import{TextureCompressionTracker as Ie}from"../../support/TextureCompressionTracker.js";import{alphaCutoff as De}from"../../../webscene/support/AlphaCutoff.js";var Fe;let Be=class extends(ie(Ue)){static{Fe=de}constructor(e){super(e),this[Fe]=!0,this.type="integrated-mesh-3dtiles",this._modifications=new Array,this._visibleGeometryChangedSchedulerHandle=null,this._wasmLayerId=-1,this.ignoresMemoryFactor=!1,this._usedMemory=0,this._cacheMemory=0,this.drapeTargetType=1,this._replacesTerrain=!1,this._isUsedAsGroundLayer=!1,this._applySSAO=!has("disable-feature:im-ssao"),this._imShading=!!has("enable-feature:im-shading"),this._imVertexNormals=!!has("enable-feature:im-vertex-normals"),this._lyrHandleToObjects=new Map,this._visibleObjects=new Set,this._loadedObjects=new Set,this._compressionTracker=new Ie,this._createRenderableQueue=new ke,this._dbgFlags=new Set;const t=e.view.resourceController;this._memCache=t.memoryController.newCache(`IM3DTiles-${this.uid}`,e=>this._deletePerObjectData(e)),this._replacesTerrain=e.layer.replacesTerrain,this._isUsedAsGroundLayer=e.layer.isUsedAsGroundLayer,this._frameTask=t.scheduler.registerTask(Pe.TILES3D,this),this._frustum=new be(e.view.renderCoordsHelper)}tryRecycleWith(e,t){return this.canRecycleWith(e)?e.load(t).then(()=>{r(t);const i=this.layer.queryElevationCallback;this.layer=e,this.layer.queryElevationCallback=i}):null}canRecycleWith(e){return e.url===this.layer.url&&"integrated-mesh-3dtiles"===e.type&&e.replacesTerrain===this._replacesTerrain&&e.isUsedAsGroundLayer===this._isUsedAsGroundLayer}initialize(){this._dbg(2,"Tiles3DLayerView3D initialize() called");const{view:e}=this;if(this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),o),!this._canProjectWithoutEngine())throw Ae("layer",this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);const t=re(this).then(t=>{this._wasmLayerId=t,this._intersectionHandler=new fe(this),e.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged()),this._updatingHandles.add(()=>this.fullOpacity,()=>this._opacityChange()),this._updatingHandles.add(()=>e.clippingArea,()=>this._clippingAreaChanged(),o),this._updatingHandles.add(()=>e.state.contentCamera,()=>this._cameraChanged(),o),this._elevationProvider=new le({view:e,layerElevationSource:this,intersectionHandler:this._intersectionHandler});const i=this._replacesTerrain?0:1;e.elevationProvider.register(i,this._elevationProvider),e.overlayManager.registerDrapeTarget(this),this.addHandles([n(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),a(()=>this.fullOpacity,()=>this._opacityChange()),n(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),o)])});this.layer.queryElevationCallback=(e,t)=>this._wasm.queryElevation(this,e,t),this.addResolvingPromise(t)}destroy(){this._dbg(2,"Tiles3DLayerView3D destroy() called"),oe(this),this.layer.queryElevationCallback=null,this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler.destroy(),this._intersectionHandler=null),this._elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(e=>this.forEachComponentObject(t=>e(t.obb))),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this.view.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach(e=>this.freeObject(e)),this._lyrHandleToObjects.clear(),this._visibleObjects.clear(),this._loadedObjects.clear(),this._usedMemory=0,this._cacheMemory=0,this._memCache.destroy(),this._createRenderableQueue.destroy(),this.notifyChange("readyToRun"),this._frameTask.remove(),this._updatingHandles=i(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=s(this._visibleGeometryChangedSchedulerHandle)}get fullOpacity(){return this.layer.replacesTerrain?this.view.map.ground.opacity:1}get hasModifications(){return this._modifications&&this._modifications.length>0}_opacityChange(){const{fullOpacity:e}=this;this.forEachComponentObject(t=>this._collection.updateObjectOpacity(t,e))}_cameraChanged(){const e=this._frustum;e.update(this.view.state.contentCamera);const t=this._visibleObjects;let i=!1;this._loadedObjects.forEach(s=>{const r=s.obb?.intersectsFrustum(e)??!1;r!==s.isVisible&&(s.isVisible=r,r?t.add(s):t.delete(s),s.componentObjects.forEach(e=>this._collection.setObjectVisibility(e,r)),i||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(r,s.elevationRange))}),i&&this._setVisibleElevationRangeDirty()}intersect(e,t,i,s){this._intersectionHandler.intersect(e,t,i,s,null,!1)}get ready(){return!this.layer.replacesTerrain||!!this._wasm?.isTerrainReady}_modificationsChanged(){const e=this.layer.spatialReference,t=ae(this._layerClippingArea,this._modifications,e);this._wasm?.setMeshModifications(this,t)}_clippingAreaChanged(){const e=this.layer.spatialReference,t=D();this._layerClippingArea=ge(this.view.clippingArea,t,e)?t:null,this._modificationsChanged()}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=l(()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e&&!this.layer.replacesTerrain),this.forEachComponentObject(t=>t.updateMaterial({slicePlaneEnabled:e}))}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,ee(e))}get _wasm(){return ne(this.view)}get wasmLayerId(){return this._wasmLayerId}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get visibleAtCurrentScale(){return this.layer.isUsedAsGroundLayer||He(this.layer.effectiveScaleRange,this.view.scale)}canResume(){const e=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return this.visible&&this.layer?.loaded&&this.parent&&!this.parent.suspended&&this.view?.ready&&(this.layer.isUsedAsGroundLayer||Le(e)&&this.visibleAtCurrentScale)&&this.visibleAtCurrentTimeExtent||!1}get performanceInfo(){let e=0,t=0,i=0,s=0,r=0,o=0;return this._lyrHandleToObjects.forEach(n=>{n.isLoaded?(e+=n.textureMemoryUsage,t+=n.vboMemoryUsage,r++):(i+=n.textureMemoryUsage,s+=n.vboMemoryUsage,o++)}),new se(this.usedMemory,r,o,Ne(t),Ne(e),Ne(s),Ne(i))}_canProjectWithoutEngine(){if(this.view.state.isLocal){const e=this.view.renderSpatialReference?.isWebMercator?3857:this.view.renderSpatialReference?.wkid??-1;if(3857!==e&&32662!==e)return!1}return!0}get _stage(){return this.view.stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return ee(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new ye(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get visibleElevationRange(){const e=new ye;0===this._visibleObjects.size?e.setElevationRangeValues(0,0):(e.setElevationRangeValues(1/0,-1/0),this._forEachRelevantVisibleTile(t=>e.expandElevationRange(t.elevationRange)),e.minElevation===1/0&&e.setElevationRangeValues(0,0));const t=this._get("visibleElevationRange");return t&&t.minElevation===e.minElevation&&t.maxElevation===e.maxElevation?t:e}_setVisibleElevationRangeDirty(){this.notifyChange("visibleElevationRange")}_forEachRelevantVisibleTile(e){const{view:t}=this,{spatialReference:i}=t,s=i.isWGS84||i.isWebMercator||B(i)||U(i)||A(i);if(this.view.state.isGlobal||!s)return this.forEachVisibleTile(e);const r=H(i).radius,{eye:o,viewForward:n,near:a}=t.state.camera,l=g(T(),n),d=500,c=Math.max(o[2],d),h=c+r,u=Math.sqrt(h**2-r**2),m=Math.abs(Math.atan2(u,r))*r,p=c>.5*r?.5*Math.PI*r:m,f=T();this.forEachVisibleTile(t=>{const{mbsRadius:i,mbsCenter:s}=t;if(i<0)return;_(f,s,o);const r=v(f,l);Math.abs(r)<p&&r+i>a&&r-i<p&&e(t)})}get fullExtent(){return this.layer.fullExtent}forEachComponentObject(e){this._forEachObject(this._lyrHandleToObjects.values(),e)}forEachVisibleTile(e){for(const t of this._visibleObjects)e(t)}forEachTile(e){for(const t of this._loadedObjects)e(t)}forEachVisibleComponentObject(e){this._forEachObject(this._visibleObjects,e)}_forEachObject(e,t){for(const{componentObjects:i}of e)for(const e of i)t(e)}isUpdating(){const e=this._wasm;return this._wasmLayerId>=0&&null!=e&&(e.isUpdating(this._wasmLayerId)||this._compressionTracker.compressing)}get readyToRun(){return!!this._frameTask?.readyToRun||this._createRenderableQueue.readyToRun}runTask(e){this._frameTask.processQueue(e),this._createRenderableQueue.runTask(e),this.notifyChange("readyToRun")}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable called after destroy");const t=new Map,i=this._getTextureLoadPromises(e,t);if(0===i.length)return this._enqueueCreateRenderable(e,t);const s=()=>{t.forEach(e=>this._stage.removeTexture(e))};return this.notifyChange("readyToRun"),this._frameTask.schedule(()=>Promise.all(i)).then(()=>{if(this.destroyed||this.destroying){const e=new Error("IntegratedMesh3DTilesLayerView3D: createRenderable called after destroy");throw s(),e}return this._enqueueCreateRenderable(e,t)},e=>{throw s(),e})}_enqueueCreateRenderable(e,t){const i=this._createRenderableQueue.push(()=>this._createRenderable(e,t),null);return this.notifyChange("readyToRun"),i}_getTextureLoadPromises(e,t){const{meshData:i}=e;if(null==i.data)throw new Error("meshData.data undefined");if("string"==typeof i.desc&&(i.desc=JSON.parse(i.desc)),null==i.desc)throw new Error("meshData.desc undefined");const s=i.desc.materials;if(!s)return[];const r=new Array,o=e=>{const s=this._getTexture(e,i,t);null!=s?.loadPromise&&r.push(s.loadPromise)};for(const n of s){if(!n)continue;const e="Pbr"===n.lightingModel;o(n.baseColorTex),e&&(o(n.metalTex),o(n.emissiveTex),o(n.occlusionTex),o(n.normalTex))}return r}_createRenderable(e,t){if(this.destroyed){const e=`IntegratedMesh3DTilesLayerView3D[${this.layer?.title}]: createRenderable called on destroyed instance`;throw this._dbg(3,e),new Error(e)}const{meshData:i}=e;if(null==i.data)throw new Error("meshData.data undefined");if("string"==typeof i.desc&&(i.desc=JSON.parse(i.desc)),null==i.desc)throw new Error("meshData.desc undefined");const s=x(...i.desc.origin),r=this.view.basemapTerrain.spatialReference;let o=f;if(this.view.state.isGlobal){const e=b();k(L,s,e,r),o=h(p(),e)}if(null==i.desc.obb)throw new Error("meshData.desc.obb undefined");const n=$e(i.desc.obb);let a=0;const l=new Array,d=i.desc.prims.length,c=new ye;try{const e=this.view.state.isGlobal,h=e?H(this.view.spatialReference).radius:0,m=o!==f,b=m?u(p(),o)??f:f,y=i.desc.materials,g=n?T():null;for(let u=0;u<d;u++){const d=i.desc.prims[u];this._dbgFlags.has(2)&&this._dbg(2,JSON.stringify(d));if(null==ce[d.ptype]){this._dbg(2,"[Unsupported Feature] Unsupported primitive mode ("+d.ptype+"). Skipping primitive.");continue}const p=y&&null!=d.materialId?y[d.materialId]:null,f=null!=p?p.lightingModel:"Unlit",{positionView:_,positionAttr:v,normalsView:j,normalsAttr:C,colorAttr:x,texCoord0Attr:O,indicesView:U}=this.getBufferViews(d,i.data.buffer,o);if(null==v||null==_||null==U)continue;const A=_.count,H=(e,t)=>!e||e.data.length/e.size===A||(this._dbg(3,`${t} !== numPos. Skipping primitive.`),!1);if(!H(O,"numTexcoord")||!H(x,"numColors")||!H(C,"normals"))continue;const L=new je(null!=x,null!=j,O?1:0),k=Ce(L),D=k.createBuffer(A);Je({origin:s,ellipsoidRadius:h,isGlobal:e,ecefRotation:o},{texCoord0Attr:O,colorAttr:x,normalsAttr:C},D,{positionView:_,tileObb:n,obbHalfSizeAccumulator:g,elevationRange:c});const F=n?.clone()??We(v,s),B=new Uint32Array([0,U.typedBuffer.length]),G=we(k),z=this._imVertexNormals,N=te(new Uint8Array(D.buffer),U.typedBuffer,G,z,z?b:void 0),q=new Te(G,this._imShading?2:0,L.textureCoordinateType,m?1:0,0),W=new xe({interleavedVertexData:N.data,vertexCount:N.data.byteLength/G[0].stride,indexData:N.indices},{positions:_.typedBuffer,indices:U.typedBuffer},B,q),$=this.view.renderSpatialReference,Q=T(),J=[1,1,1];P(s,$,J,r)||this._dbg(3,"Unsupported coordinate system for IM overlay"),I(s,$,Q,r);let Z=M,X=De,Y=null,K=null,ee=null,ie=null,se=null,re=1,oe=!1,ne=2,ae=!1,le=R(0,0,0);const de=E(Se),me="Pbr"===f;if(p){const e=e=>this._getTexture(e,i,t);Y=e(p.baseColorTex),se=me?e(p.metalTex):null,K=me?e(p.emissiveTex):null,ie=me?e(p.occlusionTex):null,ee=me?e(p.normalTex):null,Z=V(p.baseColorFactor),X=p.alphaCutoff??De,me&&(w(de,p.metallicFactor,p.roughnessFactor,0),p.emissiveFactor&&(le=p.emissiveFactor)),re=he[p.alphaMode],oe=p.isDoubleSided,ne=ue[p.faceCulling??"NotSet"],ae=this.layer.replacesTerrain}if(this.destroyed){const e="Trying to add object to destroyed layer view";throw this._dbg(3,`${e} !== numPos. Skipping primitive.`),new Error(e)}Y||this._dbg(3,"No colour texture 1");const pe=this._collection.createObject({toMapSpace:S(Q[0],Q[1],J[0],J[1]),transform:new Re(s,b),obb:F,geometry:W,elevationAlignable:!1},{isIntegratedMesh:!0,baseColor:Z,textureAlphaCutoff:X,mrrFactors:de,baseColorTexture:Y,metallicRoughnessTexture:se,normalTexture:ee,occlusionTexture:ie,emissionTexture:K,hasParametersFromSource:!1,sphereDepthInterpolate:this.layer.hasGoogleUrl,alphaDiscardMode:re,doubleSided:oe,cullFace:ne,isGround:ae,emissiveBaseColor:le,usePBR:me,slicePlaneEnabled:this.slicePlaneEnabled,opacity:this.fullOpacity,polygonOffset:0,ellipsoidMode:1,applySSAO:this._applySSAO});a+=this._collection.getObjectGPUMemoryUsage(pe),l.push(pe)}if(this.destroyed){const e="IntegratedMesh3DTilesLayerView3D: createRenderable object destroyed during call";throw this._dbg(3,e),new Error(e)}}catch(C){throw l.forEach(e=>this._collection.destroyObject(e)),t.forEach(e=>this._stage.removeTexture(e)),C}const m=new Array;t.forEach(e=>m.push(e));const y=m.reduceRight((e,t)=>e+(t.usedMemory??0),0),{fullExtent:g}=this.layer;g?.hasZ&&g.zmax&&g.zmin&&(c.minElevation=Math.max(c.minElevation,g.zmin),c.maxElevation=Math.min(c.maxElevation,g.zmax));const _=l.reduceRight((e,t)=>e+t.intersectionGeometry.usedMemory,0),v=new ze(e.handle,l,m,_,a,y,n,e.stableNodeId,e.nodeDepth,c);this._lyrHandleToObjects.set(e.handle,v),this._memCache.put(Qe(v.handle),v);const{usedMemory:j}=v;return this._cacheMemory+=j,{memUsageBytes:j}}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t?(t.isLoaded?(this._loadedObjects.delete(t),this._visibleObjects.delete(t),this._intersectionHandler.removeTile(t),this._usedMemory-=t.usedMemory):this._cacheMemory-=t.usedMemory,this.freeObject(t),this._lyrHandleToObjects.delete(e)):this._dbg(3,`freeRendedrable on non-existent renderable ${e}`)}freeObject(e){const t=Qe(e.handle);this._memCache.pop(t),e.textures.forEach(e=>this._stage.removeTexture(e)),e.componentObjects.forEach(e=>this._collection.destroyObject(e))}setRenderableVisibility(e,t,i){if(this.destroyed||this.destroying)return;const s=this._frustum,r=new Array;let o=!1,n=!1;for(let a=0;a<i;++a){if(!t[a])continue;const i=e[a],l=this._lyrHandleToObjects.get(i);if(l){if(l.isLoaded){this._dbg(3,`Already loaded object marked loaded again ${l.stableNodeId}`);continue}o=!0,l.isLoaded=!0,this._loadedObjects.add(l),this._intersectionHandler.addTile(l),this._usedMemory+=l.usedMemory,this._cacheMemory-=l.usedMemory;const e=l.obb?.intersectsFrustum(s)??!0;l.isVisible=e,e&&(this._visibleObjects.add(l),n||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(e,l.elevationRange)),e&&l.obb&&r.push(l.obb),l.componentObjects.forEach(t=>{this._collection.setObjectVisibility(t,e)}),this._memCache.pop(Qe(i))}else this._dbg(3,`Tried to mark Non existent object ${i} as loaded`)}for(let a=0;a<i;++a){const i=e[a];if(t[a])continue;const s=this._lyrHandleToObjects.get(i);if(s){if(!s.isLoaded){this._dbg(3,`Tried to unload not-loaded object ${s.stableNodeId}`);continue}const e=s.isVisible;this._visibleObjects.delete(s),s.isVisible=!1,s.isLoaded=!1,this._loadedObjects.delete(s),this._intersectionHandler.removeTile(s),e&&(this._visibleGeometryChanged(),n||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(!1,s.elevationRange)),this._usedMemory-=s.usedMemory,this._cacheMemory+=s.usedMemory,e&&s.obb&&r.push(s.obb),s.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,!1)}),this._memCache.put(Qe(i),s)}else this._dbg(3,`Tried to mark Non existent object ${i} as not loaded`)}o&&this._visibleGeometryChanged(),this._elevationProvider.notifyObjectsChanged(r),n&&this._setVisibleElevationRangeDirty()}setLodPixelThreshold(e){this._wasm?.setLodPixelThreshold(this,e)}_isVisibileElevationRangeModifiedByChangedTileVisbility(e,t){const{visibleElevationRange:i}=this,{minElevation:s,maxElevation:r}=t;return e?s<i.minElevation||r>i.maxElevation:s===i.minElevation||r===i.maxElevation}_getTexture(e,t,i){const s=e&&t.desc?.images?.[e.imageId];if(!s||!t.data?.buffer)return null;const r=i.get(s)??this._createTexture(e,t,i);return r?new Ee(this._stage.renderView.textures,r.id):null}_createTexture(e,t,i){const s=e&&t.desc?.images?.[e.imageId];if(!s||!t.data?.buffer)return null;const r=this._stage,{renderView:o}=r,n=o.renderingContext.parameters.maxMaxAnisotropy,a=!!s.mipCount||n>1,l=me[e.wrapMode??"None"];let d=s.alpha?6408:6407;const c=new Uint8Array(t.data.buffer,s.data.byteOffset,s.data.byteCount);let h=null,u=null,m=null;switch(s.format){case"Raw":"R8"===s.pixelFormat?(h=c,d=6403,u=""):"Rgb8"===s.pixelFormat?(h=c,d=6407,u=""):"Rgba8"===s.pixelFormat&&(h=c,d=6408,u="");break;case"Dxt1":h=c,d=6407,u="image/vnd-ms.dds";break;case"Dxt5":h=c,d=6408,u="image/vnd-ms.dds";break;case"Basis":h=c,d=6407,u="image/ktx2";break;case"Png":u="image/png",m=document.createElement("img");break;case"Jpeg":u="image/jpeg",m=document.createElement("img");break;case"Etc2":u="image/ktx",m=document.createElement("img");break;case"Astc":this._dbg(3,"Astc texture not supported");break;case"Pvrtc":this._dbg(3,"Pvrtc texture not supported")}if(m&&u){const e=new Blob([c],{type:u});m.src=URL.createObjectURL(e),h=m}if(h&&null!=u){const e=has("enable-feature:esri-compress-IM-textures")?{compressionTracker:this._compressionTracker}:void 0,t=new Me(h,{mipmap:a,maxAnisotropy:n,encoding:u,wrap:l,pixelFormat:d,compressionOptions:e,noUnpackFlip:!0,width:s.mip0Width,height:s.mip0Height});return this._stage.addTexture(t),i.set(s,t),t}return null}getBufferViews(e,t,i){let s,r,o,n,a,l,d,c=null;for(let u=0;u<e.atrbs.length;u++){const d=e.atrbs[u],{view:m}=d,p=void 0,f=m.byteOffset+m.byteCount,b=m.byteCount/pe[m.type],y=F(b);try{switch(d.sem){case"Position":3!==m.ncomp||"F32"!==m.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Position ("+m+")"):(s=new q(t,m.byteOffset,p,f),r=new Oe(s.typedBuffer,y,3));break;case"Normal":if(3!==m.ncomp||"F32"!==m.type)this._dbg(3,"[Unsupported Feature] Unsupported view for Normal ("+m+")");else{const e=new q(t,m.byteOffset,p,f),s=Ve(e.typedBuffer,i);a=new J(s.buffer),l=new Oe(a.typedBuffer,y,2)}break;case"TexCoord":2!==m.ncomp||"F32"!==m.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Texcoord ("+m+")"):void 0===n&&(n=new Oe(new Q(t,m.byteOffset,p,f).typedBuffer,y,2));break;case"Color":4===m.ncomp?("F32"===m.type&&(c=new G(t,m.byteOffset,p,f)),"U8"===m.type&&(c=new z(t,m.byteOffset,p,f)),"U16"===m.type&&(c=new N(t,m.byteOffset,p,f))):3===m.ncomp&&("F32"===m.type&&(c=new q(t,m.byteOffset,p,f)),"U8"===m.type&&(c=new W(t,m.byteOffset,p,f)),"U16"===m.type&&(c=new $(t,m.byteOffset,p,f))),null==c?this._dbg(2,"[Unsupported Feature] Unsupported view for Color ("+m+")"):o=new Oe(c.typedBuffer,y,m.ncomp);break;case"FeatureIndex":break;default:this._dbg(2,"[Unsupported Feature] Unsupported semantic ("+d.sem+"). Skipping vertex attribute.")}}catch(h){this._dbg(2,"Error Creating buffer ("+h+"). Skipping vertex attribute.")}}if(e.index){const i=e.index.view,s=void 0,r=i.byteOffset+i.byteCount;switch(e.index.view.type){case"U16":d=new X(t,i.byteOffset,s,r);break;case"U32":d=new Z(t,i.byteOffset,s,r);break;default:this._dbg(3,"[Unsupported Feature] index type not supported ("+i.type+").")}}if(null==d&&null!=s){const e=s.count;d=d=e<65535?new X(new Uint16Array(e).buffer):new Z(new Uint32Array(e).buffer);for(let t=0;t<e;t++)d.set(t,t)}return{positionView:s,positionAttr:r,colorAttr:o,texCoord0Attr:n,indicesView:d,normalsView:a,normalsAttr:l}}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>{this._modifications=e.filter(e=>!(this.layer.isUsedAsGroundLayer&&"replace"!==e.type)).toArray(),this._modifications.length<e.length&&t.getLogger(this).info("Ground layers only support replace modifications. Other modification types have been ignored.")},o),"modifications")}_deletePerObjectData(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,i){this._dbgFlags.has(e)&&(3===e?t.getLogger(this).error(i):t.getLogger(this).warn(i))}};e([d()],Be.prototype,"fullOpacity",null),e([d({readOnly:!0})],Be.prototype,"ready",null),e([d({type:[K]})],Be.prototype,"_modifications",void 0),e([d()],Be.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([d()],Be.prototype,"layer",void 0),e([d({readOnly:!0})],Be.prototype,"visibleAtCurrentScale",null),e([d({readOnly:!0})],Be.prototype,"_collection",null),e([d()],Be.prototype,"elevationOffset",null),e([d({readOnly:!0})],Be.prototype,"visibleElevationRange",null),Be=e([c("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],Be);const Ge=Be;class ze{constructor(e,t,i,s,r,o,n,a,l,d){this.handle=e,this.componentObjects=t,this.textures=i,this.cpuMemoryUsage=s,this.vboMemoryUsage=r,this.textureMemoryUsage=o,this.obb=n,this.stableNodeId=a,this.nodeDepth=l,this.elevationRange=d,this.bvhIntersectionGeneration=0,this.isLoaded=!1,this.isVisible=!1;const c=T();n?.getCenter(c),this._obbCenterX=c[0],this._obbCenterY=c[1],this._obbCenterZ=c[2];const h=n?.radius??-1;this._obbRadius=h,this._obbRadiusSquared=h*h;const u=n?.halfSize;this._obbShortestHalfsize=u?Math.min(u[0],u[1],u[2]):0,this._mbsCenter=n?E(n.center):O}get usedMemory(){return this.textureMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage}get mbsRadius(){return this._obbRadius}get mbsCenter(){return this._mbsCenter}boundingVolumeIntersectsRay(e,t){if(!this.obb)return!0;const{_obbCenterX:i,_obbCenterY:s,_obbCenterZ:r}=this,o=i-e[0],n=s-e[1],a=r-e[2],l=o*t[0]+n*t[1]+a*t[2];return o*o+n*n+a*a-l*l<=this._obbRadiusSquared&&this.obb.intersectRay(e,t)}boundingVolumeIntersectsSphere(e){const t=this._obbRadius;if(t<0)return!0;const i=e.center,s=e.radius,r=t+s,o=this._obbCenterX-i[0];if(o>r)return!1;const n=this._obbCenterY-i[1];if(n>r)return!1;const a=this._obbCenterZ-i[2];if(a>r)return!1;const l=o*o+n*n+a*a;if(l>r*r)return!1;if(l<=(this._obbShortestHalfsize+s)**2)return!0;return Math.sqrt(l)+t<=s||(this.obb?.intersectSphere(e)??!0)}}function Ne(e){return Math.round(e/1048.576)/1e3}const qe=T();function We(e,t){const i=ve(e);return C(qe,i.center,t),i.center=qe,i}function $e(e){return new _e(e.center,e.halfSize,y(...e.quaternion))}function Qe(e){return`${e}`}function Je(e,t,i,s){const{origin:r,ellipsoidRadius:o,isGlobal:n,ecefRotation:a}=e,{texCoord0Attr:l,colorAttr:d,normalsAttr:c}=t,{positionView:h,tileObb:u,obbHalfSizeAccumulator:p,elevationRange:b}=s,y=i.getField("position",q),g=y.typedBuffer,_=y.typedBufferStride,v=l?.data,w=null!=l?i.getField("uv0",Q):null,C=w?.typedBuffer,T=w?.typedBufferStride??0,x=d?.data,R=d?.size??0,E=null!=d?i.getField("color",z):null,M=E?.typedBuffer,V=E?.typedBufferStride??0,S=c?.data,U=null!=c?i.getField("normalCompressed",Y):null,A=U?.typedBuffer,H=U?.typedBufferStride??0,L=null!=u?m(Xe,u.quaternionConjugate):f,k=j(Ze,u?.center??O,L),P=L[0],I=L[1],D=L[2],F=L[3],B=L[4],G=L[5],N=L[6],W=L[7],$=L[8],J=k[0],Z=k[1],X=k[2],K=a[0],ee=a[1],te=a[2],ie=a[3],se=a[4],re=a[5],oe=a[6],ne=a[7],ae=a[8],le=a!==f,de=r[0],ce=r[1],he=r[2],ue=h.count,me=h.typedBufferStride,pe=h.typedBuffer,fe=null!=C&&null!=v,be=null!=M&&null!=x&&(3===R||4===R),ye=4===R,ge=null!=A&&null!=S,_e=null!=p;let ve=_e?p[0]:0,we=_e?p[1]:0,je=_e?p[2]:0;for(let m=0;m<ue;++m){const e=m*me,t=pe[e],i=pe[e+1],s=pe[e+2],r=t+de,a=i+ce,l=s+he,d=n?Math.sqrt(r*r+a*a+l*l)-o:l;if(b.expandElevationRangeValues(d,d),_e){const e=Math.abs(r*P+a*F+l*N-J),t=Math.abs(r*I+a*B+l*W-Z),i=Math.abs(r*D+a*G+l*$-X);ve=Math.max(ve,e),we=Math.max(we,t),je=Math.max(je,i)}const c=m*_;if(le){const r=t*K+i*ie+s*oe,o=t*ee+i*se+s*ne,n=t*te+i*re+s*ae;pe[e]=r,pe[e+1]=o,pe[e+2]=n,g[c]=r,g[c+1]=o,g[c+2]=n}else g[c]=t,g[c+1]=i,g[c+2]=s;if(fe){const e=2*m,t=m*T;C[t]=v[e],C[t+1]=v[e+1]}if(be){const e=m*V;if(ye){const t=4*m;M[e]=x[t],M[e+1]=x[t+1],M[e+2]=x[t+2],M[e+3]=x[t+3]}else{const t=3*m;M[e]=x[t],M[e+1]=x[t+1],M[e+2]=x[t+2],M[e+3]=255}}if(ge){const e=2*m,t=m*H;A[t]=S[e],A[t+1]=S[e+1]}}u&&_e&&(p[0]=ve,p[1]=we,p[2]=je,u.setHalfSize(ve,we,je))}const Ze=T(),Xe=p();export{Ge as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import has from"../../../core/has.js";import t from"../../../core/Logger.js";import{destroyMaybe as i,removeMaybe as r}from"../../../core/maybe.js";import{throwIfAborted as s}from"../../../core/promiseUtils.js";import{initial as o,watch as n,when as a}from"../../../core/reactiveUtils.js";import{schedule as l}from"../../../core/scheduling.js";import{property as d,subclass as c}from"../../../core/accessorSupport/decorators.js";import{fromMat4 as h,invert as u,fromQuat as m}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as p,IDENTITY as f}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as b}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as y}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{normalize as g,sub as _,dot as v,set as w,transformMat3 as x,add as j}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as T,freeze as C,clone as M,fromValues as R,ZEROS as E}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{clone as O,fromValues as U,ONES as V}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMoon as S,isMars as A,getReferenceEllipsoid as H,SphericalECEFSpatialReferenceLike as P}from"../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as L}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as k}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as I}from"../../../geometry/projection/projectVectorToVector.js";import{create as D}from"../../../geometry/support/aaBoundingRect.js";import{getContinuousIndexArray as F}from"../../../geometry/support/Indices.js";import{isCGCS2000 as B}from"../../../geometry/support/spatialReferenceUtils.js";import{BufferViewVec4f as G,BufferViewVec4u8 as z,BufferViewVec4u16 as N,BufferViewVec3f as q,BufferViewVec3u8 as W,BufferViewVec3u16 as $,BufferViewVec2f as Q,BufferViewInt16 as Z,BufferViewUint32 as J,BufferViewUint16 as X,BufferViewVec2i16 as Y}from"../../../geometry/support/buffer/BufferView.js";import K from"../../../layers/support/SceneModification.js";import{getElevationOffsetInMeters as ee}from"../../../support/elevationInfoUtils.js";import{addNormals as te}from"./IntegratedMeshNormals.js";import{LayerView3D as ie}from"./LayerView3D.js";import{Lyr3DViewPerformanceInfo as re}from"./Lyr3DViewPerformanceInfo.js";import{addLayerViewToWasm as se,removeLayerViewFromWasm as oe,getLyr3DWasm as ne}from"./Lyr3DWasm.js";import{toWasmModification as ae}from"./SceneLayerWorkerHandle.js";import{LayerElevationProvider as le}from"./i3s/LayerElevationProvider.js";import{IntegratedMesh3DTilesLayerView3DSymbol as de}from"./support/integratedMesh3DTilesLayerViewInstanceUtils.js";import{primTypeConversion as ce,alphaModeConversion as he,faceCullingConversion as ue,wrapModeConversion as me,lyr3DTypeToByteSize as pe}from"./support/lyr3dTypeConversions.js";import{Tiles3DMeshIntersectionHandler as fe}from"./support/Tiles3DMeshIntersectionHandler.js";import{Frustum as be}from"../state/Frustum.js";import{ElevationRange as ye}from"../support/ElevationRange.js";import{toBoundingRect as ge}from"../support/extentUtils.js";import{Obb as _e,compute as ve}from"../support/orientedBoundingBox.js";import{glLayout as we}from"../support/buffer/glUtil.js";import{VertexBufferLayoutCreationParameters as xe,createVertexBufferLayout as je,ComponentGeometryParameters as Te,SourceGeometry as Ce}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as Me}from"../webgl-engine/collections/Component/Transform.js";import{RenderTexture as Re}from"../webgl-engine/core/material/RenderTexture.js";import{Attribute as Ee}from"../webgl-engine/lib/Attribute.js";import{ManagedTexture as Oe}from"../webgl-engine/lib/ManagedTexture.js";import{compressAndTransformNormals as Ue}from"../webgl-engine/lib/Normals.js";import{advancedMRRFactors as Ve}from"../webgl-engine/materials/pbrUtils.js";import Se from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as Ae,isInEffectiveScaleRange as He,validateScaleRange as Pe}from"../../support/layerViewUtils.js";import{PromiseQueue as Le}from"../../support/PromiseQueue.js";import{TaskPriority as ke}from"../../support/Scheduler.js";import{TextureCompressionTracker as Ie}from"../../support/TextureCompressionTracker.js";import{alphaCutoff as De}from"../../../webscene/support/AlphaCutoff.js";var Fe;let Be=class extends(ie(Se)){static{Fe=de}constructor(e){super(e),this[Fe]=!0,this.type="integrated-mesh-3dtiles",this._modifications=new Array,this._visibleGeometryChangedSchedulerHandle=null,this._wasmLayerId=-1,this.ignoresMemoryFactor=!1,this._usedMemory=0,this._cacheMemory=0,this.drapeTargetType=1,this._replacesTerrain=!1,this._isUsedAsGroundLayer=!1,this._applySSAO=!has("disable-feature:im-ssao"),this._imShading=!!has("enable-feature:im-shading"),this._imVertexNormals=!!has("enable-feature:im-vertex-normals"),this._lyrHandleToObjects=new Map,this._visibleObjects=new Set,this._loadedObjects=new Set,this._compressionTracker=new Ie,this._createRenderableQueue=new Le,this._dbgFlags=new Set;const t=e.view.resourceController;this._memCache=t.memoryController.newCache(`IM3DTiles-${this.uid}`,e=>this._deletePerObjectData(e)),this._replacesTerrain=e.layer.replacesTerrain,this._isUsedAsGroundLayer=e.layer.isUsedAsGroundLayer,this._frameTask=t.scheduler.registerTask(ke.TILES3D,this),this._frustum=new be(e.view.renderCoordsHelper)}tryRecycleWith(e,t){return this.canRecycleWith(e)?e.load(t).then(()=>{s(t);const i=this.layer.queryElevationCallback;this.layer=e,this.layer.queryElevationCallback=i}):null}canRecycleWith(e){return e.url===this.layer.url&&"integrated-mesh-3dtiles"===e.type&&e.replacesTerrain===this._replacesTerrain&&e.isUsedAsGroundLayer===this._isUsedAsGroundLayer}initialize(){this._dbg(2,"Tiles3DLayerView3D initialize() called");const{view:e}=this;if(this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),o),!this._canProjectWithoutEngine())throw Ae("layer",this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);const t=se(this).then(t=>{this._wasmLayerId=t,this._intersectionHandler=new fe(this),e.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged()),this._updatingHandles.add(()=>this.fullOpacity,()=>this._opacityChange()),this._updatingHandles.add(()=>e.clippingArea,()=>this._clippingAreaChanged(),o),this._updatingHandles.add(()=>e.state.contentCamera,()=>this._cameraChanged(),o),this._elevationProvider=new le({view:e,layerElevationSource:this,intersectionHandler:this._intersectionHandler});const i=this._replacesTerrain?0:1;e.elevationProvider.register(i,this._elevationProvider),e.overlayManager.registerDrapeTarget(this),this.addHandles([n(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),a(()=>this.fullOpacity,()=>this._opacityChange()),n(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),o)])});this.layer.queryElevationCallback=(e,t)=>this._wasm.queryElevation(this,e,t),this.addResolvingPromise(t)}destroy(){this._dbg(2,"Tiles3DLayerView3D destroy() called"),oe(this),this.layer.queryElevationCallback=null,this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler.destroy(),this._intersectionHandler=null),this._elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(e=>this.forEachComponentObject(t=>e(t.obb))),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this.view.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach(e=>this.freeObject(e)),this._lyrHandleToObjects.clear(),this._visibleObjects.clear(),this._loadedObjects.clear(),this._usedMemory=0,this._cacheMemory=0,this._memCache.destroy(),this._createRenderableQueue.destroy(),this.notifyChange("readyToRun"),this._frameTask.remove(),this._updatingHandles=i(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=r(this._visibleGeometryChangedSchedulerHandle)}get fullOpacity(){return this.layer.replacesTerrain?this.view.map.ground.opacity:1}get hasModifications(){return this._modifications&&this._modifications.length>0}_opacityChange(){const{fullOpacity:e}=this;this.forEachComponentObject(t=>this._collection.updateObjectOpacity(t,e))}_cameraChanged(){const e=this._frustum;e.update(this.view.state.contentCamera);const t=this._visibleObjects;let i=!1;this._loadedObjects.forEach(r=>{const s=r.obb?.intersectsFrustum(e)??!1;s!==r.isVisible&&(r.isVisible=s,s?t.add(r):t.delete(r),r.componentObjects.forEach(e=>this._collection.setObjectVisibility(e,s)),i||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(s,r.elevationRange))}),i&&this._setVisibleElevationRangeDirty()}intersect(e,t,i,r){this._intersectionHandler.intersect(e,t,i,r,null,!1)}get ready(){return!this.layer.replacesTerrain||!!this._wasm?.isTerrainReady}_modificationsChanged(){const e=this.layer.spatialReference,t=ae(this._layerClippingArea,this._modifications,e);this._wasm?.setMeshModifications(this,t)}_clippingAreaChanged(){const e=this.layer.spatialReference,t=D();this._layerClippingArea=ge(this.view.clippingArea,t,e)?t:null,this._modificationsChanged()}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=l(()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e&&!this.layer.replacesTerrain),this.forEachComponentObject(t=>t.updateMaterial({slicePlaneEnabled:e}))}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,ee(e))}get _wasm(){return ne(this.view)}get wasmLayerId(){return this._wasmLayerId}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get visibleAtCurrentScale(){return this.layer.isUsedAsGroundLayer||He(this.layer.effectiveScaleRange,this.view.scale)}canResume(){const e=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return this.visible&&this.layer?.loaded&&this.parent&&!this.parent.suspended&&this.view?.ready&&(this.layer.isUsedAsGroundLayer||Pe(e)&&this.visibleAtCurrentScale)&&this.visibleAtCurrentTimeExtent||!1}get performanceInfo(){let e=0,t=0,i=0,r=0,s=0,o=0;return this._lyrHandleToObjects.forEach(n=>{n.isLoaded?(e+=n.textureMemoryUsage,t+=n.vboMemoryUsage,s++):(i+=n.textureMemoryUsage,r+=n.vboMemoryUsage,o++)}),new re(this.usedMemory,s,o,Ne(t),Ne(e),Ne(r),Ne(i))}_canProjectWithoutEngine(){if(this.view.state.isLocal){const e=this.view.renderSpatialReference?.isWebMercator?3857:this.view.renderSpatialReference?.wkid??-1;if(3857!==e&&32662!==e)return!1}return!0}get _stage(){return this.view.stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return ee(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new ye(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get visibleElevationRange(){const e=new ye;0===this._visibleObjects.size?e.setElevationRangeValues(0,0):(e.setElevationRangeValues(1/0,-1/0),this._forEachRelevantVisibleTile(t=>e.expandElevationRange(t.elevationRange)),e.minElevation===1/0&&e.setElevationRangeValues(0,0));const t=this._get("visibleElevationRange");return t&&t.minElevation===e.minElevation&&t.maxElevation===e.maxElevation?t:e}_setVisibleElevationRangeDirty(){this.notifyChange("visibleElevationRange")}_forEachRelevantVisibleTile(e){const{view:t}=this,{spatialReference:i}=t,r=i.isWGS84||i.isWebMercator||B(i)||S(i)||A(i);if(this.view.state.isGlobal||!r)return this.forEachVisibleTile(e);const s=H(i).radius,{eye:o,viewForward:n,near:a}=t.state.camera,l=g(T(),n),d=500,c=Math.max(o[2],d),h=c+s,u=Math.sqrt(h**2-s**2),m=Math.abs(Math.atan2(u,s))*s,p=c>.5*s?.5*Math.PI*s:m,f=T();this.forEachVisibleTile(t=>{const{mbsRadius:i,mbsCenter:r}=t;if(i<0)return;_(f,r,o);const s=v(f,l);Math.abs(s)<p&&s+i>a&&s-i<p&&e(t)})}get fullExtent(){return this.layer.fullExtent}forEachComponentObject(e){this._forEachObject(this._lyrHandleToObjects.values(),e)}forEachVisibleTile(e){for(const t of this._visibleObjects)e(t)}forEachTile(e){for(const t of this._loadedObjects)e(t)}forEachVisibleComponentObject(e){this._forEachObject(this._visibleObjects,e)}_forEachObject(e,t){for(const{componentObjects:i}of e)for(const e of i)t(e)}isUpdating(){const e=this._wasm;return this._wasmLayerId>=0&&null!=e&&(e.isUpdating(this._wasmLayerId)||this._compressionTracker.compressing)}get readyToRun(){return!!this._frameTask?.readyToRun||this._createRenderableQueue.readyToRun}runTask(e){this._frameTask.processQueue(e),this._createRenderableQueue.runTask(e),this.notifyChange("readyToRun")}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable called after destroy");return this._createRenderable(e)}async _createRenderable(e){if(this.destroyed){const e=`IntegratedMesh3DTilesLayerView3D[${this.layer?.title}]: createRenderable called on destroyed instance`;throw this._dbg(3,e),new Error(e)}const{meshData:t}=e;if(null==t.data)throw new Error("meshData.data undefined");if("string"==typeof t.desc&&(t.desc=JSON.parse(t.desc)),null==t.desc)throw new Error("meshData.desc undefined");const i=t.desc,r=t.data.buffer,s={textureMemoryUsage:0},o=new Map,n=i.prims.length,a=i.materials,l=e=>this._getTexture(e,t,o,s);let d;try{d=this._createPrimitiveTextureBundles(n,i,a,l)}catch(u){throw o.forEach(e=>this._stage.removeTexture(e)),u}const c=new Array,h=new ye;try{const t=this._createRenderableQueue.push(()=>this._createRenderableMain(i,r,n,a,d,o,c,h),null);this.notifyChange("readyToRun");const l=await t;if(this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable aborted due to destroyed instance");if(await Promise.all(d.map(e=>e.materialPromise)),this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable aborted due to destroyed instance");for(const e of l.textureMemoryUsageEvaluators)s.textureMemoryUsage+=e();const u=new ze(e.handle,c,l.textures,l.cpuMemoryUsage,l.vboMemoryUsage,s.textureMemoryUsage,l.tileObb,e.stableNodeId,e.nodeDepth,h);this._lyrHandleToObjects.set(e.handle,u),this._memCache.put(Qe(u.handle),u);const{usedMemory:m}=u;return this._cacheMemory+=m,{memUsageBytes:m}}catch(u){throw d.forEach(e=>e.cleanup()),c.forEach(e=>this._collection.destroyObject(e)),o.forEach(e=>this._stage.removeTexture(e)),u}}_createPrimitiveTextureBundles(e,t,i,r){const s=new Array;try{for(let o=0;o<e;o++){const e=t.prims[o],n=i&&null!=e.materialId?i[e.materialId]:null;let a=Promise.resolve(Ze),l=null,d=null,c=null,h=null,u=null;if(n){const e="Pbr"===n.lightingModel;l=r(n.baseColorTex),d=e?r(n.metalTex):null,c=e?r(n.emissiveTex):null,h=e?r(n.occlusionTex):null,u=e?r(n.normalTex):null;const t=[l,d,c,h,u].map(e=>e?.loadPromise??null);a=Promise.all(t)}s.push({materialPromise:a,baseColorTexture:l,metallicRoughnessTexture:d,emissionTexture:c,occlusionTexture:h,normalTexture:u,cleanup:()=>{l?.dispose(),d?.dispose(),c?.dispose(),h?.dispose(),u?.dispose()}})}}catch(o){throw s.forEach(e=>e.cleanup()),o}return s}_createRenderableMain(e,t,i,r,s,o,n,a){let l=0;const d=C(...e.origin),c=this.view.basemapTerrain.spatialReference,m=this.view.state.isGlobal;let y=f;if(m){const e=b();L(P,d,e,c),y=h(p(),e)}if(null==e.obb)throw new Error("meshData.desc.obb undefined");const g=$e(e.obb),_=m?H(this.view.spatialReference).radius:0,v=y!==f,x=v?u(p(),y)??f:f,j=T(),E=new Array;for(let h=0;h<i;h++){const i=e.prims[h],o=s[h];this._dbgFlags.has(2)&&this._dbg(2,JSON.stringify(i));if(null==ce[i.ptype]){this._dbg(2,"[Unsupported Feature] Unsupported primitive mode ("+i.ptype+"). Skipping primitive."),o.cleanup();continue}const u=r&&null!=i.materialId?r[i.materialId]:null,p=null!=u?u.lightingModel:"Unlit",{positionView:f,positionAttr:b,normalsView:C,normalsAttr:S,colorAttr:A,texCoord0Attr:H,indicesView:P}=this.getBufferViews(i,t,y);if(null==b||null==f||null==P){o.cleanup();continue}const L=f.count,D=(e,t)=>!e||e.data.length/e.size===L||(this._dbg(3,`${t} !== numPos. Skipping primitive.`),!1);if(!D(H,"numTexcoord")||!D(A,"numColors")||!D(S,"normals")){o.cleanup();continue}const F=new xe(null!=A,null!=C,H?1:0),B=je(F),G=B.createBuffer(L);Je({origin:d,ellipsoidRadius:_,isGlobal:m,ecefRotation:y},{texCoord0Attr:H,colorAttr:A,normalsAttr:S},G,{positionView:f,tileObb:g,obbHalfSizeAccumulator:j,elevationRange:a});const z=g?.clone()??We(b,d),N=new Uint32Array([0,P.typedBuffer.length]),q=we(B),W=this._imVertexNormals,$=te(new Uint8Array(G.buffer),P.typedBuffer,q,W,W?x:void 0),Q=new Te(q,this._imShading?2:0,F.textureCoordinateType,v?1:0,0),Z=new Ce({interleavedVertexData:$.data,vertexCount:$.data.byteLength/q[0].stride,indexData:$.indices},{positions:f.typedBuffer,indices:P.typedBuffer},N,Q),J=this.view.renderSpatialReference,X=T(),Y=[1,1,1];k(d,J,Y,c)||this._dbg(3,"Unsupported coordinate system for IM overlay"),I(d,J,X,c);let K=V,ee=De,ie=null,re=null,se=null,oe=null,ne=null,ae=1,le=!1,de=2,me=!1,pe=R(0,0,0);const fe=M(Ve),be="Pbr"===p;if(u&&(ie=o.baseColorTexture,ne=o.metallicRoughnessTexture,re=o.emissionTexture,oe=o.occlusionTexture,se=o.normalTexture,K=O(u.baseColorFactor),ee=u.alphaCutoff??De,be&&(w(fe,u.metallicFactor,u.roughnessFactor,0),u.emissiveFactor&&(pe=u.emissiveFactor)),ae=he[u.alphaMode],le=u.isDoubleSided,de=ue[u.faceCulling??"NotSet"],me=this.layer.replacesTerrain),this.destroyed){const e="Trying to add object to destroyed layer view";throw this._dbg(3,`${e} !== numPos. Skipping primitive.`),new Error(e)}ie||this._dbg(3,"No colour texture 1");const ye=this._collection.createObject({toMapSpace:U(X[0],X[1],Y[0],Y[1]),transform:new Me(d,x),obb:z,geometry:Z,elevationAlignable:!1},{isIntegratedMesh:!0,baseColor:K,textureAlphaCutoff:ee,mrrFactors:fe,baseColorTexture:ie,metallicRoughnessTexture:ne,normalTexture:se,occlusionTexture:oe,emissionTexture:re,hasParametersFromSource:!1,sphereDepthInterpolate:this.layer.hasGoogleUrl,alphaDiscardMode:ae,doubleSided:le,cullFace:de,isGround:me,emissiveBaseColor:pe,usePBR:be,slicePlaneEnabled:this.slicePlaneEnabled,opacity:this.fullOpacity,polygonOffset:0,ellipsoidMode:1,applySSAO:this._applySSAO});E.push(()=>{let e=ie?.texture?.usedMemory??0;return be&&(e+=(ne?.texture?.usedMemory??0)+(re?.texture?.usedMemory??0)+(oe?.texture?.usedMemory??0)+(se?.texture?.usedMemory??0)),e}),l+=this._collection.getObjectGPUMemoryUsage(ye),n.push(ye)}const S=Array.from(o.values()),{fullExtent:A}=this.layer;A?.hasZ&&A.zmax&&A.zmin&&(a.minElevation=Math.max(a.minElevation,A.zmin),a.maxElevation=Math.min(a.maxElevation,A.zmax));return{vboMemoryUsage:l,tileObb:g,textureMemoryUsageEvaluators:E,textures:S,cpuMemoryUsage:n.reduceRight((e,t)=>e+t.intersectionGeometry.usedMemory,0)}}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t?(t.isLoaded?(this._loadedObjects.delete(t),this._visibleObjects.delete(t),this._intersectionHandler.removeTile(t),this._usedMemory-=t.usedMemory):this._cacheMemory-=t.usedMemory,this.freeObject(t),this._lyrHandleToObjects.delete(e)):this._dbg(3,`freeRendedrable on non-existent renderable ${e}`)}freeObject(e){const t=Qe(e.handle);this._memCache.pop(t),e.textures.forEach(e=>this._stage.removeTexture(e)),e.componentObjects.forEach(e=>this._collection.destroyObject(e))}setRenderableVisibility(e,t,i){if(this.destroyed||this.destroying)return;const r=this._frustum,s=new Array;let o=!1,n=!1;for(let a=0;a<i;++a){if(!t[a])continue;const i=e[a],l=this._lyrHandleToObjects.get(i);if(l){if(l.isLoaded){this._dbg(3,`Already loaded object marked loaded again ${l.stableNodeId}`);continue}o=!0,l.isLoaded=!0,this._loadedObjects.add(l),this._intersectionHandler.addTile(l),this._usedMemory+=l.usedMemory,this._cacheMemory-=l.usedMemory;const e=l.obb?.intersectsFrustum(r)??!0;l.isVisible=e,e&&(this._visibleObjects.add(l),n||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(e,l.elevationRange)),e&&l.obb&&s.push(l.obb),l.componentObjects.forEach(t=>{this._collection.setObjectVisibility(t,e)}),this._memCache.pop(Qe(i))}else this._dbg(3,`Tried to mark Non existent object ${i} as loaded`)}for(let a=0;a<i;++a){const i=e[a];if(t[a])continue;const r=this._lyrHandleToObjects.get(i);if(r){if(!r.isLoaded){this._dbg(3,`Tried to unload not-loaded object ${r.stableNodeId}`);continue}const e=r.isVisible;this._visibleObjects.delete(r),r.isVisible=!1,r.isLoaded=!1,this._loadedObjects.delete(r),this._intersectionHandler.removeTile(r),e&&(this._visibleGeometryChanged(),n||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(!1,r.elevationRange)),this._usedMemory-=r.usedMemory,this._cacheMemory+=r.usedMemory,e&&r.obb&&s.push(r.obb),r.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,!1)}),this._memCache.put(Qe(i),r)}else this._dbg(3,`Tried to mark Non existent object ${i} as not loaded`)}o&&this._visibleGeometryChanged(),this._elevationProvider.notifyObjectsChanged(s),n&&this._setVisibleElevationRangeDirty()}setLodPixelThreshold(e){this._wasm?.setLodPixelThreshold(this,e)}_isVisibileElevationRangeModifiedByChangedTileVisbility(e,t){const{visibleElevationRange:i}=this,{minElevation:r,maxElevation:s}=t;return e?r<i.minElevation||s>i.maxElevation:r===i.minElevation||s===i.maxElevation}_getTexture(e,t,i,r){const s=e&&t.desc?.images?.[e.imageId];if(!s||!t.data?.buffer)return null;const o=i.get(s)??this._createTexture(e,t,i,r);return o?new Re(this._stage.renderView.textures,o.id):null}_createTexture(e,t,i,r){const s=e&&t.desc?.images?.[e.imageId];if(!s||!t.data?.buffer)return null;const o=this._stage,{renderView:n}=o,a=n.renderingContext.parameters.maxMaxAnisotropy,l=!!s.mipCount||a>1,d=me[e.wrapMode??"None"];let c=s.alpha?6408:6407;const h=new Uint8Array(t.data.buffer,s.data.byteOffset,s.data.byteCount);let u=null,m=null,p=null;switch(s.format){case"Raw":"R8"===s.pixelFormat?(u=h,c=6403,m=""):"Rgb8"===s.pixelFormat?(u=h,c=6407,m=""):"Rgba8"===s.pixelFormat&&(u=h,c=6408,m="");break;case"Dxt1":u=h,c=6407,m="image/vnd-ms.dds";break;case"Dxt5":u=h,c=6408,m="image/vnd-ms.dds";break;case"Basis":u=h,c=6407,m="image/ktx2";break;case"Png":m="image/png",p=document.createElement("img");break;case"Jpeg":m="image/jpeg",p=document.createElement("img");break;case"Etc2":m="image/ktx",p=document.createElement("img");break;case"Astc":this._dbg(3,"Astc texture not supported");break;case"Pvrtc":this._dbg(3,"Pvrtc texture not supported")}if(p&&m){const e=new Blob([h],{type:m});p.src=URL.createObjectURL(e),u=p}if(u&&null!=m){const e=has("enable-feature:esri-compress-IM-textures")?{compressionTracker:this._compressionTracker,compressionCallback:e=>{e&&e>0&&(r.textureMemoryUsage-=e)}}:void 0,t=new Oe(u,{mipmap:l,maxAnisotropy:a,encoding:m,wrap:d,pixelFormat:c,compressionOptions:e,noUnpackFlip:!0,width:s.mip0Width,height:s.mip0Height});return this._stage.addTexture(t),i.set(s,t),t}return null}getBufferViews(e,t,i){let r,s,o,n,a,l,d,c=null;for(let u=0;u<e.atrbs.length;u++){const d=e.atrbs[u],{view:m}=d,p=void 0,f=m.byteOffset+m.byteCount,b=m.byteCount/pe[m.type],y=F(b);try{switch(d.sem){case"Position":3!==m.ncomp||"F32"!==m.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Position ("+m+")"):(r=new q(t,m.byteOffset,p,f),s=new Ee(r.typedBuffer,y,3));break;case"Normal":if(3!==m.ncomp||"F32"!==m.type)this._dbg(3,"[Unsupported Feature] Unsupported view for Normal ("+m+")");else{const e=new q(t,m.byteOffset,p,f),r=Ue(e.typedBuffer,i);a=new Z(r.buffer),l=new Ee(a.typedBuffer,y,2)}break;case"TexCoord":2!==m.ncomp||"F32"!==m.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Texcoord ("+m+")"):void 0===n&&(n=new Ee(new Q(t,m.byteOffset,p,f).typedBuffer,y,2));break;case"Color":4===m.ncomp?("F32"===m.type&&(c=new G(t,m.byteOffset,p,f)),"U8"===m.type&&(c=new z(t,m.byteOffset,p,f)),"U16"===m.type&&(c=new N(t,m.byteOffset,p,f))):3===m.ncomp&&("F32"===m.type&&(c=new q(t,m.byteOffset,p,f)),"U8"===m.type&&(c=new W(t,m.byteOffset,p,f)),"U16"===m.type&&(c=new $(t,m.byteOffset,p,f))),null==c?this._dbg(2,"[Unsupported Feature] Unsupported view for Color ("+m+")"):o=new Ee(c.typedBuffer,y,m.ncomp);break;case"FeatureIndex":break;default:this._dbg(2,"[Unsupported Feature] Unsupported semantic ("+d.sem+"). Skipping vertex attribute.")}}catch(h){this._dbg(2,"Error Creating buffer ("+h+"). Skipping vertex attribute.")}}if(e.index){const i=e.index.view,r=void 0,s=i.byteOffset+i.byteCount;switch(e.index.view.type){case"U16":d=new X(t,i.byteOffset,r,s);break;case"U32":d=new J(t,i.byteOffset,r,s);break;default:this._dbg(3,"[Unsupported Feature] index type not supported ("+i.type+").")}}if(null==d&&null!=r){const e=r.count;d=d=e<65535?new X(new Uint16Array(e).buffer):new J(new Uint32Array(e).buffer);for(let t=0;t<e;t++)d.set(t,t)}return{positionView:r,positionAttr:s,colorAttr:o,texCoord0Attr:n,indicesView:d,normalsView:a,normalsAttr:l}}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>{this._modifications=e.filter(e=>!(this.layer.isUsedAsGroundLayer&&"replace"!==e.type)).toArray(),this._modifications.length<e.length&&t.getLogger(this).info("Ground layers only support replace modifications. Other modification types have been ignored.")},o),"modifications")}_deletePerObjectData(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,i){this._dbgFlags.has(e)&&(3===e?t.getLogger(this).error(i):t.getLogger(this).warn(i))}};e([d()],Be.prototype,"fullOpacity",null),e([d({readOnly:!0})],Be.prototype,"ready",null),e([d({type:[K]})],Be.prototype,"_modifications",void 0),e([d()],Be.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([d()],Be.prototype,"layer",void 0),e([d({readOnly:!0})],Be.prototype,"visibleAtCurrentScale",null),e([d({readOnly:!0})],Be.prototype,"_collection",null),e([d()],Be.prototype,"elevationOffset",null),e([d({readOnly:!0})],Be.prototype,"visibleElevationRange",null),Be=e([c("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],Be);const Ge=Be;class ze{constructor(e,t,i,r,s,o,n,a,l,d){this.handle=e,this.componentObjects=t,this.textures=i,this.cpuMemoryUsage=r,this.vboMemoryUsage=s,this.textureMemoryUsage=o,this.obb=n,this.stableNodeId=a,this.nodeDepth=l,this.elevationRange=d,this.bvhIntersectionGeneration=0,this.isLoaded=!1,this.isVisible=!1;const c=T();n?.getCenter(c),this._obbCenterX=c[0],this._obbCenterY=c[1],this._obbCenterZ=c[2];const h=n?.radius??-1;this._obbRadius=h,this._obbRadiusSquared=h*h;const u=n?.halfSize;this._obbShortestHalfsize=u?Math.min(u[0],u[1],u[2]):0,this._mbsCenter=n?M(n.center):E}get usedMemory(){return this.textureMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage}get mbsRadius(){return this._obbRadius}get mbsCenter(){return this._mbsCenter}boundingVolumeIntersectsRay(e,t){if(!this.obb)return!0;const{_obbCenterX:i,_obbCenterY:r,_obbCenterZ:s}=this,o=i-e[0],n=r-e[1],a=s-e[2],l=o*t[0]+n*t[1]+a*t[2];return o*o+n*n+a*a-l*l<=this._obbRadiusSquared&&this.obb.intersectRay(e,t)}boundingVolumeIntersectsSphere(e){const t=this._obbRadius;if(t<0)return!0;const i=e.center,r=e.radius,s=t+r,o=this._obbCenterX-i[0];if(o>s)return!1;const n=this._obbCenterY-i[1];if(n>s)return!1;const a=this._obbCenterZ-i[2];if(a>s)return!1;const l=o*o+n*n+a*a;if(l>s*s)return!1;if(l<=(this._obbShortestHalfsize+r)**2)return!0;return Math.sqrt(l)+t<=r||(this.obb?.intersectSphere(e)??!0)}}function Ne(e){return Math.round(e/1048.576)/1e3}const qe=T();function We(e,t){const i=ve(e);return j(qe,i.center,t),i.center=qe,i}function $e(e){return new _e(e.center,e.halfSize,y(...e.quaternion))}function Qe(e){return`${e}`}const Ze=new Array;function Je(e,t,i,r){const{origin:s,ellipsoidRadius:o,isGlobal:n,ecefRotation:a}=e,{texCoord0Attr:l,colorAttr:d,normalsAttr:c}=t,{positionView:h,tileObb:u,obbHalfSizeAccumulator:p,elevationRange:b}=r,y=i.getField("position",q),g=y.typedBuffer,_=y.typedBufferStride,v=l?.data,w=null!=l?i.getField("uv0",Q):null,j=w?.typedBuffer,T=w?.typedBufferStride??0,C=d?.data,M=d?.size??0,R=null!=d?i.getField("color",z):null,O=R?.typedBuffer,U=R?.typedBufferStride??0,V=c?.data,S=null!=c?i.getField("normalCompressed",Y):null,A=S?.typedBuffer,H=S?.typedBufferStride??0,P=null!=u?m(Ye,u.quaternionConjugate):f,L=x(Xe,u?.center??E,P),k=P[0],I=P[1],D=P[2],F=P[3],B=P[4],G=P[5],N=P[6],W=P[7],$=P[8],Z=L[0],J=L[1],X=L[2],K=a[0],ee=a[1],te=a[2],ie=a[3],re=a[4],se=a[5],oe=a[6],ne=a[7],ae=a[8],le=a!==f,de=s[0],ce=s[1],he=s[2],ue=h.count,me=h.typedBufferStride,pe=h.typedBuffer,fe=null!=j&&null!=v,be=null!=O&&null!=C&&(3===M||4===M),ye=4===M,ge=null!=A&&null!=V,_e=null!=p;let ve=_e?p[0]:0,we=_e?p[1]:0,xe=_e?p[2]:0;for(let m=0;m<ue;++m){const e=m*me,t=pe[e],i=pe[e+1],r=pe[e+2],s=t+de,a=i+ce,l=r+he,d=n?Math.sqrt(s*s+a*a+l*l)-o:l;if(b.expandElevationRangeValues(d,d),_e){const e=Math.abs(s*k+a*F+l*N-Z),t=Math.abs(s*I+a*B+l*W-J),i=Math.abs(s*D+a*G+l*$-X);ve=Math.max(ve,e),we=Math.max(we,t),xe=Math.max(xe,i)}const c=m*_;if(le){const s=t*K+i*ie+r*oe,o=t*ee+i*re+r*ne,n=t*te+i*se+r*ae;pe[e]=s,pe[e+1]=o,pe[e+2]=n,g[c]=s,g[c+1]=o,g[c+2]=n}else g[c]=t,g[c+1]=i,g[c+2]=r;if(fe){const e=2*m,t=m*T;j[t]=v[e],j[t+1]=v[e+1]}if(be){const e=m*U;if(ye){const t=4*m;O[e]=C[t],O[e+1]=C[t+1],O[e+2]=C[t+2],O[e+3]=C[t+3]}else{const t=3*m;O[e]=C[t],O[e+1]=C[t+1],O[e+2]=C[t+2],O[e+3]=255}}if(ge){const e=2*m,t=m*H;A[t]=V[e],A[t+1]=V[e+1]}}u&&_e&&(p[0]=ve,p[1]=we,p[2]=xe,u.setHalfSize(ve,we,xe))}const Xe=T(),Ye=p();export{Ge as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{result as e,createTask as t}from"../../../../core/asyncUtils.js";import r from"../../../../core/Error.js";import{clone as i}from"../../../../core/lang.js";import{abortMaybe as s,releaseMaybe as a}from"../../../../core/maybe.js";import{throwIfAbortError as o,throwIfAborted as n}from"../../../../core/promiseUtils.js";import{pt2px as l,px2pt as c}from"../../../../core/screenUtils.js";import{numericHash as h}from"../../../../core/string.js";import{dataComponents as u}from"../../../../core/urlUtils.js";import{fromValues as m,fromArray as d,create as p,ONES as _}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{ZEROS as f,fromValues as y,create as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as x,ZEROS as v}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{projectPointToVector as b}from"../../../../geometry/projection/projectPointToVector.js";import{containsPoint as S}from"../../../../geometry/support/aaBoundingBox.js";import P from"../../../../layers/support/FieldsIndex.js";import{createRendererExpression as z}from"../../../../support/ArcadeExpression.js";import{CIMSymbolHelper as w}from"../../../../symbols/cim/CIMSymbolHelper.js";import{evaluateValueOrFunction as C}from"../../../../symbols/cim/utils.js";import{scaleCIMSymbol as O}from"../../../../symbols/support/cimSymbolUtils.js";import{defaultIconPrimitive as M}from"../../../../symbols/support/primitives.js";import R from"../../../../symbols/support/Symbol3DAnchorPosition2D.js";import{getIconHref as I}from"../../../../symbols/support/utils.js";import{transparentUnit as j}from"./constants.js";import{perObjectElevationAligner as E}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as U,needsElevationUpdates2D as F}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as T}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as V}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as D}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as G}from"./graphicUtils.js";import{namedAnchorToHUDMaterialAnchorPos as A}from"./placementUtils.js";import{placePointOnGeometry as L,updateStageObjectGeometry as H,getLocalOriginForPoint as k,extendPointGraphicElevationContext as B,createStageObject as N}from"./pointUtils.js";import{hasTransparencyModeSymbol as $}from"./transparencyUtils.js";import{initFastSymbolUpdatesState as q,updateFastSymbolUpdatesState as J,evaluateModelTransformScale as Z,ConvertOptions as W}from"../support/FastSymbolUpdates.js";import{createTexture as K,requiresHalfTexelOffset as Q,defaultBoundingBox as X,defaultSymbolSizeRatio as Y,defaultTexSize as ee}from"../../support/engineContent/sdfPrimitives.js";import{drapedZ as te}from"../../terrain/OverlayRenderer.js";import{VerticalOffsetParameters as re}from"../../webgl-engine/core/shaderLibrary/attributes/VerticalOffset.glsl.js";import{createPointGeometry as ie}from"../../webgl-engine/lib/GeometryUtil.js";import{ManagedTexture as se}from"../../webgl-engine/lib/ManagedTexture.js";import{RenderGeometry as ae}from"../../webgl-engine/lib/RenderGeometry.js";import{HUDMaterial as oe}from"../../webgl-engine/materials/HUDMaterial.js";var ne;const le=y(0,0,1),ce=16,he=1.5,ue=[ee*Y,ee*Y];class me extends D{static{ne=$}static{this.PRIMITIVE_SIZE=ue}getCachedSize(){return{size:this._getIconSize()}}static{this.elevationModeChangeTypes={definedChanged:1,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,r,i){super(e,t,r,i,xe(t)),this._cimData=null,this._overrideHelperClass=null,this._arcadeInfo=null,this._cimSymbolMaterials=new Map,this._cimSymbolTextures=new Map,this._cimMaterialParametersInfo=null,this._cimScaleFactorOrFunction=null,this._size=[1,1],this._symbolTextureRatio=1,this._outlineSize=0,this._textureHandle=null,this._patchTask=null,this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!0},this[ne]=!0}async doLoad(e){this._validateOrThrow();const t=this._prepareMaterialParameters(),r=this._getPrimitive();if(null!=r)this._prepareResourcesPrimitive(t,r);else{const r=I(this.symbolLayer),i=_e(r);null!=i?await this._prepareResourcesCIM(t,JSON.parse(i),e):await this._prepareResourcesHref(t,r,e)}}_validateOrThrow(){if(this._drivenProperties.size)return;const e=G(this._getIconSize());if(e)throw new r("graphics3diconsymbollayer:invalid-size",e)}_getIconSize(){const e=this.symbolLayer,t=Math.round(null!=e.size?l(e.size):ce);return this._drivenProperties.size?Math.max(t,64):t}_generateTextureCIM(e,t){const r=this._overrideHelperClass;let s=this._cimData;if(r&&s&&s.symbol||this.logger.error("Can't create texture, CIM data is undefined"),s.primitiveOverrides){s=i(s);const a=s.primitiveOverrides;r.evaluateOverrides(a,e,this._arcadeInfo.geometryType,null,null,t.layer.fieldsIndex),r.applyOverrides(s.symbol,a)}const a=h(JSON.stringify(s));let o=this._cimSymbolTextures.get(a);if(o)return o;const n=this._context.sharedResources.cimSymbolRasterizer,l=this._context.renderer&&"dictionary"===this._context.renderer.type?this._context.renderer.fieldMap:null;l&&r.applyDictionaryTextOverrides(s.symbol,e,l,null);const c=null!=this._cimScaleFactorOrFunction?C(this._cimScaleFactorOrFunction,e):1;1!==c&&s.symbol&&O(s.symbol,c,!0);const u=w.getEnvelope(s,null,n.resourceManager);if(u?.width&&u.height){const e=u.x+u.width/2,t=u.y+u.height/2,r=n.rasterize({type:"cim",data:s},u.width,u.height,e,t,1,"esriGeometryPoint",0,null,this._context.graphicsCoreOwner.view.state.rasterPixelRatio),i=new R({x:-u.x/u.width-.5,y:(u.height+u.y)/u.height-.5});this._cimMaterialParametersInfo.anchorPosition=fe("relative",i),o=new se(r,{width:r?.width??1,height:r?.height??1,reloadable:!0})}else o=new se(new ImageData(1,1),{width:1,height:1,reloadable:!0});return this._cimSymbolTextures.set(a,o),this._context.stage.addTexture(o),o}_prepareMaterialParameters(){const{symbolLayer:e,symbol:t,_context:r,_drivenProperties:i,view:s}=this,a=this.symbolLayer.occludedVisibility?.mode??"hidden";return{anchorPosition:fe(e.anchor,e.anchorPosition),rotation:e.angle,hasRotation:0!==e.angle||i.rotation,hasVertexRotation:i.rotation,occludedFragmentOpacity:"hidden"!==a?s.state.ensureOccludedFragmentOpacity():void 0,hasSlicePlane:r.slicePlaneEnabled,verticalOffset:de(t)?new re(t.verticalOffset):void 0,screenSizePerspective:r.screenSizePerspectiveEnabled?s.screenSizePerspective.parameters:void 0}}_prepareResourcesPrimitive(e,t){const r=this._getOutlineSize();if(pe(t)&&0===r)throw new Error("Nothing to render");if(this._outlineSize=r,e.color=this._getFillColor(),e.outlineColor=this._getOutlineColor(),e.outlineSize=this._outlineSize,null!=this._context.sharedResources.textures){const r=this._context.sharedResources.textures.fromData(`${t}-icon`,()=>K(t));this._textureHandle=r,e.textureId=r.managedTexture.id}e.textureIsSignedDistanceField=!0,e.sampleSignedDistanceFieldTexelCenter=Q(t),e.distanceFieldBoundingBox=X;const i=this._getIconSize();this._size=[i,i],this._symbolTextureRatio=1/Y,e.size=m(i*this._symbolTextureRatio,i*this._symbolTextureRatio),this._createMaterial(e)}async _prepareResourcesHref(t,i,s){this._outlineSize=this._getOutlineSize(),t.color=this._getFillColor(),t.outlineColor=this._getOutlineColor(),t.outlineSize=this._outlineSize,t.textureIsSignedDistanceField=!1;const a=this._getIconSize(),n=a*this._context.graphicsCoreOwner.view.state.rasterPixelRatio;if(null!=this._context.sharedResources.textures){const l=await e(this._context.sharedResources.textures.fromUrl(i,n,{signal:s}));if(!1===l.ok){o(l.error);throw new r("graphics3diconsymbollayer:request-failed",`Failed to load (Request for icon resource failed: ${i})`)}this._textureHandle=l.value;const c=l.value.managedTexture;this._size=ye(c,a),t.size=d(this._size),t.textureId=c.id}this._createMaterial(t)}async _prepareResourcesCIM(e,t,r){const{OverrideHelper:i}=await import("../../../../symbols/cim/OverrideHelper.js");if(this._overrideHelperClass=i,this._cimData=t,!this._context.sharedResources.cimSymbolRasterizer){const e=(await import("../../../../symbols/cim/CIMSymbolRasterizer.js")).CIMSymbolRasterizer;n(r),this._context.sharedResources.cimSymbolRasterizer??=new e(this._context.renderCoordsHelper.spatialReference)}const s=this._context.sharedResources.cimSymbolRasterizer,a=[],o=t,l=o?.symbol;w.fetchResources(l,s.resourceManager,a,r),w.fetchFonts(l,s.resourceManager,a);const c=this._context.layer.fields?this._context.layer.fields.map(e=>e.toJSON()):[],h=this._context.renderCoordsHelper.spatialReference;if(this._arcadeInfo={spatialReference:h,fields:c,geometryType:"esriGeometryPoint"},o?.primitiveOverrides&&a.push(i.createRenderExpressions(o.primitiveOverrides,this._arcadeInfo)),a.length>0&&(await Promise.all(a),n(r)),this._context.renderer&&"dictionary"===this._context.renderer.type&&this._context.renderer.scaleExpression){const e=this._context.renderer;if(e.scaleExpression){const t=e.scaleExpression,r=await z(t,this._context.layer.spatialReference),{default:i}=await import("../../../2d/arcade/callExpressionWithFeature.js"),s=new P(c);this._cimScaleFactorOrFunction=(e,t,a)=>{const o=i(r,e,{$view:a},"esriGeometryPoint",s,t);return null!==o?o:1}}}n(r),this._cimMaterialParametersInfo=e,this._cimMaterialParametersInfo.color=this._getFillColor(),this._cimMaterialParametersInfo.outlineColor=[0,0,0,0],this._cimMaterialParametersInfo.outlineSize=0,this._cimMaterialParametersInfo.textureIsSignedDistanceField=!1}_getPrimitive(){return ge(this.symbolLayer)}_getOutlineSize(){let e=0;const t=this.symbolLayer;if(null!=t.outline?.size)return Math.max(l(t.outline.size),0);return e=pe(this._getPrimitive())?he:0,Math.max(e,0)}_getOutlineColor(){const e=this._getLayerOpacity(),t=this.symbolLayer,r=t?.outline?.color;if(null!=r){const t=r.toUnitRGB(),i=r.a*e;return[t[0],t[1],t[2],i]}return[0,0,0,0]}_getFillColor(){if(pe(this._getPrimitive()))return j;const e=null==this._getPrimitive(),t=this._materialColor;return this._getCombinedOpacityAndColor(t,{hasIntrinsicColor:e})}get _materialColor(){return this.symbolLayer.material?.color}get _fastVisualVariableFallbackColor(){const e=this._materialColor;if(null==e){return null==this._getPrimitive()?x:v}return e.toUnitRGBA()}_getFallbackSize(){const e=this._getIconSize(),{symbolLayer:{size:t}}=this;return(null!=t?Math.round(l(t)):ce)/e}_createMaterial(e){const t=this._context.spherical;if(this._cimData){this._fastUpdates=null;let r=e.textureId?this._cimSymbolMaterials.get(e.textureId):null;return r||(r=new oe(e,t),this._cimSymbolMaterials.set(e.textureId??0,r)),r}return this._fastUpdates=q(this._context.renderer,this._fastVisualVariableConvertOptions()),this._fastUpdates&&(e={...e,...this._fastUpdates.materialParameters}),e.hasVertexColor=this._drivenProperties.color&&!this._fastUpdates?.visualVariables.color||this._drivenProperties.opacity&&!this._fastUpdates?.visualVariables.opacity,e.hasVertexSize=this._drivenProperties.size&&!this._fastUpdates?.visualVariables.size,e.focusAreaStyle=null,this._materials[0]=new oe(e,t),this._materials[1]=new oe(e,t,!0),e.focusAreaStyle=this._context.focusAreaStyle,this._materials[2]=new oe(e,t),this._materials[3]=new oe(e,t,!0),this._materials[0]}_setDrapingDependentMaterialParameters(){this.draped&&(this._forEachMaterial(e=>{e.setParameters({verticalOffset:null,screenSizePerspective:null,hasSlicePlane:!1,shaderPolygonOffset:0,draped:this.draped})}),this.layerOpacityChanged())}destroy(){super.destroy(),this._patchTask=s(this._patchTask),this._materials.length=0,this._cimSymbolMaterials.clear(),this._cimSymbolTextures.forEach(e=>this._context.stage.removeTexture(e)),this._cimSymbolTextures.clear(),this._textureHandle=a(this._textureHandle)}_getScaleFactor({size:e},t){if(!this._drivenProperties.size)return 1;if(null==e)return this._getFallbackSize();const[r,i,s]=e.output;return"symbol-value"===r?1:"number"==typeof r&&isFinite(r)?l(r)/t:"number"==typeof s&&isFinite(s)?l(s)/t:1}_getDrivenRotation(e){return this._drivenProperties.rotation?e.heading?.output??0:null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry))return null;const r=L(t.geometry);if(null==r)return this.logger.warn(`unsupported geometry type for text symbol: ${t.geometry.type}`),null;let i;const s=this.view.focusAreasView?.containsGeometry(r)??!0;if(this._cimData){if(!this._cimData.symbol)return null;const r=this._context.graphicsCoreOwner.view.state.rasterPixelRatio,a=this._generateTextureCIM(t,e),o={textureId:a.id,focusAreaStyle:s?null:this._context.focusAreaStyle,size:m(a.parameters.width/r,a.parameters.height/r),...this._cimMaterialParametersInfo};i=this._createMaterial(o)}else i=this._materials[s?0:2];if(null==r)return this.logger.warn(`unsupported geometry type for icon symbol: ${t.geometry.type}`),null;const a=null==this._getPrimitive(),o=e.renderingInfo,n=this._hasDrivenColorOrOpacity?this._getDrivenUInt8Color(o,this._materialColor,a):null,l=this._getDrivenRotation(o);let c=null;if(!this._fastUpdates?.visualVariables.size){const e=this._size,t=e[0]>e[1]?e[0]:e[1];c=this._getScaleFactor(o,t)}const h=null!=c?m(c,c):null,u=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus("on-the-ground"===u.mode)&&this._setDrapingDependentMaterialParameters(),this.draped?this._createAsOverlay(o,r,i,n,l,h,t.uid):this._createAs3DShape(o,r,i,n,l,h,u,t.uid)}terrainTransparencyChanged(){return this.draped}layerOpacityChanged(){const e=this._getFillColor(),t=this._getOutlineColor();this._forEachMaterial(r=>{r.setParameters({color:e}),r.setParameters({outlineColor:t})})}layerScreenSizePerspectiveChanged(){const e=this._context.screenSizePerspectiveEnabled&&!this.draped?this.view.screenSizePerspective.parameters:null;this._forEachMaterial(t=>{t.setParameters({screenSizePerspective:e})})}updateTransparentMode(e,t){const r=e.stageObject.geometries[0]?.material,i=this._materials.indexOf(r)<2,s=t?i?1:3:i?0:2,a=this._materials[s];a&&a!==r&&e.updateMaterial(a)}updateGeometry(e,t){const r=e.geometry;if(this.draped||!r||!this._validateGeometry(r))return!1;const{elevationContext:i,stageObject:s}=t;if(i.mode!==this.getGeometryElevationMode(r))return!1;const a=L(r);if(!a)return!1;i.updateFeatureExpressionFeature(e,this._context.layer);const o=H(s,this._context,a,i);if(null==o)return!1;const n=k(this._context,a);return s.geometries[0].localOrigin===n&&(t.alignedSampledElevation=o,B(t,a,this._context.elevationProvider),!0)}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,s=U(me.elevationModeChangeTypes,r,i);if(1!==s)return s;const a=F(i)||"absolute-height"===i;return this.updateGraphics3DGraphicElevationInfo(e,t,()=>a)}slicePlaneEnabledChanged(){return this.draped||this._forEachMaterial(e=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})}),!0}physicalBasedRenderingChanged(){return!0}get pixelRatioChanged(){return null!=this._getPrimitive()}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return 0;if(!J(this._fastUpdates,t,this._fastVisualVariableConvertOptions()))return 0;{const e=this._fastUpdates;this._materials.forEach(t=>t?.setParameters(e.materialParameters))}}return 2}get needsUpdateFocus(){return!0}prepareSymbolLayerPatch(e){if(this._patchTask?.abort(),"partial"!==e.diff.type)return;const t=e.diff.diff;this._preparePatchResource(e,t),this._preparePatchRotation(e,t)}_preparePatchResource(i,l){if(!l.resource||"partial"!==l.resource.type)return;const c=l.resource.diff;if("complete"!==c?.href?.type)return;const h=c.href.newValue,{textures:u}=this._context.sharedResources;if(null==h||null==u||null!=_e(h))return;const m=this._getIconSize(),d=m*this._context.graphicsCoreOwner.view.state.pixelRatio;i.symbolLayerStatePatches.push(()=>{this._patchTask=s(this._patchTask),this._patchTask=t(t=>this._context.schedule(async(t,i)=>{const s=await e(u.fromUrl(h,d,{signal:i}));n(i);const l=!s.ok;if(l&&o(s.error),this._textureHandle=a(this._textureHandle),this._patchTask=null,l){this._forEachMaterial(e=>{e.visible=!1,e.setParameters({textureId:null})});const e=`Failed to load (Request for icon resource failed: ${h})`;return void this.logger.error(new r("graphics3diconsymbollayer:request-failed",e))}this._textureHandle=s.value;const c=s.value.managedTexture;this._size=ye(c,m),this._forEachMaterial(e=>{e.setParameters({textureId:c.id}),e.visible=!0})},t))}),delete c.href}_preparePatchRotation(e,t){if(!t.angle||"complete"!==t.angle.type)return;const r=t.angle.newValue??0,i=0!==r||this._drivenProperties.rotation;e.symbolLayerStatePatches.push(()=>{this._forEachMaterial(e=>e.setParameters({rotation:r,hasRotation:i}))}),delete t.angle}_defaultElevationInfoNoZ(){return ve}_createAs3DShape(e,t,r,i,s,a,o,n){const l=this.getFastUpdateAttrValues(e),c=this._context.layerViewUid,h=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:n,layerViewUid:c}),u=ie(r,{normal:le,color:i,rotation:s,size:a,centerOffset:f,groundDistance:1,featureAttribute:l,olidColor:h}),m=N(this._context,t,u,o,n);if(null==m)return null;const d=new V(this,m.object,null,E,o);return d.setOccludedVisibilityMode(this.symbolLayer.occludedVisibility?.mode),d.hiddenIfDeconflicted=!0,d.alignedSampledElevation=m.sampledElevation,d.needsElevationUpdates=F(o.mode)||"absolute-height"===o.mode,d.getScreenSize=this._createScreenSizeGetter(a,l),d.calculateRelativeScreenBounds=e=>r.calculateRelativeScreenBounds(d.getScreenSize(),1,e),B(d,t,this._context.elevationProvider),d}_createAsOverlay(e,t,r,i,s,a,o){r.renderPriority=this._renderPriority;const n=g();b(t,n,this._context.overlaySR),n[2]=te;const l=this._context.clippingExtent;if(null!=l&&!S(l,n))return null;const c=this.getFastUpdateAttrValues(e),h=this._context.layerViewUid,u=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:o,layerViewUid:h}),m=ie(r,{normal:le,position:n,color:i,rotation:s,size:a,featureAttribute:c,olidColor:u}),d=new ae(m,{layerViewUid:h,graphicUid:o}),p=new T(this,[d],null,this._context.drapeSourceRenderer);return p.getScreenSize=this._createScreenSizeGetter(a,c),p.calculateRelativeScreenBounds=e=>r.calculateRelativeScreenBounds(p.getScreenSize(),1,e),p}_createScreenSizeGetter(e,t){e??=_;const r=this._outlineSize+2;if(this._fastUpdates&&t){const i=e[0]*this._size[0],s=e[1]*this._size[1];return(e=p())=>{const[a,o]=Z(be,this._fastUpdates.materialParameters,t);return e[0]=a*i+r,e[1]=o*s+r,e}}const i=e[0]*this._size[0]+r,s=e[1]*this._size[1]+r;return(e=p())=>(e[0]=i,e[1]=s,e)}_fastVisualVariableConvertOptions(){const e=Math.max(this._size[0],this._size[1]),t=y(e,e,e),r=c(1),i=e*r,s=y(i,i,i),a=this._getFallbackSize();return new W({supports:{size:!0,color:!0,rotation:!0,opacity:!1},modelSize:t,symbolSize:s,unitInMeters:r,fallbackColor:this._fastVisualVariableFallbackColor,fallbackSize:y(a,a,a)})}_forEachMaterial(e){this._materials.forEach(e),this._cimSymbolMaterials.forEach(e)}test(){return{...super.test(),material:this._materials[0]}}}function de(e){return e&&"point-3d"===e.type&&e.hasVisibleVerticalOffset()}function pe(e){return null!=e&&("cross"===e||"x"===e)}function _e(e){const t=u(e);return"application/json"===t?.mediaType?t.data:void 0}function fe(e,t){return"relative"===e?m((t.x||0)+.5,.5-(t.y||0)):e in A?A[e]:A.center}function ye({parameters:e},t){const r=(e.width??1)/(e.height??1);return r>1?[t,Math.round(t/r)]:[Math.round(t*r),t]}function ge(e){return e.resource?.href?null:e.resource?.primitive??M}function xe(e){return 1===(e.material?.color?.a??0)&&null!=ge(e)}const ve={mode:"relative-to-ground",offset:0},be=g();export{me as Graphics3DIconSymbolLayer};
|
|
2
|
+
import{result as e,createTask as t}from"../../../../core/asyncUtils.js";import r from"../../../../core/Error.js";import{clone as i}from"../../../../core/lang.js";import{abortMaybe as s,releaseMaybe as a}from"../../../../core/maybe.js";import{throwIfAbortError as o,throwIfAborted as n}from"../../../../core/promiseUtils.js";import{pt2px as l,px2pt as c}from"../../../../core/screenUtils.js";import{numericHash as h}from"../../../../core/string.js";import{dataComponents as u}from"../../../../core/urlUtils.js";import{fromValues as m,fromArray as d,create as p,ONES as _}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{ZEROS as f,fromValues as y,create as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as x,ZEROS as v}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{projectPointToVector as b}from"../../../../geometry/projection/projectPointToVector.js";import{containsPoint as S}from"../../../../geometry/support/aaBoundingBox.js";import P from"../../../../layers/support/FieldsIndex.js";import{createRendererExpression as z}from"../../../../support/ArcadeExpression.js";import{CIMSymbolHelper as w}from"../../../../symbols/cim/CIMSymbolHelper.js";import{evaluateValueOrFunction as C}from"../../../../symbols/cim/utils.js";import{scaleCIMSymbol as O}from"../../../../symbols/support/cimSymbolUtils.js";import{defaultIconPrimitive as R}from"../../../../symbols/support/primitives.js";import M from"../../../../symbols/support/Symbol3DAnchorPosition2D.js";import{getIconHref as I}from"../../../../symbols/support/utils.js";import{transparentUnit as j}from"./constants.js";import{perObjectElevationAligner as E}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as U,needsElevationUpdates2D as F}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as T}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as V}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as D}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as G}from"./graphicUtils.js";import{namedAnchorToHUDMaterialAnchorPos as A}from"./placementUtils.js";import{placePointOnGeometry as L,updateStageObjectGeometry as H,getLocalOriginForPoint as k,extendPointGraphicElevationContext as B,createStageObject as N}from"./pointUtils.js";import{hasTransparencyModeSymbol as $}from"./transparencyUtils.js";import{initFastSymbolUpdatesState as q,updateFastSymbolUpdatesState as J,evaluateModelTransformScale as Z,ConvertOptions as W}from"../support/FastSymbolUpdates.js";import{createTexture as K,requiresHalfTexelOffset as Q,defaultBoundingBox as X,defaultSymbolSizeRatio as Y,defaultTexSize as ee}from"../../support/engineContent/sdfPrimitives.js";import{drapedZ as te}from"../../terrain/OverlayRenderer.js";import{VerticalOffsetParameters as re}from"../../webgl-engine/core/shaderLibrary/attributes/VerticalOffset.glsl.js";import{createPointGeometry as ie}from"../../webgl-engine/lib/GeometryUtil.js";import{ManagedTexture as se}from"../../webgl-engine/lib/ManagedTexture.js";import{RenderGeometry as ae}from"../../webgl-engine/lib/RenderGeometry.js";import{HUDMaterial as oe}from"../../webgl-engine/materials/HUDMaterial.js";var ne;const le=y(0,0,1),ce=16,he=1.5,ue=[ee*Y,ee*Y];class me extends D{static{ne=$}static{this.PRIMITIVE_SIZE=ue}getCachedSize(){return{size:this._getIconSize()}}static{this.elevationModeChangeTypes={definedChanged:1,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,r,i){super(e,t,r,i,xe(t)),this._cimData=null,this._overrideHelperClass=null,this._arcadeInfo=null,this._cimSymbolMaterials=new Map,this._cimSymbolTextures=new Map,this._cimMaterialParametersInfo=null,this._cimScaleFactorOrFunction=null,this._size=[1,1],this._symbolTextureRatio=1,this._outlineSize=0,this._textureHandle=null,this._patchTask=null,this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!0},this[ne]=!0}async doLoad(e){this._validateOrThrow();const t=this._prepareMaterialParameters(),r=this._getPrimitive();if(null!=r)this._prepareResourcesPrimitive(t,r);else{const r=I(this.symbolLayer),i=_e(r);null!=i?await this._prepareResourcesCIM(t,JSON.parse(i),e):await this._prepareResourcesHref(t,r,e)}}_validateOrThrow(){if(this._drivenProperties.size)return;const e=G(this._getIconSize());if(e)throw new r("graphics3diconsymbollayer:invalid-size",e)}_getIconSize(){const e=this.symbolLayer,t=Math.round(null!=e.size?l(e.size):ce);return this._drivenProperties.size?Math.max(t,64):t}_generateTextureCIM(e,t){const r=this._overrideHelperClass;let s=this._cimData;if(r&&s&&s.symbol||this.logger.error("Can't create texture, CIM data is undefined"),s.primitiveOverrides){s=i(s);const a=s.primitiveOverrides;r.evaluateOverrides(a,e,this._arcadeInfo.geometryType,null,null,t.layer.fieldsIndex),r.applyOverrides(s.symbol,a)}const a=h(JSON.stringify(s));let o=this._cimSymbolTextures.get(a);if(o)return o;const n=this._context.sharedResources.cimSymbolRasterizer,l=this._context.renderer&&"dictionary"===this._context.renderer.type?this._context.renderer.fieldMap:null;l&&r.applyDictionaryTextOverrides(s.symbol,e,l,null);const c=null!=this._cimScaleFactorOrFunction?C(this._cimScaleFactorOrFunction,e):1;1!==c&&s.symbol&&O(s.symbol,c,!0);const u=w.getEnvelope(s,null,n.resourceManager);if(u?.width&&u.height){const e=u.x+u.width/2,t=u.y+u.height/2,r=n.rasterize({type:"cim",data:s},u.width,u.height,e,t,1,"esriGeometryPoint",0,null,this._context.graphicsCoreOwner.view.state.rasterPixelRatio),i=new M({x:-u.x/u.width-.5,y:(u.height+u.y)/u.height-.5});this._cimMaterialParametersInfo.anchorPosition=fe("relative",i),o=new se(r,{width:r?.width??1,height:r?.height??1,reloadable:!0})}else o=new se(new ImageData(1,1),{width:1,height:1,reloadable:!0});return this._cimSymbolTextures.set(a,o),this._context.stage.addTexture(o),o}_prepareMaterialParameters(){const{symbolLayer:e,symbol:t,_context:r,_drivenProperties:i,view:s}=this,a=this.symbolLayer.occludedVisibility?.mode??"hidden";return{anchorPosition:fe(e.anchor,e.anchorPosition),rotation:e.angle,hasRotation:0!==e.angle||i.rotation,hasVertexRotation:i.rotation,occludedFragmentOpacity:"hidden"!==a?s.state.ensureOccludedFragmentOpacity():void 0,hasSlicePlane:r.slicePlaneEnabled,verticalOffset:de(t)?new re(t.verticalOffset):void 0,screenSizePerspective:r.screenSizePerspectiveEnabled?s.screenSizePerspective.parameters:void 0}}_prepareResourcesPrimitive(e,t){const r=this._getOutlineSize();if(pe(t)&&0===r)throw new Error("Nothing to render");if(this._outlineSize=r,e.color=this._getFillColor(),e.outlineColor=this._getOutlineColor(),e.outlineSize=this._outlineSize,null!=this._context.sharedResources.textures){const r=this._context.sharedResources.textures.fromData(`${t}-icon`,()=>K(t));this._textureHandle=r,e.textureId=r.managedTexture.id}e.textureIsSignedDistanceField=!0,e.sampleSignedDistanceFieldTexelCenter=Q(t),e.distanceFieldBoundingBox=X;const i=this._getIconSize();this._size=[i,i],this._symbolTextureRatio=1/Y,e.size=m(i*this._symbolTextureRatio,i*this._symbolTextureRatio),this._createMaterial(e)}async _prepareResourcesHref(t,i,s){this._outlineSize=this._getOutlineSize(),t.color=this._getFillColor(),t.outlineColor=this._getOutlineColor(),t.outlineSize=this._outlineSize,t.textureIsSignedDistanceField=!1;const a=this._getIconSize(),n=a*this._context.graphicsCoreOwner.view.state.rasterPixelRatio;if(null!=this._context.sharedResources.textures){const l=await e(this._context.sharedResources.textures.fromUrl(i,n,{signal:s}));if(!1===l.ok){o(l.error);throw new r("graphics3diconsymbollayer:request-failed",`Failed to load (Request for icon resource failed: ${i})`)}this._textureHandle=l.value;const c=l.value.managedTexture;this._size=ye(c,a),t.size=d(this._size),t.textureId=c.id}this._createMaterial(t)}async _prepareResourcesCIM(e,t,r){const{OverrideHelper:i}=await import("../../../../symbols/cim/OverrideHelper.js");if(this._overrideHelperClass=i,this._cimData=t,!this._context.sharedResources.cimSymbolRasterizer){const e=(await import("../../../../symbols/cim/CIMSymbolRasterizer.js")).CIMSymbolRasterizer;n(r),this._context.sharedResources.cimSymbolRasterizer??=new e(this._context.renderCoordsHelper.spatialReference)}const s=this._context.sharedResources.cimSymbolRasterizer,a=t,o=a?.symbol,l=[w.normalizeSymbolAndFetchResources(o,s.resourceManager,r)],c=this._context.layer.fields?this._context.layer.fields.map(e=>e.toJSON()):[],h=this._context.renderCoordsHelper.spatialReference;if(this._arcadeInfo={spatialReference:h,fields:c,geometryType:"esriGeometryPoint"},a?.primitiveOverrides&&l.push(i.createRenderExpressions(a.primitiveOverrides,this._arcadeInfo)),l.length>0&&(await Promise.all(l),n(r)),this._context.renderer&&"dictionary"===this._context.renderer.type&&this._context.renderer.scaleExpression){const e=this._context.renderer;if(e.scaleExpression){const t=e.scaleExpression,r=await z(t,this._context.layer.spatialReference),{default:i}=await import("../../../2d/arcade/callExpressionWithFeature.js"),s=new P(c);this._cimScaleFactorOrFunction=(e,t,a)=>{const o=i(r,e,{$view:a},"esriGeometryPoint",s,t);return null!==o?o:1}}}n(r),this._cimMaterialParametersInfo=e,this._cimMaterialParametersInfo.color=this._getFillColor(),this._cimMaterialParametersInfo.outlineColor=[0,0,0,0],this._cimMaterialParametersInfo.outlineSize=0,this._cimMaterialParametersInfo.textureIsSignedDistanceField=!1}_getPrimitive(){return ge(this.symbolLayer)}_getOutlineSize(){let e=0;const t=this.symbolLayer;if(null!=t.outline?.size)return Math.max(l(t.outline.size),0);return e=pe(this._getPrimitive())?he:0,Math.max(e,0)}_getOutlineColor(){const e=this._getLayerOpacity(),t=this.symbolLayer,r=t?.outline?.color;if(null!=r){const t=r.toUnitRGB(),i=r.a*e;return[t[0],t[1],t[2],i]}return[0,0,0,0]}_getFillColor(){if(pe(this._getPrimitive()))return j;const e=null==this._getPrimitive(),t=this._materialColor;return this._getCombinedOpacityAndColor(t,{hasIntrinsicColor:e})}get _materialColor(){return this.symbolLayer.material?.color}get _fastVisualVariableFallbackColor(){const e=this._materialColor;if(null==e){return null==this._getPrimitive()?x:v}return e.toUnitRGBA()}_getFallbackSize(){const e=this._getIconSize(),{symbolLayer:{size:t}}=this;return(null!=t?Math.round(l(t)):ce)/e}_createMaterial(e){const t=this._context.spherical;if(this._cimData){this._fastUpdates=null;let r=e.textureId?this._cimSymbolMaterials.get(e.textureId):null;return r||(r=new oe(e,t),this._cimSymbolMaterials.set(e.textureId??0,r)),r}return this._fastUpdates=q(this._context.renderer,this._fastVisualVariableConvertOptions()),this._fastUpdates&&(e={...e,...this._fastUpdates.materialParameters}),e.hasVertexColor=this._drivenProperties.color&&!this._fastUpdates?.visualVariables.color||this._drivenProperties.opacity&&!this._fastUpdates?.visualVariables.opacity,e.hasVertexSize=this._drivenProperties.size&&!this._fastUpdates?.visualVariables.size,e.focusAreaStyle=null,this._materials[0]=new oe(e,t),this._materials[1]=new oe(e,t,!0),e.focusAreaStyle=this._context.focusAreaStyle,this._materials[2]=new oe(e,t),this._materials[3]=new oe(e,t,!0),this._materials[0]}_setDrapingDependentMaterialParameters(){this.draped&&(this._forEachMaterial(e=>{e.setParameters({verticalOffset:null,screenSizePerspective:null,hasSlicePlane:!1,shaderPolygonOffset:0,draped:this.draped})}),this.layerOpacityChanged())}destroy(){super.destroy(),this._patchTask=s(this._patchTask),this._materials.length=0,this._cimSymbolMaterials.clear(),this._cimSymbolTextures.forEach(e=>this._context.stage.removeTexture(e)),this._cimSymbolTextures.clear(),this._textureHandle=a(this._textureHandle)}_getScaleFactor({size:e},t){if(!this._drivenProperties.size)return 1;if(null==e)return this._getFallbackSize();const[r,i,s]=e.output;return"symbol-value"===r?1:"number"==typeof r&&isFinite(r)?l(r)/t:"number"==typeof s&&isFinite(s)?l(s)/t:1}_getDrivenRotation(e){return this._drivenProperties.rotation?e.heading?.output??0:null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry))return null;const r=L(t.geometry);if(null==r)return this.logger.warn(`unsupported geometry type for text symbol: ${t.geometry.type}`),null;let i;const s=this.view.focusAreasView?.containsGeometry(r)??!0;if(this._cimData){if(!this._cimData.symbol)return null;const r=this._context.graphicsCoreOwner.view.state.rasterPixelRatio,a=this._generateTextureCIM(t,e),o={textureId:a.id,focusAreaStyle:s?null:this._context.focusAreaStyle,size:m(a.parameters.width/r,a.parameters.height/r),...this._cimMaterialParametersInfo};i=this._createMaterial(o)}else i=this._materials[s?0:2];if(null==r)return this.logger.warn(`unsupported geometry type for icon symbol: ${t.geometry.type}`),null;const a=null==this._getPrimitive(),o=e.renderingInfo,n=this._hasDrivenColorOrOpacity?this._getDrivenUInt8Color(o,this._materialColor,a):null,l=this._getDrivenRotation(o);let c=null;if(!this._fastUpdates?.visualVariables.size){const e=this._size,t=e[0]>e[1]?e[0]:e[1];c=this._getScaleFactor(o,t)}const h=null!=c?m(c,c):null,u=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus("on-the-ground"===u.mode)&&this._setDrapingDependentMaterialParameters(),this.draped?this._createAsOverlay(o,r,i,n,l,h,t.uid):this._createAs3DShape(o,r,i,n,l,h,u,t.uid)}terrainTransparencyChanged(){return this.draped}layerOpacityChanged(){const e=this._getFillColor(),t=this._getOutlineColor();this._forEachMaterial(r=>{r.setParameters({color:e}),r.setParameters({outlineColor:t})})}layerScreenSizePerspectiveChanged(){const e=this._context.screenSizePerspectiveEnabled&&!this.draped?this.view.screenSizePerspective.parameters:null;this._forEachMaterial(t=>{t.setParameters({screenSizePerspective:e})})}updateTransparentMode(e,t){const r=e.stageObject.geometries[0]?.material,i=this._materials.indexOf(r)<2,s=t?i?1:3:i?0:2,a=this._materials[s];a&&a!==r&&e.updateMaterial(a)}updateGeometry(e,t){const r=e.geometry;if(this.draped||!r||!this._validateGeometry(r))return!1;const{elevationContext:i,stageObject:s}=t;if(i.mode!==this.getGeometryElevationMode(r))return!1;const a=L(r);if(!a)return!1;i.updateFeatureExpressionFeature(e,this._context.layer);const o=H(s,this._context,a,i);if(null==o)return!1;const n=k(this._context,a);return s.geometries[0].localOrigin===n&&(t.alignedSampledElevation=o,B(t,a,this._context.elevationProvider),!0)}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,s=U(me.elevationModeChangeTypes,r,i);if(1!==s)return s;const a=F(i)||"absolute-height"===i;return this.updateGraphics3DGraphicElevationInfo(e,t,()=>a)}slicePlaneEnabledChanged(){return this.draped||this._forEachMaterial(e=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})}),!0}physicalBasedRenderingChanged(){return!0}get pixelRatioChanged(){return null!=this._getPrimitive()}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return 0;if(!J(this._fastUpdates,t,this._fastVisualVariableConvertOptions()))return 0;{const e=this._fastUpdates;this._materials.forEach(t=>t?.setParameters(e.materialParameters))}}return 2}get needsUpdateFocus(){return!0}prepareSymbolLayerPatch(e){if(this._patchTask?.abort(),"partial"!==e.diff.type)return;const t=e.diff.diff;this._preparePatchResource(e,t),this._preparePatchRotation(e,t)}_preparePatchResource(i,l){if(!l.resource||"partial"!==l.resource.type)return;const c=l.resource.diff;if("complete"!==c?.href?.type)return;const h=c.href.newValue,{textures:u}=this._context.sharedResources;if(null==h||null==u||null!=_e(h))return;const m=this._getIconSize(),d=m*this._context.graphicsCoreOwner.view.state.pixelRatio;i.symbolLayerStatePatches.push(()=>{this._patchTask=s(this._patchTask),this._patchTask=t(t=>this._context.schedule(async(t,i)=>{const s=await e(u.fromUrl(h,d,{signal:i}));n(i);const l=!s.ok;if(l&&o(s.error),this._textureHandle=a(this._textureHandle),this._patchTask=null,l){this._forEachMaterial(e=>{e.visible=!1,e.setParameters({textureId:null})});const e=`Failed to load (Request for icon resource failed: ${h})`;return void this.logger.error(new r("graphics3diconsymbollayer:request-failed",e))}this._textureHandle=s.value;const c=s.value.managedTexture;this._size=ye(c,m),this._forEachMaterial(e=>{e.setParameters({textureId:c.id}),e.visible=!0})},t))}),delete c.href}_preparePatchRotation(e,t){if(!t.angle||"complete"!==t.angle.type)return;const r=t.angle.newValue??0,i=0!==r||this._drivenProperties.rotation;e.symbolLayerStatePatches.push(()=>{this._forEachMaterial(e=>e.setParameters({rotation:r,hasRotation:i}))}),delete t.angle}_defaultElevationInfoNoZ(){return ve}_createAs3DShape(e,t,r,i,s,a,o,n){const l=this.getFastUpdateAttrValues(e),c=this._context.layerViewUid,h=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:n,layerViewUid:c}),u=ie(r,{normal:le,color:i,rotation:s,size:a,centerOffset:f,groundDistance:1,featureAttribute:l,olidColor:h}),m=N(this._context,t,u,o,n);if(null==m)return null;const d=new V(this,m.object,null,E,o);return d.setOccludedVisibilityMode(this.symbolLayer.occludedVisibility?.mode),d.hiddenIfDeconflicted=!0,d.alignedSampledElevation=m.sampledElevation,d.needsElevationUpdates=F(o.mode)||"absolute-height"===o.mode,d.getScreenSize=this._createScreenSizeGetter(a,l),d.calculateRelativeScreenBounds=e=>r.calculateRelativeScreenBounds(d.getScreenSize(),1,e),B(d,t,this._context.elevationProvider),d}_createAsOverlay(e,t,r,i,s,a,o){r.renderPriority=this._renderPriority;const n=g();b(t,n,this._context.overlaySR),n[2]=te;const l=this._context.clippingExtent;if(null!=l&&!S(l,n))return null;const c=this.getFastUpdateAttrValues(e),h=this._context.layerViewUid,u=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:o,layerViewUid:h}),m=ie(r,{normal:le,position:n,color:i,rotation:s,size:a,featureAttribute:c,olidColor:u}),d=new ae(m,{layerViewUid:h,graphicUid:o}),p=new T(this,[d],null,this._context.drapeSourceRenderer);return p.getScreenSize=this._createScreenSizeGetter(a,c),p.calculateRelativeScreenBounds=e=>r.calculateRelativeScreenBounds(p.getScreenSize(),1,e),p}_createScreenSizeGetter(e,t){e??=_;const r=this._outlineSize+2;if(this._fastUpdates&&t){const i=e[0]*this._size[0],s=e[1]*this._size[1];return(e=p())=>{const[a,o]=Z(be,this._fastUpdates.materialParameters,t);return e[0]=a*i+r,e[1]=o*s+r,e}}const i=e[0]*this._size[0]+r,s=e[1]*this._size[1]+r;return(e=p())=>(e[0]=i,e[1]=s,e)}_fastVisualVariableConvertOptions(){const e=Math.max(this._size[0],this._size[1]),t=y(e,e,e),r=c(1),i=e*r,s=y(i,i,i),a=this._getFallbackSize();return new W({supports:{size:!0,color:!0,rotation:!0,opacity:!1},modelSize:t,symbolSize:s,unitInMeters:r,fallbackColor:this._fastVisualVariableFallbackColor,fallbackSize:y(a,a,a)})}_forEachMaterial(e){this._materials.forEach(e),this._cimSymbolMaterials.forEach(e)}test(){return{...super.test(),material:this._materials[0]}}}function de(e){return e&&"point-3d"===e.type&&e.hasVisibleVerticalOffset()}function pe(e){return null!=e&&("cross"===e||"x"===e)}function _e(e){const t=u(e);return"application/json"===t?.mediaType?t.data:void 0}function fe(e,t){return"relative"===e?m((t.x||0)+.5,.5-(t.y||0)):e in A?A[e]:A.center}function ye({parameters:e},t){const r=(e.width??1)/(e.height??1);return r>1?[t,Math.round(t/r)]:[Math.round(t*r),t]}function ge(e){return e.resource?.href?null:e.resource?.primitive??R}function xe(e){return 1===(e.material?.color?.a??0)&&null!=ge(e)}const ve={mode:"relative-to-ground",offset:0},be=g();export{me as Graphics3DIconSymbolLayer};
|
package/views/VideoView.js
CHANGED
|
@@ -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"../Color.js";import i from"../Viewpoint.js";import s from"../core/Accessor.js";import{EventedMixin as r}from"../core/Evented.js";import{destroyMaybe as o}from"../core/maybe.js";import{EsriPromiseMixin as a}from"../core/Promise.js";import{watch as n,syncAndInitial as l,whenOnce as p,when as m}from"../core/reactiveUtils.js";import{property as h,cast as d,subclass as c}from"../core/accessorSupport/decorators.js";import{ensureClass as g}from"../core/accessorSupport/ensureType.js";import{create as f,fromValues as y}from"../core/libs/gl-matrix-2/factories/vec2f64.js";import u from"../geometry/Extent.js";import j from"../geometry/Point.js";import w from"../geometry/SpatialReference.js";import{load as b,execute as v}from"../geometry/operators/projectOperator.js";import _ from"../layers/support/ExtentAndRotationGeoreference.js";import{MediaElementView as M}from"../layers/support/MediaElementView.js";import S from"../layers/support/TileInfo.js";import C from"../layers/support/VideoElement.js";import{DOMContainer as V}from"./DOMContainer.js";import{Viewport2DBaseMixin as x}from"./Viewport2DBaseMixin.js";import{Viewport2DMixin as E}from"./Viewport2DMixin.js";import P from"./2d/AnimationManager.js";import G from"./2d/MapViewConstraints.js";import"../core/RandomLCG.js";import"../core/Logger.js";import"../core/has.js";import"../core/scheduling.js";import"../core/mathUtils.js";import"../config.js";import"../symbols/cim/defaultCIMValues.js";import"../core/floatRGBA.js";import"../symbols/Font.js";import"../geometry/support/spatialReferenceUtils.js";import"../symbols/cim/effects/EffectAddControlPoints.js";import"../symbols/cim/effects/EffectArrow.js";import"../symbols/cim/effects/EffectBuffer.js";import"../symbols/cim/effects/EffectControlMeasureLine.js";import"../symbols/cim/effects/EffectCut.js";import"../symbols/cim/effects/EffectDashes.js";import"../symbols/cim/effects/EffectDonut.js";import"../symbols/cim/effects/EffectEnclosingPolygon.js";import"../symbols/cim/effects/EffectJog.js";import"../symbols/cim/effects/EffectMove.js";import"../symbols/cim/effects/EffectOffset.js";import"../symbols/cim/effects/EffectRadial.js";import"../symbols/cim/effects/EffectReverse.js";import"../symbols/cim/effects/EffectRotate.js";import"../symbols/cim/effects/EffectScale.js";import"../symbols/cim/effects/EffectSuppress.js";import"../symbols/cim/effects/EffectTaperedPolygon.js";import"../symbols/cim/effects/EffectWave.js";import"../symbols/cim/placements/PlacementAlongLineSameSize.js";import"../symbols/cim/placements/PlacementAtExtremities.js";import"../symbols/cim/placements/PlacementAtMeasuredUnits.js";import"../symbols/cim/placements/PlacementAtRatioPositions.js";import"../symbols/cim/placements/PlacementInsidePolygon.js";import"../symbols/cim/placements/PlacementOnLine.js";import"../symbols/cim/placements/PlacementOnVertices.js";import"../symbols/cim/placements/PlacementPolygonCenter.js";import"../symbols/dimensions/effects/LinearDimensionArrowEffect.js";import"../symbols/dimensions/effects/LinearDimensionExtensionLineEffect.js";import"../symbols/dimensions/effects/LinearDimensionLeaderLineEffect.js";import"../symbols/dimensions/effects/LinearDimensionLineEffect.js";import"../symbols/dimensions/effects/LinearDimensionPointEffect.js";import"../symbols/dimensions/effects/LinearDimensionTextEffect.js";import"../symbols/cim/constants.js";import"../core/libs/gl-matrix-2/factories/vec2f32.js";import"../geometry/Polygon.js";import"../symbols/support/defaults.js";import"../symbols/cim/OverrideHelper.js";import{Container as D}from"./2d/engine/Container.js";import"./2d/engine/webgl/shaders/BitBlitPrograms.js";import"./webgl/enums.js";import"./webgl/Program.js";import"./webgl/Util.js";import"./webgl/VertexAttributeLayouts.js";import"./webgl/BufferObject.js";import"../request.js";import"../core/urlUtils.js";import"./webgl/Texture.js";import"../core/pbf.js";import"./2d/engine/webgl/shaders/StencilPrograms.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/BlendShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/OpacityShader.js";import"./2d/engine/webgl/shaders/HighlightPrograms.js";import"./webgl/FramebufferObject.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/BlitShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/BloomShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/BlurShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/ColorizeShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/DropShadowShader.js";import"./2d/engine/webgl/meshing/SimpleMesh.js";import"./webgl/Renderbuffer.js";import"./2d/engine/webgl/PooledUint32Array.js";import"./2d/engine/webgl/Profiler.js";import"./2d/engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import"./2d/engine/webgl/number.js";import"./2d/engine/webgl/shaderGraph/techniques/animated/attributes.js";import"./2d/engine/webgl/mesh/templates/templateUtils.js";import"./2d/engine/webgl/shaderGraph/techniques/line/LineMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/ComplexFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/FillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/GradientFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/OutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/PatternFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapMeshWriter.js";import"../geometry/support/aaBoundingBox.js";import"./2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/line/TexturedLineMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js";import"../core/sql/UnknownTimeZone.js";import"luxon";import"../intl/locale.js";import"../geometry/Geometry.js";import"../geometry/Multipoint.js";import"../geometry/Polyline.js";import"../layers/support/fieldUtils.js";import"../time/constants.js";import"./2d/engine/webgl/animations/instructions.js";import"./2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartMeshWriter.js";import"./webgl/checkWebGLError.js";import"./webgl/renderState.js";import"./webgl/testSVGPremultipliedAlpha.js";import{ManagedCanvas as R}from"./2d/engine/ManagedCanvas.js";import"../core/libs/gl-matrix-2/factories/vec4f32.js";import"./2d/engine/transitions/FadeTransition.js";import"./2d/engine/webgl/meshing/definitions.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/VideoScreenShader.js";import"./2d/LabelManager.js";import"./2d/layers/graphics/GraphicsView2D.js";import"./2d/engine/webgl/shaderGraph/techniques/clip/ClipTechnique.js";import"./2d/engine/webgl/AFeatureTile.js";import"./2d/engine/webgl/DisplayEntity.js";import"./2d/engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js";import"./2d/engine/webgl/cpuMapped/MappedMesh.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/TileDebugInfoShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/TileStencilShader.js";import"../core/libs/gl-matrix-2/factories/vec3f32.js";import"../geometry/support/normalizeUtils.js";import"./2d/layers/support/util.js";import q from"./2d/navigation/MapViewNavigation.js";import"../core/asyncUtils.js";import"../core/support/UpdatingHandles.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js";import"../core/units.js";import"../geometry/ellipsoidUtils.js";import"../geometry/spatialReferenceEllipsoidUtils.js";import"../geometry/operators/support/GeographicTransformation.js";import"../geometry/projection/projectors.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/GridShader.js";import"../geometry/support/geodesicConstants.js";import"../geometry/support/Ellipsoid.js";import{ViewStateManager as z}from"./2d/ViewStateManager.js";import T from"./2d/engine/webgl/Overlay.js";import O from"./2d/engine/webgl/OverlayContainer.js";import L from"./navigation/Navigation.js";import W from"./ui/DefaultUI.js";import A from"./ui/video/DefaultUIVideo.js";const U=new t("#000");let F;async function H(){const[,{ParentStage:e}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);F=e}const k=.01,B=["feature","geojson","csv","stream","ogc-feature","catalog","wfs","parquet","graphics","group"];let I=class extends(E(x(V(r(a(s)))))){constructor(e){super(e),this._isValid=!1,this._readyCycleForced=!1,this._prevZoomEnabled=!1,this._prevRotationEnabled=!1,this.stage=null,this.childStage=null,this._operationalDataView=null,this.operationalDataVisible=!1,this.map=null,this.navigation=new L,this.ready=!1,this.spatialReference=new w({wkid:0}),this.stateManager=new z({constraints:new G({view:this,minScale:1,maxScale:k})}),this.type="2d",this.ui=new A,this.view2dType="video",this.addHandles([n(()=>this.preconditionsReady,e=>e?this._startup():this._teardown()),n(()=>this.videoSize,([e,t])=>{this._extent&&e&&t&&(this._extent.xmax=e,this._extent.ymax=t)}),n(()=>this.size,e=>{this._operationalDataView&&this._operationalDataView.stateManager.resize(e[0],e[1])}),n(()=>[this.layer?.frameEffect,this._effectsContainer],()=>{this._effectsContainer&&(this._effectsContainer.effect=this.layer?.frameEffect??null)},l)])}initialize(){this._prevZoomEnabled="zoom"===this.navigation.actionMap.mouseWheel&&this.ui.components.includes("zoom"),this._prevRotationEnabled="rotate"===this.navigation.actionMap.dragSecondary&&this.ui.components.includes("compass"),this.addHandles([n(()=>[this.operationalDataVisible,this.childStage],()=>{this.childStage&&(this.childStage.videoScreenRenderer.visible=this.operationalDataVisible),this.operationalDataVisible&&(this.scale=1,this.rotation=0),this.navigation&&(this._prevZoomEnabled&&(this.navigation.actionMap.mouseWheel=this.operationalDataVisible?"none":"zoom",this.navigation.actionMap.dragPrimary=this.operationalDataVisible?"none":"pan",this.ui.components&&(this.ui.components=this.operationalDataVisible?this.ui.components.filter(e=>"zoom"!==e):[...new Set([...this.ui.components,"zoom"])])),this._prevRotationEnabled&&(this.navigation.actionMap.dragSecondary=this.operationalDataVisible?"none":"rotate",this.ui.components&&(this.ui.components=this.operationalDataVisible?this.ui.components.filter(e=>"compass"!==e):[...new Set([...this.ui.components,"compass"])])))},l)]),this.addResolvingPromise(H().then(()=>(this._isValid=!0,p(()=>this.ready))))}destroy(){this._teardown(),this.removeAllHandles(),this._set("preconditionsReady",!1),this.frameTask=o(this.frameTask),this.goToManager.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get constraintsInfo(){return{lods:null,spatialReference:this.spatialReference}}get layer(){return this._get("layer")}set layer(e){e!==this._get("layer")&&(this.constructed&&!this.destroyed&&(this._forceReadyCycle(),this.addResolvingPromise(p(()=>this.ready))),this._set("layer",e))}get preconditionsReady(){return!(!this._isValid||this._readyCycleForced||0===this.width||0===this.height||0===this.videoSize[0]||0===this.videoSize[1])}get rendering(){return this.stage?.renderRequested??!1}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get videoSize(){if(!this.layer?.videoWidth||!this.layer?.videoHeight)return[0,0];const[e,t]=this.size,i=(this.layer?.videoWidth||0)/(this.layer?.videoHeight||0),s=t*i,r=e/i;return e/t>=1?i>=1?s<=e?[s,t]:[e,r]:r<=t?[e,r]:[s,t]:i>=1?r<=t?[e,r]:[s,t]:s<=e?[s,t]:[e,r]}async hitTest(e,t){if(!this._operationalDataView||!this._operationalDataView.ready)return{screenPoint:e,results:[]};const i=this._operationalDataView.videoToMap(e);if(!i)return{screenPoint:e,results:[]};const s=this._operationalDataView.state.toScreen(f(),i);return this._operationalDataView.hitTest({x:s[0],y:s[1]},t)}_startup(){if(!this.layer)return;const e=this._getViewpoint();this.stateManager.startup(e,this.size,e.targetGeometry.spatialReference);const t={renderingOptions:this.renderingOptions,backgroundColor:U,groundControlPoints:()=>this._groundControlPoints(),getSize:()=>this.videoSize},i=new F(this.surface,t,new R(this.surface));this.stage=i,this._prepareStage(this.stage),this.childStage=i.childStage,this._prepareChildStage(this.childStage);const s=new P({view:this});this._set("animationManager",s);const r=new q({view:this,animationManager:s});this._set("mapViewNavigation",r),this._updateConstraints(),this.frameTask.start(),this._set("ready",!0)}_teardown(){this.frameTask?.stop(),this.stationaryManager?.clear(),this.stage?.destroy(),this.stage=null,this._videoElementView=null,this._overlayContainer?.removeAllChildren(),this._overlayContainer=null,this.removeHandles("video-view"),this._set("ready",!1),this.stateManager?.ready&&this.stateManager.teardown()}_getViewpoint(){return new i({targetGeometry:new j({x:this.videoSize[0]/2,y:this.videoSize[1]/2,spatialReference:this.spatialReference}),scale:1})}_prepareStage(e){this.addHandles([n(()=>this.stationary,t=>e.stationary=t,l),n(()=>this.state.id,()=>e.state=this.state,l),n(()=>this.renderingOptions,t=>e.renderingOptions=t,l)],"video-view"),this._extent=new u({xmin:0,ymin:0,xmax:this.videoSize[0],ymax:this.videoSize[1],spatialReference:{wkid:0}}),this._videoElementView=new M({element:new C({video:this.layer?.videoElement,georeference:new _({extent:this._extent}),autoplay:!1}),spatialReference:this.spatialReference});const t=new T(this._videoElementView);this._overlayContainer=new O,this._overlayContainer.addChild(t),this._effectsContainer=new D,this._effectsContainer.addChild(this._overlayContainer),this.stage.addChild(this._effectsContainer);const i=document.createElement("div");i.classList.add("esri-video-poster"),this.container?.classList.add("esri-video-view"),this.container?.appendChild(i)}_prepareChildStage(e){this.addHandles([n(()=>this.map,async t=>{if(!t)return;const{default:i}=await import("./video/VideoOperationalDataView.js");this._operationalDataView=new i({stage:e,layerViewFilter:e=>new Set(B).has(e.type),width:this.size[0],height:this.size[1],map:t,groundControlPoints:()=>this._groundControlPoints(),getVideoResolution:()=>y(this.layer?.videoWidth||0,this.layer?.videoHeight||0),getSize:()=>this.size}),p(()=>this._operationalDataView?.ready).then(()=>{e.videoScreenRenderer.visible=this.operationalDataVisible})},l),n(()=>this.layer?.groundControlPoints,async()=>{if(!this.layer?.groundControlPoints||!e.state)return;const t=this.layer.groundControlPoints,i=t?.length;if(!i)return;await b();const s=new Array(i),r=e.state.spatialReference;for(let e=0;e<i;e++){const{lat:i,lon:o}=t[e];s[e]=v(new j(o,i),r)}let o=1/0,a=1/0,n=-1/0,l=-1/0;for(const e of s)o=Math.min(o,e.x),a=Math.min(a,e.y),n=Math.max(n,e.x),l=Math.max(l,e.y);const p=u.fromJSON({xmin:o,ymin:a,xmax:n,ymax:l,spatialReference:r});await(this._operationalDataView?.goTo(p,{animate:!1}).catch(()=>{}))},l)])}_updateConstraints(){this._updateZoomConstraints(),this._updatePanConstraints()}_updateZoomConstraints(){const e=this.videoSize,t=Math.max(e[0]/this.size[0],e[1]/this.size[1]),i=[];for(let r=t;r>k;r/=2)i.push(r);i.push(k);const{lods:s}=S.create({scales:i});this.constraints.set({lods:s,minScale:t})}_updatePanConstraints(){const e=e=>{if(!e.targetGeometry)return e;const[t,i]=this.videoSize,s=t*e.scale/2,r=i*e.scale/2,o=e.targetGeometry.clone();return o.x=Math.max(s,Math.min(t-s,o.x)),o.y=Math.max(r,Math.min(i-r,o.y)),e.targetGeometry=o,e};this.constraints.customConstraints.add({constrain:e,applyPanConstraint:e})}_forceReadyCycle(){this.ready&&(m(()=>this.destroyed||!1===this.preconditionsReady,()=>this._readyCycleForced=!1,{once:!0}),this._readyCycleForced=!0)}_groundControlPoints(){return this.layer?.groundControlPoints}};e([h()],I.prototype,"_overlayContainer",void 0),e([h()],I.prototype,"_isValid",void 0),e([h()],I.prototype,"_readyCycleForced",void 0),e([h()],I.prototype,"_effectsContainer",void 0),e([h()],I.prototype,"constraintsInfo",null),e([h()],I.prototype,"operationalDataVisible",void 0),e([h()],I.prototype,"layer",null),e([h()],I.prototype,"map",void 0),e([h({type:L,nonNullable:!0})],I.prototype,"navigation",void 0),e([h({readOnly:!0})],I.prototype,"preconditionsReady",null),e([h({readOnly:!0})],I.prototype,"ready",void 0),e([h({readOnly:!0})],I.prototype,"rendering",null),e([h()],I.prototype,"scale",null),e([h()],I.prototype,"spatialReference",void 0),e([h()],I.prototype,"stateManager",void 0),e([h()],I.prototype,"type",void 0),e([h(),d(e=>e instanceof W?e:g(A,e))],I.prototype,"ui",void 0),e([h({readOnly:!0})],I.prototype,"videoSize",null),e([h({readOnly:!0})],I.prototype,"view2dType",void 0),I=e([c("esri.views.VideoView")],I);const Z=I;export{Z as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../Color.js";import i from"../Viewpoint.js";import s from"../core/Accessor.js";import{EventedMixin as r}from"../core/Evented.js";import{destroyMaybe as o}from"../core/maybe.js";import{EsriPromiseMixin as a}from"../core/Promise.js";import{watch as n,syncAndInitial as l,whenOnce as p,when as m}from"../core/reactiveUtils.js";import{property as h,cast as d,subclass as c}from"../core/accessorSupport/decorators.js";import{ensureClass as g}from"../core/accessorSupport/ensureType.js";import{create as f,fromValues as y}from"../core/libs/gl-matrix-2/factories/vec2f64.js";import u from"../geometry/Extent.js";import j from"../geometry/Point.js";import w from"../geometry/SpatialReference.js";import{load as b,execute as v}from"../geometry/operators/projectOperator.js";import _ from"../layers/support/ExtentAndRotationGeoreference.js";import{MediaElementView as M}from"../layers/support/MediaElementView.js";import S from"../layers/support/TileInfo.js";import C from"../layers/support/VideoElement.js";import{DOMContainer as V}from"./DOMContainer.js";import{Viewport2DBaseMixin as x}from"./Viewport2DBaseMixin.js";import{Viewport2DMixin as E}from"./Viewport2DMixin.js";import P from"./2d/AnimationManager.js";import G from"./2d/MapViewConstraints.js";import"../core/RandomLCG.js";import"../core/Logger.js";import"../core/has.js";import"../core/scheduling.js";import"../core/mathUtils.js";import"../config.js";import"../symbols/cim/defaultCIMValues.js";import"../core/floatRGBA.js";import"../geometry/Geometry.js";import"../geometry/Multipoint.js";import"../geometry/Polygon.js";import"../geometry/Polyline.js";import"../symbols/Font.js";import"../geometry/support/spatialReferenceUtils.js";import"../symbols/cim/effects/EffectAddControlPoints.js";import"../symbols/cim/effects/EffectArrow.js";import"../symbols/cim/effects/EffectBuffer.js";import"../symbols/cim/effects/EffectControlMeasureLine.js";import"../symbols/cim/effects/EffectCut.js";import"../symbols/cim/effects/EffectDashes.js";import"../symbols/cim/effects/EffectDonut.js";import"../symbols/cim/effects/EffectEnclosingPolygon.js";import"../symbols/cim/effects/EffectJog.js";import"../symbols/cim/effects/EffectMove.js";import"../symbols/cim/effects/EffectOffset.js";import"../symbols/cim/effects/EffectRadial.js";import"../symbols/cim/effects/EffectReverse.js";import"../symbols/cim/effects/EffectRotate.js";import"../symbols/cim/effects/EffectScale.js";import"../symbols/cim/effects/EffectSuppress.js";import"../symbols/cim/effects/EffectTaperedPolygon.js";import"../symbols/cim/effects/EffectWave.js";import"../symbols/cim/placements/PlacementAlongLineSameSize.js";import"../symbols/cim/placements/PlacementAtExtremities.js";import"../symbols/cim/placements/PlacementAtMeasuredUnits.js";import"../symbols/cim/placements/PlacementAtRatioPositions.js";import"../symbols/cim/placements/PlacementInsidePolygon.js";import"../symbols/cim/placements/PlacementOnLine.js";import"../symbols/cim/placements/PlacementOnVertices.js";import"../symbols/cim/placements/PlacementPolygonCenter.js";import"../symbols/dimensions/effects/LinearDimensionArrowEffect.js";import"../symbols/dimensions/effects/LinearDimensionExtensionLineEffect.js";import"../symbols/dimensions/effects/LinearDimensionLeaderLineEffect.js";import"../symbols/dimensions/effects/LinearDimensionLineEffect.js";import"../symbols/dimensions/effects/LinearDimensionPointEffect.js";import"../symbols/dimensions/effects/LinearDimensionTextEffect.js";import"../symbols/cim/constants.js";import"../core/libs/gl-matrix-2/factories/vec2f32.js";import"../symbols/support/defaults.js";import"../symbols/cim/OverrideHelper.js";import{Container as D}from"./2d/engine/Container.js";import"./2d/engine/webgl/shaders/BitBlitPrograms.js";import"./webgl/enums.js";import"./webgl/Program.js";import"./webgl/Util.js";import"./webgl/VertexAttributeLayouts.js";import"./webgl/BufferObject.js";import"../request.js";import"../core/urlUtils.js";import"./webgl/Texture.js";import"../core/pbf.js";import"./2d/engine/webgl/shaders/StencilPrograms.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/BlendShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/OpacityShader.js";import"./2d/engine/webgl/shaders/HighlightPrograms.js";import"./webgl/FramebufferObject.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/BlitShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/BloomShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/BlurShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/ColorizeShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/DropShadowShader.js";import"./2d/engine/webgl/meshing/SimpleMesh.js";import"./webgl/Renderbuffer.js";import"./2d/engine/webgl/PooledUint32Array.js";import"./2d/engine/webgl/Profiler.js";import"./2d/engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import"./2d/engine/webgl/number.js";import"./2d/engine/webgl/shaderGraph/techniques/animated/attributes.js";import"./2d/engine/webgl/mesh/templates/templateUtils.js";import"./2d/engine/webgl/shaderGraph/techniques/line/LineMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/ComplexFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/FillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/GradientFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/OutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/PatternFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapMeshWriter.js";import"../geometry/support/aaBoundingBox.js";import"./2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/line/TexturedLineMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js";import"../core/sql/UnknownTimeZone.js";import"luxon";import"../intl/locale.js";import"../layers/support/fieldUtils.js";import"../time/constants.js";import"./2d/engine/webgl/animations/instructions.js";import"./2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartMeshWriter.js";import"./webgl/checkWebGLError.js";import"./webgl/renderState.js";import"./webgl/testSVGPremultipliedAlpha.js";import{ManagedCanvas as R}from"./2d/engine/ManagedCanvas.js";import"../core/libs/gl-matrix-2/factories/vec4f32.js";import"./2d/engine/transitions/FadeTransition.js";import"./2d/engine/webgl/meshing/definitions.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/VideoScreenShader.js";import"./2d/LabelManager.js";import"./2d/layers/graphics/GraphicsView2D.js";import"./2d/engine/webgl/shaderGraph/techniques/clip/ClipTechnique.js";import"./2d/engine/webgl/AFeatureTile.js";import"./2d/engine/webgl/DisplayEntity.js";import"./2d/engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js";import"./2d/engine/webgl/cpuMapped/MappedMesh.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/TileDebugInfoShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/TileStencilShader.js";import"../core/libs/gl-matrix-2/factories/vec3f32.js";import"../geometry/support/normalizeUtils.js";import"./2d/layers/support/util.js";import q from"./2d/navigation/MapViewNavigation.js";import"../core/asyncUtils.js";import"../core/support/UpdatingHandles.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js";import"../core/units.js";import"../geometry/ellipsoidUtils.js";import"../geometry/spatialReferenceEllipsoidUtils.js";import"../geometry/operators/support/GeographicTransformation.js";import"../geometry/projection/projectors.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/GridShader.js";import"../geometry/support/geodesicConstants.js";import"../geometry/support/Ellipsoid.js";import{ViewStateManager as z}from"./2d/ViewStateManager.js";import T from"./2d/engine/webgl/Overlay.js";import O from"./2d/engine/webgl/OverlayContainer.js";import L from"./navigation/Navigation.js";import W from"./ui/DefaultUI.js";import A from"./ui/video/DefaultUIVideo.js";const U=new t("#000");let F;async function H(){const[,{ParentStage:e}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);F=e}const k=.01,B=["feature","geojson","csv","stream","ogc-feature","catalog","wfs","parquet","graphics","group"];let I=class extends(E(x(V(r(a(s)))))){constructor(e){super(e),this._isValid=!1,this._readyCycleForced=!1,this._prevZoomEnabled=!1,this._prevRotationEnabled=!1,this.stage=null,this.childStage=null,this._operationalDataView=null,this.operationalDataVisible=!1,this.map=null,this.navigation=new L,this.ready=!1,this.spatialReference=new w({wkid:0}),this.stateManager=new z({constraints:new G({view:this,minScale:1,maxScale:k})}),this.type="2d",this.ui=new A,this.view2dType="video",this.addHandles([n(()=>this.preconditionsReady,e=>e?this._startup():this._teardown()),n(()=>this.videoSize,([e,t])=>{this._extent&&e&&t&&(this._extent.xmax=e,this._extent.ymax=t)}),n(()=>this.size,e=>{this._operationalDataView&&this._operationalDataView.stateManager.resize(e[0],e[1])}),n(()=>[this.layer?.frameEffect,this._effectsContainer],()=>{this._effectsContainer&&(this._effectsContainer.effect=this.layer?.frameEffect??null)},l)])}initialize(){this._prevZoomEnabled="zoom"===this.navigation.actionMap.mouseWheel&&this.ui.components.includes("zoom"),this._prevRotationEnabled="rotate"===this.navigation.actionMap.dragSecondary&&this.ui.components.includes("compass"),this.addHandles([n(()=>[this.operationalDataVisible,this.childStage],()=>{this.childStage&&(this.childStage.videoScreenRenderer.visible=this.operationalDataVisible),this.operationalDataVisible&&(this.scale=1,this.rotation=0),this.navigation&&(this._prevZoomEnabled&&(this.navigation.actionMap.mouseWheel=this.operationalDataVisible?"none":"zoom",this.navigation.actionMap.dragPrimary=this.operationalDataVisible?"none":"pan",this.ui.components&&(this.ui.components=this.operationalDataVisible?this.ui.components.filter(e=>"zoom"!==e):[...new Set([...this.ui.components,"zoom"])])),this._prevRotationEnabled&&(this.navigation.actionMap.dragSecondary=this.operationalDataVisible?"none":"rotate",this.ui.components&&(this.ui.components=this.operationalDataVisible?this.ui.components.filter(e=>"compass"!==e):[...new Set([...this.ui.components,"compass"])])))},l)]),this.addResolvingPromise(H().then(()=>(this._isValid=!0,p(()=>this.ready))))}destroy(){this._teardown(),this.removeAllHandles(),this._set("preconditionsReady",!1),this.frameTask=o(this.frameTask),this.goToManager.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get constraintsInfo(){return{lods:null,spatialReference:this.spatialReference}}get layer(){return this._get("layer")}set layer(e){e!==this._get("layer")&&(this.constructed&&!this.destroyed&&(this._forceReadyCycle(),this.addResolvingPromise(p(()=>this.ready))),this._set("layer",e))}get preconditionsReady(){return!(!this._isValid||this._readyCycleForced||0===this.width||0===this.height||0===this.videoSize[0]||0===this.videoSize[1])}get rendering(){return this.stage?.renderRequested??!1}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get videoSize(){if(!this.layer?.videoWidth||!this.layer?.videoHeight)return[0,0];const[e,t]=this.size,i=(this.layer?.videoWidth||0)/(this.layer?.videoHeight||0),s=t*i,r=e/i;return e/t>=1?i>=1?s<=e?[s,t]:[e,r]:r<=t?[e,r]:[s,t]:i>=1?r<=t?[e,r]:[s,t]:s<=e?[s,t]:[e,r]}async hitTest(e,t){if(!this._operationalDataView||!this._operationalDataView.ready)return{screenPoint:e,results:[]};const i=this._operationalDataView.videoToMap(e);if(!i)return{screenPoint:e,results:[]};const s=this._operationalDataView.state.toScreen(f(),i);return this._operationalDataView.hitTest({x:s[0],y:s[1]},t)}_startup(){if(!this.layer)return;const e=this._getViewpoint();this.stateManager.startup(e,this.size,e.targetGeometry.spatialReference);const t={renderingOptions:this.renderingOptions,backgroundColor:U,groundControlPoints:()=>this._groundControlPoints(),getSize:()=>this.videoSize},i=new F(this.surface,t,new R(this.surface));this.stage=i,this._prepareStage(this.stage),this.childStage=i.childStage,this._prepareChildStage(this.childStage);const s=new P({view:this});this._set("animationManager",s);const r=new q({view:this,animationManager:s});this._set("mapViewNavigation",r),this._updateConstraints(),this.frameTask.start(),this._set("ready",!0)}_teardown(){this.frameTask?.stop(),this.stationaryManager?.clear(),this.stage?.destroy(),this.stage=null,this._videoElementView=null,this._overlayContainer?.removeAllChildren(),this._overlayContainer=null,this.removeHandles("video-view"),this._set("ready",!1),this.stateManager?.ready&&this.stateManager.teardown()}_getViewpoint(){return new i({targetGeometry:new j({x:this.videoSize[0]/2,y:this.videoSize[1]/2,spatialReference:this.spatialReference}),scale:1})}_prepareStage(e){this.addHandles([n(()=>this.stationary,t=>e.stationary=t,l),n(()=>this.state.id,()=>e.state=this.state,l),n(()=>this.renderingOptions,t=>e.renderingOptions=t,l)],"video-view"),this._extent=new u({xmin:0,ymin:0,xmax:this.videoSize[0],ymax:this.videoSize[1],spatialReference:{wkid:0}}),this._videoElementView=new M({element:new C({video:this.layer?.videoElement,georeference:new _({extent:this._extent}),autoplay:!1}),spatialReference:this.spatialReference});const t=new T(this._videoElementView);this._overlayContainer=new O,this._overlayContainer.addChild(t),this._effectsContainer=new D,this._effectsContainer.addChild(this._overlayContainer),this.stage.addChild(this._effectsContainer);const i=document.createElement("div");i.classList.add("esri-video-poster"),this.container?.classList.add("esri-video-view"),this.container?.appendChild(i)}_prepareChildStage(e){this.addHandles([n(()=>this.map,async t=>{if(!t)return;const{default:i}=await import("./video/VideoOperationalDataView.js");this._operationalDataView=new i({stage:e,layerViewFilter:e=>new Set(B).has(e.type),width:this.size[0],height:this.size[1],map:t,groundControlPoints:()=>this._groundControlPoints(),getVideoResolution:()=>y(this.layer?.videoWidth||0,this.layer?.videoHeight||0),getSize:()=>this.size}),p(()=>this._operationalDataView?.ready).then(()=>{e.videoScreenRenderer.visible=this.operationalDataVisible})},l),n(()=>this.layer?.groundControlPoints,async()=>{if(!this.layer?.groundControlPoints||!e.state)return;const t=this.layer.groundControlPoints,i=t?.length;if(!i)return;await b();const s=new Array(i),r=e.state.spatialReference;for(let e=0;e<i;e++){const{lat:i,lon:o}=t[e];s[e]=v(new j(o,i),r)}let o=1/0,a=1/0,n=-1/0,l=-1/0;for(const e of s)o=Math.min(o,e.x),a=Math.min(a,e.y),n=Math.max(n,e.x),l=Math.max(l,e.y);const p=u.fromJSON({xmin:o,ymin:a,xmax:n,ymax:l,spatialReference:r});await(this._operationalDataView?.goTo(p,{animate:!1}).catch(()=>{}))},l)])}_updateConstraints(){this._updateZoomConstraints(),this._updatePanConstraints()}_updateZoomConstraints(){const e=this.videoSize,t=Math.max(e[0]/this.size[0],e[1]/this.size[1]),i=[];for(let r=t;r>k;r/=2)i.push(r);i.push(k);const{lods:s}=S.create({scales:i});this.constraints.set({lods:s,minScale:t})}_updatePanConstraints(){const e=e=>{if(!e.targetGeometry)return e;const[t,i]=this.videoSize,s=t*e.scale/2,r=i*e.scale/2,o=e.targetGeometry.clone();return o.x=Math.max(s,Math.min(t-s,o.x)),o.y=Math.max(r,Math.min(i-r,o.y)),e.targetGeometry=o,e};this.constraints.customConstraints.add({constrain:e,applyPanConstraint:e})}_forceReadyCycle(){this.ready&&(m(()=>this.destroyed||!1===this.preconditionsReady,()=>this._readyCycleForced=!1,{once:!0}),this._readyCycleForced=!0)}_groundControlPoints(){return this.layer?.groundControlPoints}};e([h()],I.prototype,"_overlayContainer",void 0),e([h()],I.prototype,"_isValid",void 0),e([h()],I.prototype,"_readyCycleForced",void 0),e([h()],I.prototype,"_effectsContainer",void 0),e([h()],I.prototype,"constraintsInfo",null),e([h()],I.prototype,"operationalDataVisible",void 0),e([h()],I.prototype,"layer",null),e([h()],I.prototype,"map",void 0),e([h({type:L,nonNullable:!0})],I.prototype,"navigation",void 0),e([h({readOnly:!0})],I.prototype,"preconditionsReady",null),e([h({readOnly:!0})],I.prototype,"ready",void 0),e([h({readOnly:!0})],I.prototype,"rendering",null),e([h()],I.prototype,"scale",null),e([h()],I.prototype,"spatialReference",void 0),e([h()],I.prototype,"stateManager",void 0),e([h()],I.prototype,"type",void 0),e([h(),d(e=>e instanceof W?e:g(A,e))],I.prototype,"ui",void 0),e([h({readOnly:!0})],I.prototype,"videoSize",null),e([h({readOnly:!0})],I.prototype,"view2dType",void 0),I=e([c("esri.views.VideoView")],I);const Z=I;export{Z as default};
|
|
@@ -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"../../Graphic.js";import{UndoRedo as o}from"../../UndoRedo.js";import{createTask as r}from"../../core/asyncUtils.js";import{makeHandle as i}from"../../core/handleUtils.js";import{destroyMaybe as s}from"../../core/maybe.js";import{watch as n,syncAndInitial as a,sync as l}from"../../core/reactiveUtils.js";import{property as p,subclass as c}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as d}from"../../core/support/UpdatingHandles.js";import{load as h}from"../../geometry/coordinateFormatter.js";import u from"../../layers/GraphicsLayer.js";import{pointEquals as m}from"../../layers/graphics/dehydratedFeatureComparison.js";import{CreateOperationGeometry as y}from"./support/CreateOperationGeometry.js";import{createCircle as g,createEllipse as v,createSquare as f,createRectangle as _,createPolygon as O,createPolyline as w,createMultipoint as C}from"./support/createUtils.js";import{createViewAlignedCoordinateSystem as G}from"./support/surfaceCoordinateSystems.js";import{createTooltipInfos as x,initializeConstraints as V,updateTooltipInfo as k,getConstraintZ as b,unlockConstraintsOnVertexAddOrRemove as U,lockElevationOnVertexAdd as H,getActiveTooltipInfo as T}from"./support/tooltipUtils.js";import{InteractiveToolBase as S}from"../interactive/InteractiveToolBase.js";import j from"../interactive/sketch/SketchOptions.js";import{makeTooltip as L,pasteLocation as R,enterInputModeIfAvailable as z}from"../interactive/tooltip/tooltipCommonUtils.js";import{MeasurementWorkerHandle as E}from"../support/MeasurementWorkerHandle.js";import{autorun as I}from"../../core/accessorSupport/trackingUtils.js";let A=class extends S{constructor(e){super(e),this._graphic=null,this._coordinateFormatterLoadTask=null,this._createOperationGeometry=null,this.defaultZ=0,this.directionOptions=null,this.elevationLockOnVertexAddDisabled=!1,this.geometryType=null,this.hasZ=!0,this.geometryToPlace=null,this.snappingManager=null,this.snapToScene=!1,this.sketchOptions=new j,this._updatingHandles=new d,this._measurementWorker=new E({preloadGeodetic:!0})}initialize(){const{view:e}=this;this.internalGraphicsLayer=new u({listMode:"hide",internal:!0,title:"DrawGraphicTool layer"}),this.view.map.layers.add(this.internalGraphicsLayer);const t=this.drawOperation=this.makeDrawOperation();this.tooltipInfos=x(e.type,this.sketchOptions);const o=L(()=>({view:e,options:this.sketchOptions.tooltips}));this.tooltip=o,V(this._tooltipsContext),this._coordinateFormatterLoadTask=r(()=>h()),this.addHandles([t.on("vertex-add",e=>this.onVertexAdd(e)),t.on("vertex-remove",e=>this.onVertexRemove(e)),t.on("vertex-update",e=>this.onVertexUpdate(e)),t.on("cursor-update",e=>this.onCursorUpdate(e)),t.on("cursor-remove",()=>this._updateGraphic()),t.on("complete",e=>this.onComplete(e)),this._coordinateFormatterLoadTask,o.on("paste",e=>R(e,this.activeTooltipInfo)),n(()=>this.cursor,e=>{t.cursor=e},a),I(()=>{const{activeTooltipInfo:e,sketchOptions:t}=this;k(e,this._tooltipsContext,this._updatingHandles),o.info=t.tooltips.effectiveEnabled?e:null}),I(()=>{t.constraintZ=b(this._tooltipsContext)},l)]),this.finishToolCreation(),t.initializePointer()}destroy(){this.drawOperation=s(this.drawOperation),this.tooltip=s(this.tooltip),this._destroyAllVisualizations(),this.view.map.remove(this.internalGraphicsLayer),this.internalGraphicsLayer=s(this.internalGraphicsLayer),this._updatingHandles.destroy(),this._measurementWorker.destroy(),this._set("view",null)}get _drawSpatialReference(){return this.drawOperation.coordinateHelper.spatialReference}get _tooltipsContext(){const{defaultZ:e,directionOptions:t,drawOperation:o,forceUniformSize:r,geometryType:i,graphic:s,sketchOptions:n,tooltipInfos:a,view:l,_measurementWorker:p}=this;return{createOperationGeometry:this._createOperationGeometry,defaultZ:e,directionOptions:t,drawOperation:o,forceUniformSize:r,geometryType:i,graphic:s,sketchOptions:n,tooltipInfos:a,view:l,measurementWorker:p}}get canRedo(){return this.drawOperation.canRedo}get canUndo(){return this.drawOperation.canUndo}set centered(e){this._set("centered",e),this._updateGraphic()}get cursor(){return this._get("cursor")}set cursor(e){this._set("cursor",e)}set enabled(e){this.drawOperation.interactive=e,this._set("enabled",e)}set forceUniformSize(e){this._set("forceUniformSize",e),this._updateGraphic()}get graphic(){return this._graphic}set graphicSymbol(e){this._set("graphicSymbol",e),null!=this._graphic&&(this._graphic.symbol=e)}set mode(e){const t=this.drawOperation;t&&(t.drawingMode=e),this._set("mode",e)}get updating(){return(this._updatingHandles.updating||this.drawOperation?.updating)??!1}get undoRedo(){const{view:{type:e,map:t}}=this;return"2d"===e&&t&&"undoRedo"in t&&t.undoRedo instanceof o?t.undoRedo:null}set undoRedo(e){this._override("undoRedo",e)}completeCreateOperation(){this.drawOperation.complete()}onInputEvent(e){this.destroyed||z(e,this.tooltip)||this.drawOperation.onInputEvent(e)}redo(){this.drawOperation.redo()}reset(){}undo(){this.drawOperation.undo(),0===this.drawOperation.numCommittedVertices&&V(this._tooltipsContext)}_destroyAllVisualizations(){this.removeHandles(F.outline),this.removeHandles(F.regularVertices),this.removeHandles(F.activeVertex),this.removeHandles(F.activeEdge),this.removeHandles(D)}_createOrUpdateGraphic(e){if(null!=this._graphic)return this.updateGraphicGeometry(e),this._graphic;const o=new t({...this.graphicProperties,symbol:this.graphicSymbol});return this._graphic=o,this.updateGraphicGeometry(e),this.internalGraphicsLayer.add(o),this.addHandles(this.initializeGraphic(o)),this.notifyChange("graphic"),this.addHandles(i(()=>{this.internalGraphicsLayer.remove(o),this._graphic===o&&(this._graphic=null)}),D),o}updateGraphicGeometry(e){this._graphic.geometry=e}_getCreateOperationGeometry(e={operationComplete:!1}){if(null==this.drawOperation)return;const{coordinateHelper:t,view:o,visualizationCursorVertex:r,lastVertex:i,committedVertices:s,geometryIncludingUncommittedVertices:n,numCommittedVertices:a}=this.drawOperation;if(!(a>0||null!=r))return;const l=e.operationComplete?s:n,p=l.length,c=null!=r?t.pointToArray(r):null,d=this._drawSpatialReference,h="3d"===o.type&&"global"===o.viewingMode,u=new y;u.committedVertices=s,u.cursorVertex=c;const{geometryType:x}=this;switch(x){case"point":case"mesh":u.full=t.arrayToPoint(l[0]);break;case"multipoint":u.full=p>0?C(l,d):null;break;case"polyline":case"polygon":p>0&&(u.full="polygon"===x?O([l],d,h,!0):w([l],d,h),u.cursorEdge=null!=c&&i&&!m(r,i)?w([[c,t.pointToArray(i)]],d,h):null,u.outline=p>1?u.full:null);break;case"circle":case"rectangle":{if(u.committedVertices=u.cursorVertex=null,!p)break;const t=G(o,l[0]),r=l[0],i=t.makeMapPoint(r[0]+P*o.resolution,r[1]);"circle"===x?1===p&&e.operationComplete?u.circle=g([r,i],t,!0):2===p&&(this.forceUniformSize?u.circle=g(l,t,this.centered):u.rectangle=v(l,t,this.centered)):1===p&&e.operationComplete?u.rectangle=f([r,i],t,!0):2===p&&(u.rectangle=this.forceUniformSize?f(l,t,this.centered):_(l,t,this.centered)),u.full=null!=u.circle?u.circle.geometry:u.rectangle?.geometry,u.outline="polygon"===u.full?.type?u.full:null;break}default:return null}return u}initializeGraphic(e){return i()}onComplete(e){if(!this.drawOperation)return;this._updateGraphic();let t=null;if(this.drawOperation.isCompleted){const e=this._getCreateOperationGeometry({operationComplete:!0});null!=e&&(t=this._createOrUpdateGraphic(e.full))}this._createOperationGeometry=null,this.emit("complete",{graphic:t,...e})}onCursorUpdate(e){this._updateGraphic(),this.emit("cursor-update",e)}onDeactivate(){const{drawOperation:e}=this;e&&(e.isCompleted||e.cancel())}onOutlineChanged(e){return i()}onCursorEdgeChanged(e){return i()}onVertexAdd(e){U(this._tooltipsContext),this._updateGraphic(),this.elevationLockOnVertexAddDisabled||H(e.vertices.at(0)?.coordinates,this._tooltipsContext),this.emit("vertex-add",e)}onVertexRemove(e){U(this._tooltipsContext),this._updateGraphic(),this.emit("vertex-remove",e)}onVertexUpdate(e){this._updateGraphic(),this.emit("vertex-update",e)}_updateGraphic(){const e=this._getCreateOperationGeometry();this._createOperationGeometry=e,null!=e?(null!=e.cursorEdge?this.addHandles(this.onCursorEdgeChanged(e.cursorEdge),F.activeEdge):this.removeHandles(F.activeEdge),null!=e.outline?this.addHandles(this.onOutlineChanged(e.outline),F.outline):this.removeHandles(F.outline),null!=e.committedVertices?this.addHandles(this.onRegularVerticesChanged(e.committedVertices),F.regularVertices):this.removeHandles(F.regularVertices),null!=e.cursorVertex?this.addHandles(this.onActiveVertexChanged(e.cursorVertex),F.activeVertex):this.removeHandles(F.activeVertex),null!=e.full?this._createOrUpdateGraphic(e.full):this.removeHandles(D)):this._destroyAllVisualizations()}get activeTooltipInfo(){return this._coordinateFormatterLoadTask?.finished?T(this._tooltipsContext):null}};e([p()],A.prototype,"_coordinateFormatterLoadTask",void 0),e([p()],A.prototype,"_createOperationGeometry",void 0),e([p()],A.prototype,"_tooltipsContext",null),e([p({value:!0})],A.prototype,"centered",null),e([p()],A.prototype,"cursor",null),e([p({nonNullable:!0})],A.prototype,"defaultZ",void 0),e([p({constructOnly:!0})],A.prototype,"directionOptions",void 0),e([p()],A.prototype,"drawOperation",void 0),e([p()],A.prototype,"elevationLockOnVertexAddDisabled",void 0),e([p({value:!0})],A.prototype,"enabled",null),e([p({value:!0})],A.prototype,"forceUniformSize",null),e([p({constructOnly:!0})],A.prototype,"geometryType",void 0),e([p()],A.prototype,"graphic",null),e([p({constructOnly:!0})],A.prototype,"graphicProperties",void 0),e([p()],A.prototype,"graphicSymbol",null),e([p({constructOnly:!0})],A.prototype,"hasZ",void 0),e([p({constructOnly:!0})],A.prototype,"geometryToPlace",void 0),e([p()],A.prototype,"mode",null),e([p()],A.prototype,"snappingManager",void 0),e([p()],A.prototype,"snapToScene",void 0),e([p()],A.prototype,"tooltip",void 0),e([p()],A.prototype,"tooltipInfos",void 0),e([p({constructOnly:!0,type:j})],A.prototype,"sketchOptions",void 0),e([p()],A.prototype,"updating",null),e([p({constructOnly:!0,nonNullable:!0})],A.prototype,"view",void 0),e([p({constructOnly:!0})],A.prototype,"undoRedo",null),e([p()],A.prototype,"activeTooltipInfo",null),A=e([c("esri.views.draw.DrawGraphicTool")],A);const D=Symbol("create-operation-graphic"),F={outline:Symbol("outline-visual"),regularVertices:Symbol("regular-vertices-visual"),activeVertex:Symbol("active-vertex-visual"),activeEdge:Symbol("active-edge-visual")};function M(e){switch(e){case"point":case"polyline":case"polygon":case"multipoint":return e;case"circle":case"rectangle":return"segment";case"mesh":return"point"}}const P=48;export{A as DrawGraphicTool,M as geometryTypeToDrawOperationGeometryType};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../Graphic.js";import{UndoRedo as o}from"../../UndoRedo.js";import{createTask as r}from"../../core/asyncUtils.js";import{makeHandle as i}from"../../core/handleUtils.js";import{destroyMaybe as s}from"../../core/maybe.js";import{watch as n,syncAndInitial as a,sync as l}from"../../core/reactiveUtils.js";import{property as p,subclass as c}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as d}from"../../core/support/UpdatingHandles.js";import{load as h}from"../../geometry/coordinateFormatter.js";import u from"../../layers/GraphicsLayer.js";import{pointEquals as m}from"../../layers/graphics/dehydratedFeatureComparison.js";import{CreateOperationGeometry as y}from"./support/CreateOperationGeometry.js";import{createCircle as g,createEllipse as v,createSquare as f,createRectangle as _,createPolygon as O,createPolyline as w,createMultipoint as G}from"./support/createUtils.js";import{createViewAlignedCoordinateSystem as C}from"./support/surfaceCoordinateSystems.js";import{createTooltipInfos as x,initializeConstraints as V,updateTooltipInfo as k,getConstraintZ as b,unlockConstraintsOnVertexAddOrRemove as U,lockElevationOnVertexAdd as H,getActiveTooltipInfo as T}from"./support/tooltipUtils.js";import{InteractiveToolBase as S}from"../interactive/InteractiveToolBase.js";import j from"../interactive/sketch/SketchOptions.js";import{makeTooltip as L,pasteLocation as R,enterInputModeIfAvailable as z}from"../interactive/tooltip/tooltipCommonUtils.js";import{GeometryWorkerHandle as E}from"../support/GeometryWorkerHandle.js";import{autorun as I}from"../../core/accessorSupport/trackingUtils.js";let A=class extends S{constructor(e){super(e),this._graphic=null,this._coordinateFormatterLoadTask=null,this._createOperationGeometry=null,this.defaultZ=0,this.directionOptions=null,this.elevationLockOnVertexAddDisabled=!1,this.geometryType=null,this.hasZ=!0,this.geometryToPlace=null,this.snappingManager=null,this.snapToScene=!1,this.sketchOptions=new j,this._updatingHandles=new d,this._measurementWorker=new E({preloadGeodetic:!0})}initialize(){const{view:e}=this;this.internalGraphicsLayer=new u({listMode:"hide",internal:!0,title:"DrawGraphicTool layer"}),this.view.map.layers.add(this.internalGraphicsLayer);const t=this.drawOperation=this.makeDrawOperation();this.tooltipInfos=x(e.type,this.sketchOptions);const o=L(()=>({view:e,options:this.sketchOptions.tooltips}));this.tooltip=o,V(this._tooltipsContext),this._coordinateFormatterLoadTask=r(()=>h()),this.addHandles([t.on("vertex-add",e=>this.onVertexAdd(e)),t.on("vertex-remove",e=>this.onVertexRemove(e)),t.on("vertex-update",e=>this.onVertexUpdate(e)),t.on("cursor-update",e=>this.onCursorUpdate(e)),t.on("cursor-remove",()=>this._updateGraphic()),t.on("complete",e=>this.onComplete(e)),this._coordinateFormatterLoadTask,o.on("paste",e=>R(e,this.activeTooltipInfo)),n(()=>this.cursor,e=>{t.cursor=e},a),I(()=>{const{activeTooltipInfo:e,sketchOptions:t}=this;k(e,this._tooltipsContext,this._updatingHandles),o.info=t.tooltips.effectiveEnabled?e:null}),I(()=>{t.constraintZ=b(this._tooltipsContext)},l)]),this.finishToolCreation(),t.initializePointer()}destroy(){this.drawOperation=s(this.drawOperation),this.tooltip=s(this.tooltip),this._destroyAllVisualizations(),this.view.map.remove(this.internalGraphicsLayer),this.internalGraphicsLayer=s(this.internalGraphicsLayer),this._updatingHandles.destroy(),this._measurementWorker.destroy(),this._set("view",null)}get _drawSpatialReference(){return this.drawOperation.coordinateHelper.spatialReference}get _tooltipsContext(){const{defaultZ:e,directionOptions:t,drawOperation:o,forceUniformSize:r,geometryType:i,graphic:s,sketchOptions:n,tooltipInfos:a,view:l,_measurementWorker:p}=this;return{createOperationGeometry:this._createOperationGeometry,defaultZ:e,directionOptions:t,drawOperation:o,forceUniformSize:r,geometryType:i,graphic:s,sketchOptions:n,tooltipInfos:a,view:l,measurementWorker:p}}get canRedo(){return this.drawOperation.canRedo}get canUndo(){return this.drawOperation.canUndo}set centered(e){this._set("centered",e),this._updateGraphic()}get cursor(){return this._get("cursor")}set cursor(e){this._set("cursor",e)}set enabled(e){this.drawOperation.interactive=e,this._set("enabled",e)}set forceUniformSize(e){this._set("forceUniformSize",e),this._updateGraphic()}get graphic(){return this._graphic}set graphicSymbol(e){this._set("graphicSymbol",e),null!=this._graphic&&(this._graphic.symbol=e)}set mode(e){const t=this.drawOperation;t&&(t.drawingMode=e),this._set("mode",e)}get updating(){return(this._updatingHandles.updating||this.drawOperation?.updating)??!1}get undoRedo(){const{view:{type:e,map:t}}=this;return"2d"===e&&t&&"undoRedo"in t&&t.undoRedo instanceof o?t.undoRedo:null}set undoRedo(e){this._override("undoRedo",e)}completeCreateOperation(){this.drawOperation.complete()}onInputEvent(e){this.destroyed||z(e,this.tooltip)||this.drawOperation.onInputEvent(e)}redo(){this.drawOperation.redo()}reset(){}undo(){this.drawOperation.undo(),0===this.drawOperation.numCommittedVertices&&V(this._tooltipsContext)}_destroyAllVisualizations(){this.removeHandles(F.outline),this.removeHandles(F.regularVertices),this.removeHandles(F.activeVertex),this.removeHandles(F.activeEdge),this.removeHandles(D)}_createOrUpdateGraphic(e){if(null!=this._graphic)return this.updateGraphicGeometry(e),this._graphic;const o=new t({...this.graphicProperties,symbol:this.graphicSymbol});return this._graphic=o,this.updateGraphicGeometry(e),this.internalGraphicsLayer.add(o),this.addHandles(this.initializeGraphic(o)),this.notifyChange("graphic"),this.addHandles(i(()=>{this.internalGraphicsLayer.remove(o),this._graphic===o&&(this._graphic=null)}),D),o}updateGraphicGeometry(e){this._graphic.geometry=e}_getCreateOperationGeometry(e={operationComplete:!1}){if(null==this.drawOperation)return;const{coordinateHelper:t,view:o,visualizationCursorVertex:r,lastVertex:i,committedVertices:s,geometryIncludingUncommittedVertices:n,numCommittedVertices:a}=this.drawOperation;if(!(a>0||null!=r))return;const l=e.operationComplete?s:n,p=l.length,c=null!=r?t.pointToArray(r):null,d=this._drawSpatialReference,h="3d"===o.type&&"global"===o.viewingMode,u=new y;u.committedVertices=s,u.cursorVertex=c;const{geometryType:x}=this;switch(x){case"point":case"mesh":u.full=t.arrayToPoint(l[0]);break;case"multipoint":u.full=p>0?G(l,d):null;break;case"polyline":case"polygon":p>0&&(u.full="polygon"===x?O([l],d,h,!0):w([l],d,h),u.cursorEdge=null!=c&&i&&!m(r,i)?w([[c,t.pointToArray(i)]],d,h):null,u.outline=p>1?u.full:null);break;case"circle":case"rectangle":{if(u.committedVertices=u.cursorVertex=null,!p)break;const t=C(o,l[0]),r=l[0],i=t.makeMapPoint(r[0]+Z*o.resolution,r[1]);"circle"===x?1===p&&e.operationComplete?u.circle=g([r,i],t,!0):2===p&&(this.forceUniformSize?u.circle=g(l,t,this.centered):u.rectangle=v(l,t,this.centered)):1===p&&e.operationComplete?u.rectangle=f([r,i],t,!0):2===p&&(u.rectangle=this.forceUniformSize?f(l,t,this.centered):_(l,t,this.centered)),u.full=null!=u.circle?u.circle.geometry:u.rectangle?.geometry,u.outline="polygon"===u.full?.type?u.full:null;break}default:return null}return u}initializeGraphic(e){return i()}onComplete(e){if(!this.drawOperation)return;this._updateGraphic();let t=null;if(this.drawOperation.isCompleted){const e=this._getCreateOperationGeometry({operationComplete:!0});null!=e&&(t=this._createOrUpdateGraphic(e.full))}this._createOperationGeometry=null,this.emit("complete",{graphic:t,...e})}onCursorUpdate(e){this._updateGraphic(),this.emit("cursor-update",e)}onDeactivate(){const{drawOperation:e}=this;e&&(e.isCompleted||e.cancel())}onOutlineChanged(e){return i()}onCursorEdgeChanged(e){return i()}onVertexAdd(e){U(this._tooltipsContext),this._updateGraphic(),this.elevationLockOnVertexAddDisabled||H(e.vertices.at(0)?.coordinates,this._tooltipsContext),this.emit("vertex-add",e)}onVertexRemove(e){U(this._tooltipsContext),this._updateGraphic(),this.emit("vertex-remove",e)}onVertexUpdate(e){this._updateGraphic(),this.emit("vertex-update",e)}_updateGraphic(){const e=this._getCreateOperationGeometry();this._createOperationGeometry=e,null!=e?(null!=e.cursorEdge?this.addHandles(this.onCursorEdgeChanged(e.cursorEdge),F.activeEdge):this.removeHandles(F.activeEdge),null!=e.outline?this.addHandles(this.onOutlineChanged(e.outline),F.outline):this.removeHandles(F.outline),null!=e.committedVertices?this.addHandles(this.onRegularVerticesChanged(e.committedVertices),F.regularVertices):this.removeHandles(F.regularVertices),null!=e.cursorVertex?this.addHandles(this.onActiveVertexChanged(e.cursorVertex),F.activeVertex):this.removeHandles(F.activeVertex),null!=e.full?this._createOrUpdateGraphic(e.full):this.removeHandles(D)):this._destroyAllVisualizations()}get activeTooltipInfo(){return this._coordinateFormatterLoadTask?.finished?T(this._tooltipsContext):null}};e([p()],A.prototype,"_coordinateFormatterLoadTask",void 0),e([p()],A.prototype,"_createOperationGeometry",void 0),e([p()],A.prototype,"_tooltipsContext",null),e([p({value:!0})],A.prototype,"centered",null),e([p()],A.prototype,"cursor",null),e([p({nonNullable:!0})],A.prototype,"defaultZ",void 0),e([p({constructOnly:!0})],A.prototype,"directionOptions",void 0),e([p()],A.prototype,"drawOperation",void 0),e([p()],A.prototype,"elevationLockOnVertexAddDisabled",void 0),e([p({value:!0})],A.prototype,"enabled",null),e([p({value:!0})],A.prototype,"forceUniformSize",null),e([p({constructOnly:!0})],A.prototype,"geometryType",void 0),e([p()],A.prototype,"graphic",null),e([p({constructOnly:!0})],A.prototype,"graphicProperties",void 0),e([p()],A.prototype,"graphicSymbol",null),e([p({constructOnly:!0})],A.prototype,"hasZ",void 0),e([p({constructOnly:!0})],A.prototype,"geometryToPlace",void 0),e([p()],A.prototype,"mode",null),e([p()],A.prototype,"snappingManager",void 0),e([p()],A.prototype,"snapToScene",void 0),e([p()],A.prototype,"tooltip",void 0),e([p()],A.prototype,"tooltipInfos",void 0),e([p({constructOnly:!0,type:j})],A.prototype,"sketchOptions",void 0),e([p()],A.prototype,"updating",null),e([p({constructOnly:!0,nonNullable:!0})],A.prototype,"view",void 0),e([p({constructOnly:!0})],A.prototype,"undoRedo",null),e([p()],A.prototype,"activeTooltipInfo",null),A=e([c("esri.views.draw.DrawGraphicTool")],A);const D=Symbol("create-operation-graphic"),F={outline:Symbol("outline-visual"),regularVertices:Symbol("regular-vertices-visual"),activeVertex:Symbol("active-vertex-visual"),activeEdge:Symbol("active-edge-visual")};function P(e){switch(e){case"point":case"polyline":case"polygon":case"multipoint":return e;case"circle":case"rectangle":return"segment";case"mesh":return"point"}}const Z=48;export{A as DrawGraphicTool,P as geometryTypeToDrawOperationGeometryType};
|
package/views/draw/DrawTool.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__addDisposableResource as e,__disposeResources as t,__decorate as i}from"tslib";import{createTask as n}from"../../core/asyncUtils.js";import{makeHandle as a,disposable as s}from"../../core/handleUtils.js";import r from"../../core/Logger.js";import{getOrCreateMapValue as o}from"../../core/MapUtils.js";import{destroyMaybe as l,abortMaybe as d}from"../../core/maybe.js";import{when as p,initial as c,watch as u,syncAndInitial as h,on as g,sync as m}from"../../core/reactiveUtils.js";import{screenPointEqual as v,createScreenPoint as y}from"../../core/screenUtils.js";import{diff as f}from"../../core/accessorSupport/diffUtils.js";import{property as _}from"../../core/accessorSupport/decorators/property.js";import{subclass as M}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as b}from"../../core/support/UpdatingHandles.js";import w from"../../geometry/Polygon.js";import{i as S,e as C}from"../../chunks/simplifyOperator.js";import{isExtent as x}from"../../geometry/support/jsonTypeUtils.js";import{isPolygon as P}from"../../geometry/support/typeUtils.js";import{isCurvedGeometry as H}from"../../geometry/support/curves/curveUtils.js";import{densifyCurvedGeometry as L}from"../../geometry/support/curves/densifyCurvedGeometry.js";import{getEffectiveElevationInfo as k}from"../../support/elevationInfoUtils.js";import{getMaxDeviationInPixels as I,getMinSegmentsPerCurve as O}from"../2d/layers/graphics/densificationConstants.js";import{createSnappingVisualizer as G}from"./support/createSnappingVisualizer.js";import{multipointFromGeometry as j,markHandled as T,getPointerType as V}from"./support/drawToolUtils.js";import{PluginContext as E}from"./support/PluginContext.js";import{viewEventToCommand as D}from"./support/input/drawToolInput.js";import{EditSessionManager as U}from"./support/managers/EditSessionManager.js";import{GlobalStateManager as A}from"./support/managers/GlobalStateManager.js";import{InteractiveHandleManager as R}from"./support/managers/InteractiveHandleManager.js";import{MeasurementManager as F}from"./support/managers/MeasurementManager.js";import{PluginLifecycleManager as Z}from"./support/managers/PluginLifecycleManager.js";import{SurfaceManager as B}from"./support/managers/SurfaceManager.js";import{TooltipManager as q}from"./support/managers/TooltipManager.js";import{ViewEventPriorities as z}from"../input/InputManager.js";import{createCoordinateHelper as K}from"../interactive/coordinateHelper.js";import{InteractiveToolBase as N}from"../interactive/InteractiveToolBase.js";import{KeyBindings as Q,mediaKeys as W,sketchKeys as $,advancedSketchKeys as J,tooltipKeys as X}from"../interactive/keybindings.js";import{isInputModeAvailable as Y}from"../interactive/tooltip/tooltipCommonUtils.js";const ee=Symbol();let te=class extends N{constructor(e){super(e),this._shapeVisualId=Symbol(),this._vertexVisualId=Symbol(),this._pluginContexts=new Map,this._queuedFeedbackEvents=[],this._flushingQueuedFeedbackEvents=!1,this._commandsSuspended=!1,this._snappingVisualizer=null,this._segmentLabels=null,this._segmentLabelsImportTask=null,this._updatingHandles=new b,this._keybindings=this._makeKeyBindings(),this._pendingBeginRequest=null,this.type="draw-2.0",this.automaticManipulatorSelection=!0,this.snappingManager=null,this.sketchOptions=null,this.elevationInfo=null,this.hasZ=!1,this.defaultZ=0,this.lastScreenPosition=null,this.measurementManager=new F,this.globalStateManager=new A({getPluginStack:()=>this.pluginStack}),this.editSessionManager=new U({getContext:()=>this._editSessionManagerContext}),this.lifecycleManager=new Z({getContext:this._getContextForPlugin.bind(this),editSessionManager:this.editSessionManager,afterAttach:this._afterAttach.bind(this),afterDetach:this._afterDetach.bind(this),beforeResume:this._beforeResume.bind(this)}),this.surfaceManager=null,this.interactiveHandleManager=null,this.renderer=null,this.enableVertexVisuals=!0}initialize(){const{view:e}=this;this.interactiveHandleManager=new R({view:e,renderer:this.renderer}),this._override("manipulators",this.interactiveHandleManager.manipulators),this.tooltipManager=new q({getDependencies:()=>this._tooltipDependencies,getLastScreenPosition:()=>this.lastScreenPosition}),this.addHandles(p(()=>this.renderer,t=>{t.addOrUpdateVisual(this._shapeVisualId,{role:"outputGeometry"}),t.addOrUpdateVisual(this._vertexVisualId,{role:"vertex"}),this._updatingHandles.addPromise(G(e,t).then(e=>this._snappingVisualizer=e))},c)),this.addHandles([u(()=>[this.view,this.coordinateHelper.spatialReference,this.defaultZ,this.hasZ,this.elevationInfo],([e,t,i,n,a])=>{this.surfaceManager?.destroy(),this.surfaceManager=new B({spatialReference:t,excludedGraphicsLayer:null,defaultZ:i,hasZ:n,view:e,elevationInfo:a,getContext:()=>({drawAtFixedElevation:this.globalStateManager.drawAtFixedElevation,elevationConstraint:this.tooltipManager?.elevationConstraint,constraintsEnabled:this.tooltipManager?.constraintsEnabled??!1})})},h),p(()=>this.sketchOptions?.tooltips.effectiveEnabled,()=>this.measurementManager.preloadMeasurementUtils(),{once:!0,initial:!0}),u(()=>[this.editGeometryOperations,this.sketchOptions?.labels.enabled,this.globalStateManager.segmentLabelsDisabled],()=>{this._updatingHandles.addPromise(this._setupSegmentLabels())},c),g(()=>this.editSessionManager,"cancelPlugin",({plugin:e})=>{this._suspendPlugin(e)},m),g(()=>this.editSessionManager,"restartPlugin",({restartInfo:e})=>{this._resumePlugin(e)},m),u(()=>this.lifecycleManager.updating,e=>{e||this._emitQueuedFeedbackEvents()},m),g(()=>this.editGeometryOperations,["vertex-add","vertex-update","vertex-remove"],e=>{const t=e.vertices.map(e=>({componentIndex:0,vertexIndex:e.index,coordinates:this.coordinateHelper.vectorToArray(e.pos)})),i=t.map(e=>e.coordinates);switch(e.type){case"vertex-add":this._emitWhenReady(e.type,{...e,added:i,vertices:t});break;case"vertex-update":this._emitWhenReady(e.type,{...e,updated:i,vertices:t});break;case"vertex-remove":this._emitWhenReady(e.type,{...e,removed:i,vertices:t})}})])}destroy(){this.active&&this.onDeactivate(),this.editSessionManager.destroy(),this.lifecycleManager.destroy(),this.measurementManager.destroy(),this.globalStateManager.destroy();for(const e of this._pluginContexts.values())e.destroy();this._pluginContexts.clear(),this.surfaceManager=l(this.surfaceManager),this.interactiveHandleManager=l(this.interactiveHandleManager),this._segmentLabelsImportTask=d(this._segmentLabelsImportTask),this._segmentLabels=l(this._segmentLabels),this.tooltipManager=l(this.tooltipManager)}get _zOfLastUserInput(){const e=this.mostDownstreamPlugin&&this.editSessionManager.getSession(this.mostDownstreamPlugin),t=e?.firstPointAddedBySession?.point;return t?.hasZ?t.z:null}get _tooltipDependencies(){const{defaultZ:e,editGeometryOperations:t,sketchOptions:i,directionOptions:n,elevationInfo:a,view:s}=this;return t&&i&&s?{defaultZ:e,directionOptions:n,elevationInfo:a,editGeometryOperations:t,sketchOptions:i,view:s,getActiveHandle:()=>this.interactiveHandleManager?.focusedHandle,getAllHandles:()=>this.interactiveHandleManager?.allhandles,getHelpMessageKey:()=>this.helpMessageKey,notifyTooltipsChanged:()=>{const{interactiveHandleManager:e,movementCommandContext:t}=this;e&&t&&e.reapplyPositions(t)}}:null}get _editSessionManagerContext(){const{coordinateHelper:e,view:t}=this;if(!t)return null;return{coordinateHelper:e,viewingMode:"3d"===t.type&&"global"===t.viewingMode?1:2}}get _densificationParameters(){const{view:e,coordinateHelper:t}=this,i=t.spatialReference,n=e?.spatialReference,a=e.resolution;if(!(i&&n&&a&&Number.isFinite(a)))return null;const s=n.metersPerUnit/i.metersPerUnit;return{maxDeviation:2**Math.round(Math.log2(a))*I()*s,minSegmentsPerCurve:O()}}get test(){return{densificationParameters:this._densificationParameters,segmentLabels:this._segmentLabels}}get updating(){return this._updatingHandles.updating||this.lifecycleManager.updating||!!this._segmentLabels?.updating}get coordinateHelper(){return K(this.hasZ,!1,this.view.spatialReference)}get editGeometry(){return this.editGeometryOperations?.data}get editGeometryOperations(){return this.editSessionManager.editGeometryOperations}get unprocessedGeometry(){return this.editSessionManager.outputGeometry}get simplifiedGeometryPreview(){const e=this.editSessionManager.outputGeometry;if(e&&P(e))try{const t=this._densificationParameters,i=H(e)&&t?new w({...L(e,t)}):e;if(!S(i))return C(i)}catch(t){return e}return e}get _suppressCoincidentPointOverlaysIn3D(){return"3d"===this.view.type&&"point"===this.unprocessedGeometry?.type&&!!this.interactiveHandleManager?.allhandles?.find(e=>"primary"===e.role)?.outputMapPosition}get _shapeVisualGeometry(){return this._suppressCoincidentPointOverlaysIn3D?null:this.simplifiedGeometryPreview}get _vertexVisualGeometry(){return this._suppressCoincidentPointOverlaysIn3D?null:this.unprocessedGeometry}get canUndo(){return this.editSessionManager.canUndo}get canRedo(){return this.editSessionManager.canRedo}get pluginStack(){return this.lifecycleManager.pluginStack}get mostDownstreamPlugin(){return this.pluginStack.at(-1)}get mostUpstreamPlugin(){return this.pluginStack.at(0)}get positionOfLastUserInput(){const e=this.lastScreenPosition;return e?this.surfaceManager?.screenToMap(e,{firstPointZ:this._zOfLastUserInput})??this.view.toMap(e):this.view.center}get movementCommandContext(){const{editGeometryOperations:e,tooltipManager:t,surfaceManager:i,snappingManager:n,interactiveHandleManager:a,_snappingVisualizer:s,defaultZ:r,hasZ:o,globalStateManager:{drawAtFixedElevation:l},view:d}=this;return{tooltipManager:t,editGeometryOperations:e,surfaceManager:i,interactiveHandleManager:a,snappingManager:n,snappingVisualizer:s,pointerType:"mouse",hasZ:o,defaultZ:r,view:d,drawAtFixedElevation:l}}get tooltip(){return this.tooltipManager?.tooltip}get activeTooltipInfo(){return this.tooltipManager?.tooltipInfo}get helpMessageKey(){return this.pluginStack.items.findLast(e=>e.helpMessageKey)?.helpMessageKey??"noTool"}begin(e){this.active?(this.lifecycleManager.begin(e),this._pendingBeginRequest=null):this._pendingBeginRequest=e}complete(e){const t=this.lifecycleManager;e&&t.complete(e),0===t.pluginStack.length&&(this._finalizeAndSimplifyGeometryResult(),this.emit("complete",{geometry:this.finalGeometry,aborted:!1,type:"complete",vertices:[]}),this.view?.activeTool===this&&(this.view.activeTool=null))}cancelFirstUserLeafPlugin(){const e=this.pluginStack.toArray().findLast(e=>!0!==e.configuration?.hidden);e&&this.lifecycleManager.cancel(e)}getVertexSnappingCandidates(){return"secondary"===this.interactiveHandleManager?.capturingHandle?.role?[]:this.snappingManager?.getVertexCandidates()??[]}replaceLeaf(e){const t=this.lifecycleManager;t.updating?r.getLogger(this).info("Ignoring command; arrived while updating:","replaceLeaf"):t.replaceLeaf(e)}finishPart(){const e=this.mostUpstreamPlugin,t=e?.configuration;if(this.editGeometryOperations&&t&&t.kind?.includes("multipart")){const e=this.pluginStack.at(1);e&&this.complete(e)}}undo(){this._handleCommand({action:"undo"})}redo(){this._handleCommand({action:"redo"})}executeCommand(e){return this._handleCommand(e)}suspendCommands(){return this._commandsSuspended=!0,a(()=>{this._commandsSuspended=!1;const e=this.view?.inputManager.latestPointerInfo;if(e){const{x:t,y:i}=e.location;this._handleCommand({action:"manipulator-move-to",x:t,y:i})}})}addPromise(e){return this._updatingHandles.addPromise(e)}getGeometryIfCompleted(){const e=this.lifecycleManager.gatherCompletablePlugins();return this.editSessionManager?.generatePreviewGeometryForPlugins(e)}onActivate(){super.onActivate();const{view:e}=this;this.lastScreenPosition=e?.inputManager.latestPointerInfo?.location,this.renderer?.activate(),this._pendingBeginRequest&&(this.begin(this._pendingBeginRequest),this._pendingBeginRequest=null),this.enableVertexVisuals&&this.addHandles(u(()=>this._vertexVisualGeometry,e=>{this.renderer?.addOrUpdateVisual(this._vertexVisualId,{geometry:e?j(e):null})},c)),this.addHandles([u(()=>this._shapeVisualGeometry,e=>{this.renderer?.addOrUpdateVisual(this._shapeVisualId,{geometry:e})},c),p(()=>this.interactiveHandleManager?.capturingHandle?.screenPosition,e=>this.lastScreenPosition=e,{initial:!0,equals:v}),u(()=>this.interactiveHandleManager?.capturingHandle?.outputMapPosition,(e,t)=>{const i=this.interactiveHandleManager?.capturingHandle?.editSession?.endVertex;e&&t&&i&&this._emitWhenReady("cursor-update",{updated:i.pos,type:"vertex-update",operation:"apply",vertices:[{componentIndex:i.part.index,vertexIndex:i.index,coordinates:i.pos}]})},m),this._keybindings.register(e,z.TOOL),u(()=>e.viewpoint,(e,t)=>{e&&t&&f(e,t)&&this._handleCommand({action:"viewpoint-moved"})})],ee)}onDeactivate(){super.onDeactivate(),this.removeHandles(ee),this.renderer?.deactivate(),this.snappingManager?.doneSnapping(),this.lifecycleManager.cancelAll(),this._pendingBeginRequest=null}onInputEvent(e){const t=D(e);t&&this._handleCommand(t)}forceAddVertex(){this._commitNext()}_emitWhenReady(e,t){if(this.destroyed)return;const i=()=>{this.emit(e,t)};this.lifecycleManager.updating||this._flushingQueuedFeedbackEvents?this._queuedFeedbackEvents.push(i):i()}_emitQueuedFeedbackEvents(){if(!(this.destroyed||this._flushingQueuedFeedbackEvents||this.lifecycleManager.updating||0===this._queuedFeedbackEvents.length)){this._flushingQueuedFeedbackEvents=!0;try{for(;!this.destroyed&&!this.lifecycleManager.updating&&this._queuedFeedbackEvents.length>0;)this._queuedFeedbackEvents.shift()?.()}finally{this._flushingQueuedFeedbackEvents=!1}}}async _handleCommand(e){if(!this._commandsSuspended)if(this.lifecycleManager.updating)r.getLogger(this).info("Ignoring command; arrived while updating:",e.action);else switch(e.action){case"view-drag":return await this._handleViewDragCommand(e);case"vertex-add":return this._guardCommand(e,()=>{T(e),this._commitNext()});case"vertex-add-and-finish-part":return this._handleVertexAddAndFinishPartCommand(e);case"cancel":return this._guardCommand(e,()=>this.cancel());case"complete":return this._guardCommand(e,()=>{this.mostUpstreamPlugin&&(T(e),this.complete(this.mostUpstreamPlugin))});case"finish-part":return this._guardCommand(e,()=>this.finishPart());case"undo":return this._guardCommand(e,()=>this.editSessionManager.undo());case"redo":return this._guardCommand(e,()=>this.editSessionManager.redo());case"next-manipulator":return this._guardCommand(e,()=>this.interactiveHandleManager?.cycleManipulator("forward"));case"previous-manipulator":return this._guardCommand(e,()=>this.interactiveHandleManager?.cycleManipulator("backward"));case"toggle-manipulator-follow":this.interactiveHandleManager?.toggleFollow()&&T(e);break;case"viewpoint-moved":return await this._handleViewpointMovedCommand(e);case"manipulator-move-to":return await this._handleManipulatorMoveToCommand(e);case"manipulator-drag-to":return await this._handleManipulatorDragToCommand(e);case"vertex-add-at-point":return await this._handleVertexAddAtPointCommand(e);case"show-tooltip":return this._guardCommand(e,async()=>{const t=this.tooltipManager?.tooltip;t&&Y(t.info)&&(await t.enterInputMode(),T(e))});case"constraint-center":this.globalStateManager.setCentered(e.enabled);break;case"constraint-aspect":this.globalStateManager.setPreserveAspectRatio(e.enabled)}}async _handleViewDragCommand(e){if(!this.editable)return;const t=e.originalEvent,i=this.interactiveHandleManager?.capturingHandle;(!t||!("pointerType"in t)||"touch"!==t.pointerType||"capture-always"!==i?.captureMode&&"capture-when-engaged"!==i?.captureMode)&&"capture-when-engaged"!==this.interactiveHandleManager?.capturingHandle?.captureMode?this._before(e)&&T(e):T(e)}_handleVertexAddAndFinishPartCommand(e){this._before(e)||(T(e),this._commitNext(),this.finishPart())}async _handleViewpointMovedCommand(e){this.editable&&(await this._updatingHandles.addPromise(this.interactiveHandleManager?.capturingHandle?.moveTo(null,{...this.movementCommandContext,pointerType:V(e.originalEvent)})),this.interactiveHandleManager?.updateAllScreenPositions(this.movementCommandContext.surfaceManager))}async _handleManipulatorMoveToCommand(e){if(!this.editable)return;const t=this._updateLastScreenPosition(e);this.interactiveHandleManager?.capturingHandle&&T(e),await this._updatingHandles.addPromise(this.interactiveHandleManager?.capturingHandle?.moveTo(t,{...this.movementCommandContext,pointerType:V(e.originalEvent)}))}async _handleManipulatorDragToCommand(e){if(!this.editable)return;const t=V(e.originalEvent),i=this._updateLastScreenPosition(e),n=this.interactiveHandleManager?.findHandleByManipulator(i,t);"touch"===t&&n&&"start"===e.state&&this.interactiveHandleManager?.releaseHandle();const a=this.interactiveHandleManager?.findHandleDragging(),s=this.interactiveHandleManager?.capturingHandle,r=a??s??n;r&&!n&&T(e),"capture-when-engaged"===r?.captureMode||"capture-always"===r?.captureMode&&"touch"===t?"end"===e.state?await this._updatingHandles.addPromise(r.noteDragEnd(i,{...this.movementCommandContext,pointerType:t}).then(()=>{r&&"touch"===V(e.originalEvent)&&"grabbable-object"!==r.captureMode&&"capture-when-engaged"!==r.defaultCaptureMode&&"primary"===r.role&&(1===this.interactiveHandleManager?.handleCount?this._handleCommand({action:"vertex-add"}):this.interactiveHandleManager?.releaseHandle())})):"start"===e.state?await this._updatingHandles.addPromise(r.noteDragStart(i,{...this.movementCommandContext,pointerType:t}).then(()=>{r&&"touch"===V(e.originalEvent)&&"grabbable-object"!==r.captureMode&&"capture-when-engaged"!==r.defaultCaptureMode&&!r.editSession?.lastPointAddedBySession&&this._handleCommand({action:"vertex-add"})})):await this._updatingHandles.addPromise(r?.moveTo(i,{...this.movementCommandContext,pointerType:V(e.originalEvent)})):"grabbable-object"===r?.captureMode&&(this.interactiveHandleManager?.releaseHandle(s),await this._updatingHandles.addPromise(r.moveTo(i,{...this.movementCommandContext,pointerType:t})))}async _handleVertexAddAtPointCommand(e){const t=this._updateLastScreenPosition(e),i=V(e.originalEvent),n=this.interactiveHandleManager?.capturingHandle??this.interactiveHandleManager?.findHandleByManipulator(t,i);this.editable&&n&&(this._before(e)||(T(e),await this._updatingHandles.addPromise(n.moveTo(t,{...this.movementCommandContext,skipSnapping:!0,pointerType:i}).finally(()=>this._commitNext()))))}_makeKeyBindings(){const e=new Q,t=(t,i)=>{e.addToggle(t,e=>this._handleCommand({action:i,originalEvent:e,enabled:"key-down"===e.type}))},i=(t,i)=>{e.add(t,e=>this._handleCommand({action:i,originalEvent:e}))};return t(W.preserveAspectRatio,"constraint-aspect"),t($.center,"constraint-center"),i(J.toggleFollowManipulator,"toggle-manipulator-follow"),i($.undo,"undo"),i($.redo,"redo"),i($.complete,"complete"),i($.vertexAdd,"vertex-add"),i({key:X.enterInputMode,continuePropagation:!0,repeats:!0},"show-tooltip"),e}_afterAttach(){}_afterDetach(e){this.interactiveHandleManager?.unregisterCustomConstraint(e),this.interactiveHandleManager?.unregisterHandle(e),this.tooltipManager?.unregisterPluginFields(e),this.globalStateManager.clearPluginOverrides(e);const t=this._pluginContexts.get(e);t&&(t.destroy(),this._pluginContexts.delete(e))}_beforeResume(e,t){this.interactiveHandleManager?.replaceEditSessions(e,t)}_commitNext(){const i={stack:[],error:void 0,hasError:!1};try{const t=this.mostDownstreamPlugin;if(!t)return;this.tooltipManager?.storeConstraintSnapshot();let n=!1;const a=this.editGeometryOperations;e(i,a?s(a.on("vertex-add",()=>n=!0)):null,!1);t.completeStep?t.completeStep():this.complete(t),n&&this.tooltipManager?.unlockOnVertexPlacement()}catch(n){i.error=n,i.hasError=!0}finally{t(i)}}_suspendPlugin(e){this.lifecycleManager.suspend(e),this.measurementManager.suspendPlugin(e)}_resumePlugin(e){this.lifecycleManager.resume(e)}_updateLastScreenPosition(e){const t=y(e.x,e.y);return this.lastScreenPosition=t,t}_getContextForPlugin(e,t){const i=o(this._pluginContexts,e,()=>new E({drawTool:this,plugin:e,session:t}));return i.session=t,i}_finalizeAndSimplifyGeometryResult(){const e=this.unprocessedGeometry;try{const t=e?C(e):e;t&&!x(t)?this.finalGeometry=t:this.finalGeometry=e}catch(t){r.getLogger(this).error("draw-tool:complete","geometry simplification failed",t)}}_before(e){if(!this.hasEventListener(`before-${e.action}`))return!1;const t=new CustomEvent(`before-${e.action}`,{detail:e,cancelable:!0});return this.emit(`before-${e.action}`,t),t.defaultPrevented}_guardCommand(e,t,i){return this._before(e)?i?.():t()}async _setupSegmentLabels(){const e=this.editGeometryOperations,t=this.sketchOptions?.labels,i=!!t?.enabled,n=this.globalStateManager.segmentLabelsDisabled;if(!e||!t||!i)return void(this._segmentLabels=l(this._segmentLabels));if(n)return void(this._segmentLabels&&(this._segmentLabels.visible=!1));if(this._segmentLabels?.context?.editGeometryOperations===e&&this._segmentLabels.context.labelOptions===t)return void(this._segmentLabels.visible=!0);const a=await this._createSegmentLabels(e,t);a&&(this._segmentLabels=l(this._segmentLabels),this._segmentLabels=a)}async _createSegmentLabels(e,t){return(this._segmentLabelsImportTask??=n(async i=>{if("3d"===this.view.type){const n=import("../3d/interactive/SegmentLabels3D.js"),{SegmentLabels3D:a}=await this._updatingHandles.addPromise(n);return this._isSegmentLabelsSetupStale(i,e,t)?null:new a({context:{view:this.view,editGeometryOperations:e,elevationInfo:k(this.hasZ,this.elevationInfo),labelOptions:t},visible:!0})}const n=import("../2d/interactive/SegmentLabels2D.js"),{SegmentLabels2D:a}=await this._updatingHandles.addPromise(n);return this._isSegmentLabelsSetupStale(i,e,t)?null:new a({context:{view:this.view,editGeometryOperations:e,elevationInfo:k(this.hasZ,this.elevationInfo),labelOptions:t},visible:!0})})).promise}_isSegmentLabelsSetupStale(e,t,i){return e.aborted||this.editGeometryOperations!==t||this.sketchOptions?.labels!==i||!i.enabled||this.globalStateManager.segmentLabelsDisabled}};i([_()],te.prototype,"_commandsSuspended",void 0),i([_()],te.prototype,"_zOfLastUserInput",null),i([_()],te.prototype,"_snappingVisualizer",void 0),i([_()],te.prototype,"_segmentLabels",void 0),i([_()],te.prototype,"_segmentLabelsImportTask",void 0),i([_()],te.prototype,"_tooltipDependencies",null),i([_()],te.prototype,"_editSessionManagerContext",null),i([_()],te.prototype,"_densificationParameters",null),i([_({constructOnly:!0,nonNullable:!0})],te.prototype,"view",void 0),i([_()],te.prototype,"automaticManipulatorSelection",void 0),i([_()],te.prototype,"updating",null),i([_()],te.prototype,"coordinateHelper",null),i([_()],te.prototype,"editGeometry",null),i([_()],te.prototype,"editGeometryOperations",null),i([_()],te.prototype,"unprocessedGeometry",null),i([_()],te.prototype,"finalGeometry",void 0),i([_()],te.prototype,"simplifiedGeometryPreview",null),i([_()],te.prototype,"_suppressCoincidentPointOverlaysIn3D",null),i([_()],te.prototype,"_shapeVisualGeometry",null),i([_()],te.prototype,"_vertexVisualGeometry",null),i([_()],te.prototype,"snappingManager",void 0),i([_()],te.prototype,"sketchOptions",void 0),i([_()],te.prototype,"elevationInfo",void 0),i([_()],te.prototype,"hasZ",void 0),i([_()],te.prototype,"defaultZ",void 0),i([_()],te.prototype,"directionOptions",void 0),i([_()],te.prototype,"canUndo",null),i([_()],te.prototype,"canRedo",null),i([_()],te.prototype,"pluginStack",null),i([_()],te.prototype,"mostDownstreamPlugin",null),i([_()],te.prototype,"mostUpstreamPlugin",null),i([_()],te.prototype,"lastScreenPosition",void 0),i([_()],te.prototype,"positionOfLastUserInput",null),i([_()],te.prototype,"tooltipManager",void 0),i([_()],te.prototype,"measurementManager",void 0),i([_()],te.prototype,"globalStateManager",void 0),i([_()],te.prototype,"editSessionManager",void 0),i([_()],te.prototype,"lifecycleManager",void 0),i([_()],te.prototype,"surfaceManager",void 0),i([_()],te.prototype,"interactiveHandleManager",void 0),i([_()],te.prototype,"renderer",void 0),i([_()],te.prototype,"movementCommandContext",null),i([_()],te.prototype,"tooltip",null),i([_()],te.prototype,"activeTooltipInfo",null),i([_()],te.prototype,"helpMessageKey",null),i([_({constructOnly:!0})],te.prototype,"enableVertexVisuals",void 0),te=i([M("esri.views.draw.DrawTool")],te);export{te as DrawTool};
|
|
2
|
+
import{__addDisposableResource as e,__disposeResources as t,__decorate as i}from"tslib";import{createTask as n}from"../../core/asyncUtils.js";import{makeHandle as a,disposable as s}from"../../core/handleUtils.js";import r from"../../core/Logger.js";import{getOrCreateMapValue as o}from"../../core/MapUtils.js";import{destroyMaybe as l,abortMaybe as d}from"../../core/maybe.js";import{when as p,initial as u,watch as c,syncAndInitial as h,on as g,sync as m}from"../../core/reactiveUtils.js";import{screenPointEqual as v,createScreenPoint as y}from"../../core/screenUtils.js";import{diff as f}from"../../core/accessorSupport/diffUtils.js";import{property as M}from"../../core/accessorSupport/decorators/property.js";import{subclass as _}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as b}from"../../core/support/UpdatingHandles.js";import w from"../../geometry/Polygon.js";import{i as S,e as C}from"../../chunks/simplifyOperator.js";import{isPolygon as x}from"../../geometry/support/typeUtils.js";import{isCurvedGeometry as P}from"../../geometry/support/curves/curveUtils.js";import{densifyCurvedGeometry as H}from"../../geometry/support/curves/densifyCurvedGeometry.js";import{getEffectiveElevationInfo as L}from"../../support/elevationInfoUtils.js";import{getMaxDeviationInPixels as k,getMinSegmentsPerCurve as I}from"../2d/layers/graphics/densificationConstants.js";import{createSnappingVisualizer as O}from"./support/createSnappingVisualizer.js";import{multipointFromGeometry as G,markHandled as V,getPointerType as T}from"./support/drawToolUtils.js";import{PluginContext as j}from"./support/PluginContext.js";import{viewEventToCommand as E}from"./support/input/drawToolInput.js";import{EditSessionManager as D}from"./support/managers/EditSessionManager.js";import{GlobalStateManager as U}from"./support/managers/GlobalStateManager.js";import{InteractiveHandleManager as A}from"./support/managers/InteractiveHandleManager.js";import{MeasurementManager as F}from"./support/managers/MeasurementManager.js";import{PluginLifecycleManager as R}from"./support/managers/PluginLifecycleManager.js";import{SurfaceManager as Z}from"./support/managers/SurfaceManager.js";import{TooltipManager as B}from"./support/managers/TooltipManager.js";import{ViewEventPriorities as q}from"../input/InputManager.js";import{createCoordinateHelper as z}from"../interactive/coordinateHelper.js";import{InteractiveToolBase as K}from"../interactive/InteractiveToolBase.js";import{KeyBindings as N,mediaKeys as Q,sketchKeys as W,advancedSketchKeys as $,tooltipKeys as J}from"../interactive/keybindings.js";import{isInputModeAvailable as X}from"../interactive/tooltip/tooltipCommonUtils.js";const Y=Symbol();let ee=class extends K{constructor(e){super(e),this._shapeVisualId=Symbol(),this._vertexVisualId=Symbol(),this._pluginContexts=new Map,this._queuedFeedbackEvents=[],this._flushingQueuedFeedbackEvents=!1,this._commandsSuspended=!1,this._snappingVisualizer=null,this._segmentLabels=null,this._segmentLabelsImportTask=null,this._updatingHandles=new b,this._keybindings=this._makeKeyBindings(),this._pendingBeginRequest=null,this.type="draw-2.0",this.automaticManipulatorSelection=!0,this.snappingManager=null,this.sketchOptions=null,this.elevationInfo=null,this.hasZ=!1,this.defaultZ=0,this.lastScreenPosition=null,this.measurementManager=new F,this.globalStateManager=new U({getPluginStack:()=>this.pluginStack}),this.editSessionManager=new D({getContext:()=>this._editSessionManagerContext}),this.lifecycleManager=new R({getContext:this._getContextForPlugin.bind(this),editSessionManager:this.editSessionManager,afterAttach:this._afterAttach.bind(this),afterDetach:this._afterDetach.bind(this),beforeResume:this._beforeResume.bind(this)}),this.surfaceManager=null,this.interactiveHandleManager=null,this.renderer=null,this.enableVertexVisuals=!0}initialize(){const{view:e}=this;this.interactiveHandleManager=new A({view:e,renderer:this.renderer}),this._override("manipulators",this.interactiveHandleManager.manipulators),this.tooltipManager=new B({getDependencies:()=>this._tooltipDependencies,getLastScreenPosition:()=>this.lastScreenPosition}),this.addHandles(p(()=>this.renderer,t=>{t.addOrUpdateVisual(this._shapeVisualId,{role:"outputGeometry"}),t.addOrUpdateVisual(this._vertexVisualId,{role:"vertex"}),this._updatingHandles.addPromise(O(e,t).then(e=>this._snappingVisualizer=e))},u)),this.addHandles([c(()=>[this.view,this.coordinateHelper.spatialReference,this.defaultZ,this.hasZ,this.elevationInfo],([e,t,i,n,a])=>{this.surfaceManager?.destroy(),this.surfaceManager=new Z({spatialReference:t,excludedGraphicsLayer:null,defaultZ:i,hasZ:n,view:e,elevationInfo:a,getContext:()=>({drawAtFixedElevation:this.globalStateManager.drawAtFixedElevation,elevationConstraint:this.tooltipManager?.elevationConstraint,constraintsEnabled:this.tooltipManager?.constraintsEnabled??!1})})},h),p(()=>this.sketchOptions?.tooltips.effectiveEnabled,()=>this.measurementManager.preloadMeasurementUtils(),{once:!0,initial:!0}),c(()=>[this.editGeometryOperations,this.sketchOptions?.labels.enabled,this.globalStateManager.segmentLabelsDisabled],()=>{this._updatingHandles.addPromise(this._setupSegmentLabels())},u),g(()=>this.editSessionManager,"cancelPlugin",({plugin:e})=>{this._suspendPlugin(e)},m),g(()=>this.editSessionManager,"restartPlugin",({restartInfo:e})=>{this._resumePlugin(e)},m),c(()=>this.lifecycleManager.updating,e=>{e||this._emitQueuedFeedbackEvents()},m),g(()=>this.editGeometryOperations,["vertex-add","vertex-update","vertex-remove"],e=>{const t=e.vertices.map(e=>({componentIndex:0,vertexIndex:e.index,coordinates:this.coordinateHelper.vectorToArray(e.pos)})),i=t.map(e=>e.coordinates);switch(e.type){case"vertex-add":this._emitWhenReady(e.type,{...e,added:i,vertices:t});break;case"vertex-update":this._emitWhenReady(e.type,{...e,updated:i,vertices:t});break;case"vertex-remove":this._emitWhenReady(e.type,{...e,removed:i,vertices:t})}})])}destroy(){this.active&&this.onDeactivate(),this.editSessionManager.destroy(),this.lifecycleManager.destroy(),this.measurementManager.destroy(),this.globalStateManager.destroy();for(const e of this._pluginContexts.values())e.destroy();this._pluginContexts.clear(),this.surfaceManager=l(this.surfaceManager),this.interactiveHandleManager=l(this.interactiveHandleManager),this._segmentLabelsImportTask=d(this._segmentLabelsImportTask),this._segmentLabels=l(this._segmentLabels),this.tooltipManager=l(this.tooltipManager)}get _zOfLastUserInput(){const e=this.mostDownstreamPlugin&&this.editSessionManager.getSession(this.mostDownstreamPlugin),t=e?.firstPointAddedBySession?.point;return t?.hasZ?t.z:null}get _tooltipDependencies(){const{defaultZ:e,editGeometryOperations:t,sketchOptions:i,directionOptions:n,elevationInfo:a,view:s}=this;return t&&i&&s?{defaultZ:e,directionOptions:n,elevationInfo:a,editGeometryOperations:t,sketchOptions:i,view:s,getActiveHandle:()=>this.interactiveHandleManager?.focusedHandle,getAllHandles:()=>this.interactiveHandleManager?.allhandles,getHelpMessageKey:()=>this.helpMessageKey,notifyTooltipsChanged:()=>{const{interactiveHandleManager:e,movementCommandContext:t}=this;e&&t&&e.reapplyPositions(t)}}:null}get _editSessionManagerContext(){const{coordinateHelper:e,view:t}=this;if(!t)return null;return{coordinateHelper:e,viewingMode:"3d"===t.type&&"global"===t.viewingMode?1:2}}get _densificationParameters(){const{view:e,coordinateHelper:t}=this,i=t.spatialReference,n=e?.spatialReference,a=e.resolution;if(!(i&&n&&a&&Number.isFinite(a)))return null;const s=n.metersPerUnit/i.metersPerUnit;return{maxDeviation:2**Math.round(Math.log2(a))*k()*s,minSegmentsPerCurve:I()}}get test(){return{densificationParameters:this._densificationParameters,segmentLabels:this._segmentLabels}}get updating(){return this._updatingHandles.updating||this.lifecycleManager.updating||!!this._segmentLabels?.updating}get coordinateHelper(){return z(this.hasZ,!1,this.view.spatialReference)}get editGeometry(){return this.editGeometryOperations?.data}get editGeometryOperations(){return this.editSessionManager.editGeometryOperations}get unprocessedGeometry(){return this.editSessionManager.outputGeometry}get simplifiedGeometryPreview(){const e=this.editSessionManager.outputGeometry;if(e&&x(e))try{const t=this._densificationParameters,i=P(e)&&t?new w({...H(e,t)}):e;if(!S(i))return C(i)}catch(t){return e}return e}get _suppressCoincidentPointOverlaysIn3D(){return"3d"===this.view.type&&"point"===this.unprocessedGeometry?.type&&!!this.interactiveHandleManager?.allhandles?.find(e=>"primary"===e.role)?.outputMapPosition}get _shapeVisualGeometry(){return this._suppressCoincidentPointOverlaysIn3D?null:this.simplifiedGeometryPreview}get _vertexVisualGeometry(){return this._suppressCoincidentPointOverlaysIn3D?null:this.unprocessedGeometry}get canUndo(){return this.editSessionManager.canUndo}get canRedo(){return this.editSessionManager.canRedo}get pluginStack(){return this.lifecycleManager.pluginStack}get mostDownstreamPlugin(){return this.pluginStack.at(-1)}get mostUpstreamPlugin(){return this.pluginStack.at(0)}get positionOfLastUserInput(){const e=this.lastScreenPosition;return e?this.surfaceManager?.screenToMap(e,{firstPointZ:this._zOfLastUserInput})??this.view.toMap(e):this.view.center}get movementCommandContext(){const{editGeometryOperations:e,tooltipManager:t,surfaceManager:i,snappingManager:n,interactiveHandleManager:a,_snappingVisualizer:s,defaultZ:r,hasZ:o,globalStateManager:{drawAtFixedElevation:l},view:d}=this;return{tooltipManager:t,editGeometryOperations:e,surfaceManager:i,interactiveHandleManager:a,snappingManager:n,snappingVisualizer:s,pointerType:"mouse",hasZ:o,defaultZ:r,view:d,drawAtFixedElevation:l}}get tooltip(){return this.tooltipManager?.tooltip}get activeTooltipInfo(){return this.tooltipManager?.tooltipInfo}get helpMessageKey(){return this.pluginStack.items.findLast(e=>e.helpMessageKey)?.helpMessageKey??"noTool"}begin(e){this.active?(this.lifecycleManager.begin(e),this._pendingBeginRequest=null):this._pendingBeginRequest=e}complete(e){const t=this.lifecycleManager;if(e&&t.complete(e),0===t.pluginStack.length){const e=this.unprocessedGeometry,t=!e||"mesh"===e.type||S(e);this.emit("complete",{geometry:e,isSimple:t,aborted:!1,type:"complete",vertices:[]}),this.view?.activeTool===this&&(this.view.activeTool=null)}}cancelFirstUserLeafPlugin(){const e=this.pluginStack.toArray().findLast(e=>!0!==e.configuration?.hidden);e&&this.lifecycleManager.cancel(e)}getVertexSnappingCandidates(){return"secondary"===this.interactiveHandleManager?.capturingHandle?.role?[]:this.snappingManager?.getVertexCandidates()??[]}replaceLeaf(e){const t=this.lifecycleManager;t.updating?r.getLogger(this).info("Ignoring command; arrived while updating:","replaceLeaf"):t.replaceLeaf(e)}finishPart(){const e=this.mostUpstreamPlugin,t=e?.configuration;if(this.editGeometryOperations&&t&&t.kind?.includes("multipart")){const e=this.pluginStack.at(1);e&&this.complete(e)}}undo(){this._handleCommand({action:"undo"})}redo(){this._handleCommand({action:"redo"})}executeCommand(e){return this._handleCommand(e)}suspendCommands(){return this._commandsSuspended=!0,a(()=>{this._commandsSuspended=!1;const e=this.view?.inputManager.latestPointerInfo;if(e){const{x:t,y:i}=e.location;this._handleCommand({action:"manipulator-move-to",x:t,y:i})}})}addPromise(e){return this._updatingHandles.addPromise(e)}getGeometryIfCompleted(){const e=this.lifecycleManager.gatherCompletablePlugins();return this.editSessionManager?.generatePreviewGeometryForPlugins(e)}onActivate(){super.onActivate();const{view:e}=this;this.lastScreenPosition=e?.inputManager.latestPointerInfo?.location,this.renderer?.activate(),this._pendingBeginRequest&&(this.begin(this._pendingBeginRequest),this._pendingBeginRequest=null),this.enableVertexVisuals&&this.addHandles(c(()=>this._vertexVisualGeometry,e=>{this.renderer?.addOrUpdateVisual(this._vertexVisualId,{geometry:e?G(e):null})},u)),this.addHandles([c(()=>this._shapeVisualGeometry,e=>{this.renderer?.addOrUpdateVisual(this._shapeVisualId,{geometry:e})},u),p(()=>this.interactiveHandleManager?.capturingHandle?.screenPosition,e=>this.lastScreenPosition=e,{initial:!0,equals:v}),c(()=>this.interactiveHandleManager?.capturingHandle?.outputMapPosition,(e,t)=>{const i=this.interactiveHandleManager?.capturingHandle?.editSession?.endVertex;e&&t&&i&&this._emitWhenReady("cursor-update",{updated:i.pos,type:"vertex-update",operation:"apply",vertices:[{componentIndex:i.part.index,vertexIndex:i.index,coordinates:i.pos}]})},m),this._keybindings.register(e,q.TOOL),c(()=>e.viewpoint,(e,t)=>{e&&t&&f(e,t)&&this._handleCommand({action:"viewpoint-moved"})})],Y)}onDeactivate(){super.onDeactivate(),this.removeHandles(Y),this.renderer?.deactivate(),this.snappingManager?.doneSnapping(),this.lifecycleManager.cancelAll(),this._pendingBeginRequest=null}onInputEvent(e){const t=E(e);t&&this._handleCommand(t)}forceAddVertex(){this._commitNext()}_emitWhenReady(e,t){if(this.destroyed)return;const i=()=>{this.emit(e,t)};this.lifecycleManager.updating||this._flushingQueuedFeedbackEvents?this._queuedFeedbackEvents.push(i):i()}_emitQueuedFeedbackEvents(){if(!(this.destroyed||this._flushingQueuedFeedbackEvents||this.lifecycleManager.updating||0===this._queuedFeedbackEvents.length)){this._flushingQueuedFeedbackEvents=!0;try{for(;!this.destroyed&&!this.lifecycleManager.updating&&this._queuedFeedbackEvents.length>0;)this._queuedFeedbackEvents.shift()?.()}finally{this._flushingQueuedFeedbackEvents=!1}}}async _handleCommand(e){if(!this._commandsSuspended)if(this.lifecycleManager.updating)r.getLogger(this).info("Ignoring command; arrived while updating:",e.action);else switch(e.action){case"view-drag":return await this._handleViewDragCommand(e);case"vertex-add":return this._guardCommand(e,()=>{V(e),this._commitNext()});case"vertex-add-and-finish-part":return this._handleVertexAddAndFinishPartCommand(e);case"cancel":return this._guardCommand(e,()=>this.cancel());case"complete":return this._guardCommand(e,()=>{this.mostUpstreamPlugin&&(V(e),this.complete(this.mostUpstreamPlugin))});case"finish-part":return this._guardCommand(e,()=>this.finishPart());case"undo":return this._guardCommand(e,()=>this.editSessionManager.undo());case"redo":return this._guardCommand(e,()=>this.editSessionManager.redo());case"next-manipulator":return this._guardCommand(e,()=>this.interactiveHandleManager?.cycleManipulator("forward"));case"previous-manipulator":return this._guardCommand(e,()=>this.interactiveHandleManager?.cycleManipulator("backward"));case"toggle-manipulator-follow":this.interactiveHandleManager?.toggleFollow()&&V(e);break;case"viewpoint-moved":return await this._handleViewpointMovedCommand(e);case"manipulator-move-to":return await this._handleManipulatorMoveToCommand(e);case"manipulator-drag-to":return await this._handleManipulatorDragToCommand(e);case"vertex-add-at-point":return await this._handleVertexAddAtPointCommand(e);case"show-tooltip":return this._guardCommand(e,async()=>{const t=this.tooltipManager?.tooltip;t&&X(t.info)&&(await t.enterInputMode(),V(e))});case"constraint-center":this.globalStateManager.setCentered(e.enabled);break;case"constraint-aspect":this.globalStateManager.setPreserveAspectRatio(e.enabled)}}async _handleViewDragCommand(e){if(!this.editable)return;const t=e.originalEvent,i=this.interactiveHandleManager?.capturingHandle;(!t||!("pointerType"in t)||"touch"!==t.pointerType||"capture-always"!==i?.captureMode&&"capture-when-engaged"!==i?.captureMode)&&"capture-when-engaged"!==this.interactiveHandleManager?.capturingHandle?.captureMode?this._before(e)&&V(e):V(e)}_handleVertexAddAndFinishPartCommand(e){this._before(e)||(V(e),this._commitNext(),this.finishPart())}async _handleViewpointMovedCommand(e){this.editable&&(await this._updatingHandles.addPromise(this.interactiveHandleManager?.capturingHandle?.moveTo(null,{...this.movementCommandContext,pointerType:T(e.originalEvent)})),this.interactiveHandleManager?.updateAllScreenPositions(this.movementCommandContext.surfaceManager))}async _handleManipulatorMoveToCommand(e){if(!this.editable)return;const t=this._updateLastScreenPosition(e);this.interactiveHandleManager?.capturingHandle&&V(e),await this._updatingHandles.addPromise(this.interactiveHandleManager?.capturingHandle?.moveTo(t,{...this.movementCommandContext,pointerType:T(e.originalEvent)}))}async _handleManipulatorDragToCommand(e){if(!this.editable)return;const t=T(e.originalEvent),i=this._updateLastScreenPosition(e),n=this.interactiveHandleManager?.findHandleByManipulator(i,t);"touch"===t&&n&&"start"===e.state&&this.interactiveHandleManager?.releaseHandle();const a=this.interactiveHandleManager?.findHandleDragging(),s=this.interactiveHandleManager?.capturingHandle,r=a??s??n;r&&!n&&V(e),"capture-when-engaged"===r?.captureMode||"capture-always"===r?.captureMode&&"touch"===t?"end"===e.state?await this._updatingHandles.addPromise(r.noteDragEnd(i,{...this.movementCommandContext,pointerType:t}).then(()=>{r&&"touch"===T(e.originalEvent)&&"grabbable-object"!==r.captureMode&&"capture-when-engaged"!==r.defaultCaptureMode&&"primary"===r.role&&(1===this.interactiveHandleManager?.handleCount?this._handleCommand({action:"vertex-add"}):this.interactiveHandleManager?.releaseHandle())})):"start"===e.state?await this._updatingHandles.addPromise(r.noteDragStart(i,{...this.movementCommandContext,pointerType:t}).then(()=>{r&&"touch"===T(e.originalEvent)&&"grabbable-object"!==r.captureMode&&"capture-when-engaged"!==r.defaultCaptureMode&&!r.editSession?.lastPointAddedBySession&&this._handleCommand({action:"vertex-add"})})):await this._updatingHandles.addPromise(r?.moveTo(i,{...this.movementCommandContext,pointerType:T(e.originalEvent)})):"grabbable-object"===r?.captureMode&&(this.interactiveHandleManager?.releaseHandle(s),await this._updatingHandles.addPromise(r.moveTo(i,{...this.movementCommandContext,pointerType:t})))}async _handleVertexAddAtPointCommand(e){const t=this._updateLastScreenPosition(e),i=T(e.originalEvent),n=this.interactiveHandleManager?.capturingHandle??this.interactiveHandleManager?.findHandleByManipulator(t,i);this.editable&&n&&(this._before(e)||(V(e),await this._updatingHandles.addPromise(n.moveTo(t,{...this.movementCommandContext,skipSnapping:!0,pointerType:i}).finally(()=>this._commitNext()))))}_makeKeyBindings(){const e=new N,t=(t,i)=>{e.addToggle(t,e=>this._handleCommand({action:i,originalEvent:e,enabled:"key-down"===e.type}))},i=(t,i)=>{e.add(t,e=>this._handleCommand({action:i,originalEvent:e}))};return t(Q.preserveAspectRatio,"constraint-aspect"),t(W.center,"constraint-center"),i($.toggleFollowManipulator,"toggle-manipulator-follow"),i(W.undo,"undo"),i(W.redo,"redo"),i(W.complete,"complete"),i(W.vertexAdd,"vertex-add"),i({key:J.enterInputMode,continuePropagation:!0,repeats:!0},"show-tooltip"),e}_afterAttach(){}_afterDetach(e){this.interactiveHandleManager?.unregisterCustomConstraint(e),this.interactiveHandleManager?.unregisterHandle(e),this.tooltipManager?.unregisterPluginFields(e),this.globalStateManager.clearPluginOverrides(e);const t=this._pluginContexts.get(e);t&&(t.destroy(),this._pluginContexts.delete(e))}_beforeResume(e,t){this.interactiveHandleManager?.replaceEditSessions(e,t)}_commitNext(){const i={stack:[],error:void 0,hasError:!1};try{const t=this.mostDownstreamPlugin;if(!t)return;this.tooltipManager?.storeConstraintSnapshot();let n=!1;const a=this.editGeometryOperations;e(i,a?s(a.on("vertex-add",()=>n=!0)):null,!1);t.completeStep?t.completeStep():this.complete(t),n&&this.tooltipManager?.unlockOnVertexPlacement()}catch(n){i.error=n,i.hasError=!0}finally{t(i)}}_suspendPlugin(e){this.lifecycleManager.suspend(e),this.measurementManager.suspendPlugin(e)}_resumePlugin(e){this.lifecycleManager.resume(e)}_updateLastScreenPosition(e){const t=y(e.x,e.y);return this.lastScreenPosition=t,t}_getContextForPlugin(e,t){const i=o(this._pluginContexts,e,()=>new j({drawTool:this,plugin:e,session:t}));return i.session=t,i}_before(e){if(!this.hasEventListener(`before-${e.action}`))return!1;const t=new CustomEvent(`before-${e.action}`,{detail:e,cancelable:!0});return this.emit(`before-${e.action}`,t),t.defaultPrevented}_guardCommand(e,t,i){return this._before(e)?i?.():t()}async _setupSegmentLabels(){const e=this.editGeometryOperations,t=this.sketchOptions?.labels,i=!!t?.enabled,n=this.globalStateManager.segmentLabelsDisabled;if(!e||!t||!i)return void(this._segmentLabels=l(this._segmentLabels));if(n)return void(this._segmentLabels&&(this._segmentLabels.visible=!1));if(this._segmentLabels?.context?.editGeometryOperations===e&&this._segmentLabels.context.labelOptions===t)return void(this._segmentLabels.visible=!0);const a=await this._createSegmentLabels(e,t);a&&(this._segmentLabels=l(this._segmentLabels),this._segmentLabels=a)}async _createSegmentLabels(e,t){return(this._segmentLabelsImportTask??=n(async i=>{if("3d"===this.view.type){const n=import("../3d/interactive/SegmentLabels3D.js"),{SegmentLabels3D:a}=await this._updatingHandles.addPromise(n);return this._isSegmentLabelsSetupStale(i,e,t)?null:new a({context:{view:this.view,editGeometryOperations:e,elevationInfo:L(this.hasZ,this.elevationInfo),labelOptions:t},visible:!0})}const n=import("../2d/interactive/SegmentLabels2D.js"),{SegmentLabels2D:a}=await this._updatingHandles.addPromise(n);return this._isSegmentLabelsSetupStale(i,e,t)?null:new a({context:{view:this.view,editGeometryOperations:e,elevationInfo:L(this.hasZ,this.elevationInfo),labelOptions:t},visible:!0})})).promise}_isSegmentLabelsSetupStale(e,t,i){return e.aborted||this.editGeometryOperations!==t||this.sketchOptions?.labels!==i||!i.enabled||this.globalStateManager.segmentLabelsDisabled}};i([M()],ee.prototype,"_commandsSuspended",void 0),i([M()],ee.prototype,"_zOfLastUserInput",null),i([M()],ee.prototype,"_snappingVisualizer",void 0),i([M()],ee.prototype,"_segmentLabels",void 0),i([M()],ee.prototype,"_segmentLabelsImportTask",void 0),i([M()],ee.prototype,"_tooltipDependencies",null),i([M()],ee.prototype,"_editSessionManagerContext",null),i([M()],ee.prototype,"_densificationParameters",null),i([M({constructOnly:!0,nonNullable:!0})],ee.prototype,"view",void 0),i([M()],ee.prototype,"automaticManipulatorSelection",void 0),i([M()],ee.prototype,"updating",null),i([M()],ee.prototype,"coordinateHelper",null),i([M()],ee.prototype,"editGeometry",null),i([M()],ee.prototype,"editGeometryOperations",null),i([M()],ee.prototype,"unprocessedGeometry",null),i([M()],ee.prototype,"simplifiedGeometryPreview",null),i([M()],ee.prototype,"_suppressCoincidentPointOverlaysIn3D",null),i([M()],ee.prototype,"_shapeVisualGeometry",null),i([M()],ee.prototype,"_vertexVisualGeometry",null),i([M()],ee.prototype,"snappingManager",void 0),i([M()],ee.prototype,"sketchOptions",void 0),i([M()],ee.prototype,"elevationInfo",void 0),i([M()],ee.prototype,"hasZ",void 0),i([M()],ee.prototype,"defaultZ",void 0),i([M()],ee.prototype,"directionOptions",void 0),i([M()],ee.prototype,"canUndo",null),i([M()],ee.prototype,"canRedo",null),i([M()],ee.prototype,"pluginStack",null),i([M()],ee.prototype,"mostDownstreamPlugin",null),i([M()],ee.prototype,"mostUpstreamPlugin",null),i([M()],ee.prototype,"lastScreenPosition",void 0),i([M()],ee.prototype,"positionOfLastUserInput",null),i([M()],ee.prototype,"tooltipManager",void 0),i([M()],ee.prototype,"measurementManager",void 0),i([M()],ee.prototype,"globalStateManager",void 0),i([M()],ee.prototype,"editSessionManager",void 0),i([M()],ee.prototype,"lifecycleManager",void 0),i([M()],ee.prototype,"surfaceManager",void 0),i([M()],ee.prototype,"interactiveHandleManager",void 0),i([M()],ee.prototype,"renderer",void 0),i([M()],ee.prototype,"movementCommandContext",null),i([M()],ee.prototype,"tooltip",null),i([M()],ee.prototype,"activeTooltipInfo",null),i([M()],ee.prototype,"helpMessageKey",null),i([M({constructOnly:!0})],ee.prototype,"enableVertexVisuals",void 0),ee=i([_("esri.views.draw.DrawTool")],ee);export{ee as DrawTool};
|