@arcgis/core 4.25.0-next.20220721 → 4.25.0-next.20220722
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/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{791220164501a791b2cd.js → 0896986aa60516f716f1.js} +1 -1
- package/assets/esri/core/workers/chunks/{59e18862b803fdc41786.js → 0c145b87c24bf6c7d572.js} +1 -1
- package/assets/esri/core/workers/chunks/2504c43fac77ecd9ec2a.js +1 -0
- package/assets/esri/core/workers/chunks/{39de883f236e2a8d9024.js → 30d7796ee6f7e4a6a3e1.js} +2 -2
- package/assets/esri/core/workers/chunks/{39de883f236e2a8d9024.js.LICENSE.txt → 30d7796ee6f7e4a6a3e1.js.LICENSE.txt} +0 -0
- package/assets/esri/core/workers/chunks/3281656a9bd3627e41ff.js +1 -0
- package/assets/esri/core/workers/chunks/374ee2b2cad26f7ad572.js +1 -0
- package/assets/esri/core/workers/chunks/4d14be8c7e8adaa91876.js +1011 -0
- package/assets/esri/core/workers/chunks/{c22d7622294fe4aefe0b.js → 4f2d2cc71f5ff5ac2a60.js} +1 -1
- package/assets/esri/core/workers/chunks/8b1d5b7e9de73bc9da3a.js +1 -0
- package/assets/esri/core/workers/chunks/9dc4db35c387e11e9beb.js +1 -0
- package/assets/esri/core/workers/chunks/{42987dcfda665c860151.js → a23376df9696ebe5b5cd.js} +1 -1
- package/assets/esri/core/workers/chunks/{e4ad2cf5d6bded02e392.js → ed763fc352d0b55e5867.js} +1 -1
- package/assets/esri/core/workers/chunks/{a05f6afcf56245824853.js → f1fdb335c5f9ec8b27cb.js} +1 -1
- package/assets/esri/core/workers/chunks/{9493a8e5d6001b6bf275.js → f59f82a43437a51c934c.js} +1 -1
- package/assets/esri/widgets/support/t9n/DatePicker.json +1 -1
- package/assets/esri/widgets/support/t9n/DatePicker_en.json +1 -1
- package/assets/esri/widgets/support/t9n/TimePicker.json +1 -1
- package/assets/esri/widgets/support/t9n/TimePicker_en.json +1 -1
- package/chunks/DefaultMaterial.glsl.js +42 -37
- package/chunks/RealisticTree.glsl.js +25 -25
- package/geometry/support/MeshMaterial.js +1 -1
- package/geometry/support/MeshMaterialMetallicRoughness.js +1 -1
- package/geometry/support/meshUtils/loadGLTFMesh.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/package.json +2 -2
- package/support/revision.js +1 -1
- package/views/2d/engine/webgl/util/Matcher.js +1 -1
- package/views/2d/layers/features/support/AttributeStore.js +1 -1
- package/views/3d/environment/ChapmanAtmosphere.js +1 -1
- package/views/3d/environment/EnvironmentRenderer.js +1 -1
- package/views/3d/environment/PanoramicAtmosphere.js +1 -1
- package/views/3d/environment/SimpleAtmosphere.js +1 -1
- package/views/3d/environment/resources/MarsAtmosphereTexture.js +1 -1
- package/views/3d/environment/resources/SimpleAtmosphereTexture.js +1 -1
- package/views/3d/glTF/LoaderResult.js +1 -1
- package/views/3d/glTF/internal/Resource.js +1 -1
- package/views/3d/glTF/internal/TextureTransformUtils.js +5 -0
- package/views/3d/glTF/loader.js +1 -1
- package/views/3d/interactive/editingTools/reshapeGraphic/ReshapeOperation.js +1 -1
- package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
- package/views/3d/layers/ElevationLayerView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/I3SMeshViewLabeler.js +1 -1
- package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
- package/views/3d/layers/PointCloudLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/SceneLayerView3D.js +1 -1
- package/views/3d/layers/TileLayerView3D.js +1 -1
- package/views/3d/layers/VoxelLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
- package/views/3d/layers/i3s/I3SElevationProvider.js +1 -1
- package/views/3d/layers/i3s/I3SQueryEngine.js +1 -1
- package/views/3d/layers/support/FeatureTileTree3DDebugger.js +1 -1
- package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
- package/views/3d/support/CombinedElevationProvider.js +1 -1
- package/views/3d/support/pointsOfInterest/StableSurfaceCenter.js +1 -1
- package/views/3d/terrain/OverlayManager.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +22 -22
- package/views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js +19 -10
- package/views/3d/webgl-engine/core/shaderLibrary/shading/TextureTransformUV.glsl.js +15 -0
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/RealisticTreeTechnique.js +1 -1
- package/views/input/recognizers/DoubleTapDrag.js +1 -1
- package/views/input/recognizers/Drag.js +1 -1
- package/views/input/recognizers/ImmediateDoubleClick.js +1 -1
- package/views/input/recognizers/PointerClickHoldAndDrag.js +1 -1
- package/views/input/recognizers/SingleAndDoubleClick.js +1 -1
- package/views/input/recognizers/VerticalTwoFingerDrag.js +1 -1
- package/views/input/recognizers/support.js +1 -1
- package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
- package/views/overlay/ViewOverlay.js +1 -1
- package/widgets/AreaMeasurement3D.js +1 -1
- package/widgets/BuildingExplorer/BuildingExplorerViewModel.js +1 -1
- package/widgets/BuildingExplorer.js +1 -1
- package/widgets/CoordinateConversion/support/Format.js +1 -1
- package/widgets/Daylight.js +1 -1
- package/widgets/DirectLineMeasurement3D.js +1 -1
- package/widgets/ElevationProfile.js +1 -1
- package/widgets/LineOfSight.js +1 -1
- package/widgets/ShadowCast.js +1 -1
- package/widgets/Slice.js +1 -1
- package/widgets/Slider.js +1 -1
- package/widgets/TimeSlider.js +1 -1
- package/widgets/Weather.js +1 -1
- package/widgets/Zoom.js +1 -1
- package/widgets/support/DatePicker.js +1 -1
- package/widgets/support/TimePicker.js +1 -1
- package/assets/esri/core/workers/chunks/0b269862733afe740a63.js +0 -1
- package/assets/esri/core/workers/chunks/290cd411d0d18b1d0efd.js +0 -1
- package/assets/esri/core/workers/chunks/85a2cf095f002b2c486f.js +0 -1
- package/assets/esri/core/workers/chunks/b312dd3027492007d75e.js +0 -1
- package/assets/esri/core/workers/chunks/bf348f6f52701fa6016e.js +0 -987
- package/assets/esri/core/workers/chunks/c79d4cb3332550fb0df5.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const
|
|
5
|
+
const e=new Uint8ClampedArray([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,3,0,0,0,3,0,0,0,3,0,0,0,3,0,0,0,3,0,0,0,4,0,0,0,4,0,0,0,4,0,0,0,4,0,0,0,4,0,0,0,4,0,0,0,5,0,0,0,5,0,0,0,5,0,0,0,5,0,0,0,5,0,0,0,6,0,0,0,6,0,0,0,6,0,0,0,6,0,0,0,6,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,8,0,0,0,8,0,0,0,8,0,0,0,8,0,0,0,8,0,0,0,9,0,0,0,9,0,0,0,9,0,0,0,9,0,0,0,9,0,0,0,10,0,0,0,10,0,0,0,10,0,0,0,10,0,0,0,11,0,0,0,11,0,0,0,11,0,0,0,11,0,0,0,11,0,0,0,12,0,0,0,12,0,0,0,12,0,0,0,12,0,0,0,13,0,0,0,13,0,0,0,13,0,0,0,13,0,0,0,14,0,0,0,14,0,0,0,14,0,0,0,14,0,0,0,15,0,0,0,15,0,0,0,15,0,0,0,15,0,0,0,15,16,0,0,16,16,0,0,16,16,0,0,16,16,0,0,16,15,0,0,17,15,0,0,17,15,0,0,17,15,0,0,17,14,0,0,18,14,0,0,18,14,0,0,18,13,0,0,19,13,0,0,19,13,0,0,19,13,0,0,19,13,0,0,20,13,0,0,20,13,0,0,20,13,0,0,20,12,0,0,21,12,0,0,21,12,0,0,21,12,0,0,21,12,0,0,22,12,0,0,22,12,0,0,22,12,0,0,22,11,0,0,23,11,0,0,23,11,0,0,23,11,0,0,24,11,0,0,24,11,0,0,24,11,0,0,24,10,0,0,25,10,0,0,25,10,0,0,25,10,0,0,26,10,0,0,26,10,0,0,26,10,0,0,26,9,0,0,27,9,0,0,27,9,0,0,27,18,0,0,28,18,0,0,28,18,0,0,28,18,0,0,28,18,0,0,29,18,0,0,29,18,0,0,29,17,0,0,30,17,0,0,30,17,0,0,30,17,0,0,30,16,0,0,31,16,0,0,31,16,0,0,31,16,0,0,32,16,0,0,32,16,0,0,32,15,0,0,33,15,0,0,33,15,0,0,33,15,0,0,34,15,8,0,34,15,8,0,34,15,8,0,34,15,7,0,35,15,7,0,35,15,7,0,35,21,7,0,36,21,7,0,36,21,7,0,36,21,7,0,37,21,7,0,37,21,7,0,37,20,7,0,38,20,7,0,38,20,7,0,38,20,7,0,39,20,7,0,39,20,7,0,39,20,7,0,39,19,6,0,40,19,6,0,40,19,6,0,40,19,6,0,41,19,6,0,41,19,6,0,41,18,6,0,42,18,6,0,42,18,6,0,42,24,6,0,43,24,6,0,43,24,6,0,43,23,6,0,44,23,6,0,44,23,6,0,44,23,6,0,45,23,6,0,45,23,6,0,45,22,6,0,46,22,6,0,46,22,6,0,46,22,5,0,47,22,5,0,47,22,5,0,47,21,5,0,48,21,5,0,48,21,5,0,48,21,5,0,49,21,5,0,49,26,5,0,49,25,5,0,50,25,5,0,50,25,5,0,50,25,5,0,51,25,5,0,51,25,5,0,51,25,5,0,52,25,5,0,52,25,5,0,52,24,5,0,53,24,5,0,53,24,5,0,53,24,9,0,54,28,9,0,54,28,9,0,54,28,9,0,55,28,9,0,55,27,9,0,56,27,9,0,56,27,9,0,56,27,9,4,57,27,9,4,57,27,9,4,57,26,9,4,58,26,9,4,58,26,9,4,58,26,9,4,59,26,9,4,59,26,9,4,59,26,8,4,60,30,8,4,60,30,8,4,60,29,8,4,61,29,8,4,61,29,8,4,62,29,8,4,62,29,8,4,62,28,8,4,63,28,8,4,63,28,8,4,63,28,12,4,64,28,12,4,64,28,12,4,64,27,12,4,65,27,12,8,65,27,12,8,65,31,12,8,66,31,12,8,66,30,11,8,67,30,11,8,67,30,11,8,67,30,11,8,68,30,11,8,68,30,11,8,68,30,15,7,69,30,15,7,69,30,15,7,69,33,15,11,70,33,15,11,70,32,14,11,71,32,14,11,71,32,14,11,71,32,18,14,72,32,18,14,72,32,18,14,72,31,17,14,73,35,17,14,73,34,17,17,74,34,21,17,74,34,21,17,74,34,20,17,75,34,20,20,75,34,20,20,75,34,23,20,76,34,23,20,76,36,23,23,77,36,23,23,77,36,23,23,77,36,23,23,78,36,26,26,78,36,26,26,78,36,26,26,79,36,26,29,79,38,26,29,80,38,29,29,80,38,29,29,80,38,28,31,81,38,28,31,81,38,31,31,81,37,31,34,82,37,31,34,82,37,31,37,83,40,34,37,83,40,34,37,83,39,33,39,84,39,33,39,84,39,36,42,84,39,36,42,85,39,36,42,85,39,36,42,85,39,39,44,86,39,39,44,86,41,38,47,87,41,41,47,87,41,41,50,87,41,41,49,88,41,41,52,88,40,43,52,89,43,43,52,89,43,43,54,89,42,45,54,90,42,45,57,90,42,45,57,90,42,45,59,91,42,48,59,91,44,47,61,92,44,47,61,92,44,50,61,92,44,49,63,93,44,49,63,93,44,52,66,93,43,52,65,94,46,54,68,94,46,54,70,95,46,54,70,95,46,54,70,95,45,56,72,96,45,56,72,96,45,58,74,97,47,58,76,97,47,58,76,97,47,60,78,98,47,60,78,98,47,60,81,98,49,62,80,99,49,62,82,99,48,61,84,100,48,64,84,100,48,64,84,100,50,63,86,101,50,66,86,101,50,66,88,101,50,65,90,102,52,67,89,103,51,69,91,104,51,68,92,105,52,69,93,107,52,71,94,108,54,70,96,109,53,71,96,111,52,73,98,112,54,72,98,114,53,73,100,115,54,72,100,117,54,73,102,118,55,74,104,120,55,76,105,121,56,77,106,123,56,76,107,124,57,79,107,126,58,78,110,128,57,79,111,129,56,80,113,131,58,79,112,132,57,82,114,134,58,81,116,136,60,82,117,137,59,83,117,139,60,83,119,141,59,84,120,142,60,85,122,144,59,86,122,146,60,86,126,148,62,87,127,149,61,88,127,151,62,88,128,153,63,89,130,155,62,90,131,156,63,90,132,158,64,91,134,160,65,91,135,162,64,92,136,163,63,93,138,165,66,95,139,167,65,95,140,169,66,95,142,171,67,96,142,172,66,97,144,174,67,99,145,176,67,97,148,178,67,99,147,180,68,100,149,181,68,100,150,183,69,101,152,185,70,102,153,187,71,103,155,188,70,103,156,190,70,104,157,192,71,105,158,194,71,106,160,195,72,106,161,197,72,108,161,199,73,108,163,200,73,109,164,202,74,109,165,204,74,110,167,206,75,111,168,207,74,112,170,209,75,112,170,210,76,113,171,212,76,114,173,214,77,115,174,215,78,115,175,217,78,116,175,218,78,117,177,220,78,118,178,221,79,118,180,223,80,120,180,224,81,120,181,226,81,120,182,227,82,121,184,229,82,122,185,230,84,123,186,232,83,123,187,233,84,124,189,234,84,125,188,235,85,126,189,237,86,126,190,238,86,127,191,239,87,127,192,240,87,129,193,242,88,129,194,243,89,130,195,244,90,131,196,245,90,132,197,246,91,132,197,247,92,133,198,248,92,134,199,249,93,135,200,250,94,136,201,251,95,137,202,252,96,138,203,253,97,140,204,254,98,141,205,254,99,142,206,255,101,143,207,255,102,144,208,255,103,146,209,255,104,147,209,255,106,148,210,255,107,149,211,255,108,151,212,255,110,152,213,255,111,153,213,255,112,154,214,255,114,156,215,255,115,157,215,255,117,158,216,255,118,160,217,255,120,161,217,255,121,162,218,255,123,164,218,255,124,165,219,255,125,166,219,255,127,167,220,255,129,169,220,255,130,170,221,255,132,171,221,255,133,173,222,255,134,174,222,255,136,175,223,255,139,178,224,255,142,180,224,255,144,182,225,255,147,185,226,255,150,187,226,255,153,189,227,255,155,191,228,255,158,194,228,255,160,196,229,255,163,198,229,255,165,200,230,255,168,202,231,255,170,203,231,255,172,205,232,255,174,207,232,255,176,209,233,255,178,210,234,255,180,212,234,255,182,214,235,255,184,215,236,255,186,217,237,255,188,219,238,255,190,220,238,255,192,221,239,255,193,222,240,255,194,224,240,255,196,225,241,255,197,226,241,255,198,226,242,255,199,227,242,255,200,228,242,255,201,228,243,255,202,229,243,255,203,230,243,255,204,230,244,255,205,231,244,255,207,232,244,255,208,233,245,255,209,233,245,255,211,234,246,255,213,235,246,255,217,238,247,255,222,240,248,255,226,242,249,255,231,245,250,255,236,247,251,255,241,249,252,255,245,251,253,255,249,252,254,255,255,255,255,255]);export{e as earthAtmosphereTextureSimple};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{TextureWrapMode as e}from"../../webgl/enums.js";function
|
|
5
|
+
import{TextureWrapMode as e}from"../../webgl/enums.js";function r(e={}){return{color:[1,1,1],opacity:1,alphaMode:"OPAQUE",alphaCutoff:.5,doubleSided:!1,castShadows:!0,receiveShadows:!0,receiveAmbientOcclustion:!0,textureColor:null,textureNormal:null,textureOcclusion:null,textureEmissive:null,textureMetallicRoughness:null,colorTextureTransform:null,normalTextureTransform:null,occlusionTextureTransform:null,emissiveTextureTransform:null,metallicRoughnessTextureTransform:null,emissiveFactor:[0,0,0],metallicFactor:1,roughnessFactor:1,colorMixMode:"multiply",...e}}function l(r,l={}){return{data:r,parameters:{wrap:{s:e.REPEAT,t:e.REPEAT,...l.wrap},noUnpackFlip:!0,mipmap:!1,...l}}}export{r as makeMaterialParameters,l as makeTextureSource};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{getOrCreateMapValue as e}from"../../../../core/MapUtils.js";import{isDataProtocol as t,dataComponents as r,dataToArrayBuffer as s,makeAbsolute as n}from"../../../../core/urlUtils.js";import{Version as o}from"../../../../core/Version.js";import{w as a,m as i,h as u,e as c,l as f}from"../../../../chunks/mat4.js";import{c as p,b as d}from"../../../../chunks/mat4f64.js";import{g as m}from"../../../../chunks/quat.js";import{a as l}from"../../../../chunks/quatf64.js";import{BufferViewUint32 as h,BufferViewUint16 as y,BufferViewUint8 as b,BufferViewVec3f as T,BufferViewVec4f as _,BufferViewVec2f as O,BufferViewVec4u8 as w,BufferViewVec4u16 as N,BufferViewVec3u8 as x,BufferViewVec3u16 as S,BufferViewVec2u32 as C,BufferViewVec2u16 as U,BufferViewVec2i16 as I,BufferViewVec2u8 as g,BufferViewVec2i8 as A}from"../../../../geometry/support/buffer/BufferView.js";import{m as E}from"../../../../chunks/scalar.js";import{BinaryStreamReader as L}from"./BinaryStreamReader.js";import{AttributeType as B}from"./enums.js";import{material as R,textureSampler as D}from"./fillDefaults.js";import{splitURI as G}from"./pathUtils.js";import{DataType as v}from"../../../webgl/enums.js";const j={MAGIC:1179937895,CHUNK_TYPE_JSON:1313821514,CHUNK_TYPE_BIN:5130562,MIN_HEADER_LENGTH:20};class M{constructor(e,t,r,s,n){this._context=e,this._errorContext=t,this.uri=r,this.json=s,this._glbBuffer=n,this._bufferLoaders=new Map,this._textureLoaders=new Map,this._textureCache=new Map,this._materialCache=new Map,this._nodeParentMap=new Map,this._nodeTransformCache=new Map,this._baseUri=G(this.uri).dirPart,this._checkVersionSupported(),this._checkRequiredExtensionsSupported(),t.errorUnsupportedIf(null==s.scenes,"Scenes must be defined."),t.errorUnsupportedIf(null==s.meshes,"Meshes must be defined"),t.errorUnsupportedIf(null==s.nodes,"Nodes must be defined."),this._computeNodeParents()}static async load(e,n,o,a){if(t(o)){const t=r(o);if(t&&"model/gltf-binary"!==t.mediaType)try{const r=JSON.parse(t.isBase64?atob(t.data):t.data);return new M(e,n,o,r)}catch{}const a=s(o);if(M._isGLBData(a))return this._fromGLBData(e,n,o,a)}if(o.endsWith(".gltf")){const t=await e.loadJSON(o,a);return new M(e,n,o,t)}const i=await e.loadBinary(o,a);if(M._isGLBData(i))return this._fromGLBData(e,n,o,i);const u=await e.loadJSON(o,a);return new M(e,n,o,u)}static _isGLBData(e){if(null==e)return!1;const t=new L(e);return t.remainingBytes()>=4&&t.readUint32()===j.MAGIC}static async _fromGLBData(e,t,r,s){const n=await M._parseGLBData(t,s);return new M(e,t,r,n.json,n.binaryData)}static async _parseGLBData(e,t){const r=new L(t);e.assert(r.remainingBytes()>=12,"GLB binary data is insufficiently large.");const s=r.readUint32(),n=r.readUint32(),o=r.readUint32();e.assert(s===j.MAGIC,"Magic first 4 bytes do not fit to expected GLB value."),e.assert(t.byteLength>=o,"GLB binary data is smaller than header specifies."),e.errorUnsupportedIf(2!==n,"An unsupported GLB container version was detected. Only version 2 is supported.");let a,i,u=0;for(;r.remainingBytes()>=8;){const t=r.readUint32(),s=r.readUint32();0===u?(e.assert(s===j.CHUNK_TYPE_JSON,"First GLB chunk must be JSON."),e.assert(t>=0,"No JSON data found."),a=await J(r.readUint8Array(t))):1===u?(e.errorUnsupportedIf(s!==j.CHUNK_TYPE_BIN,"Second GLB chunk expected to be BIN."),i=r.readUint8Array(t)):e.warnUnsupported("More than 2 GLB chunks detected. Skipping."),u+=1}return a||e.error("No GLB JSON chunk detected."),{json:a,binaryData:i}}async getBuffer(e,t){const r=this.json.buffers[e],s=this._errorContext;if(null==r.uri)return s.assert(null!=this._glbBuffer,"GLB buffer not present"),this._glbBuffer;const n=await this._getBufferLoader(e,t);return s.assert(n.byteLength===r.byteLength,"Buffer byte lengths should match."),n}async _getBufferLoader(e,t){const r=this._bufferLoaders.get(e);if(r)return r;const s=this.json.buffers[e].uri,n=this._context.loadBinary(this._resolveUri(s),t).then((e=>new Uint8Array(e)));return this._bufferLoaders.set(e,n),n}async getAccessor(e,t){const r=this._errorContext;r.errorUnsupportedIf(!this.json.accessors,"Accessors missing.");const s=this.json.accessors[e];r.errorUnsupportedIf(null==s?.bufferView,"Some accessor does not specify a bufferView."),r.errorUnsupportedIf(s.type in[B.MAT2,B.MAT3,B.MAT4],`AttributeType ${s.type} is not supported`);const n=this.json.bufferViews[s.bufferView],o=await this.getBuffer(n.buffer,t),a=k[s.type],i=H[s.componentType],u=a*i,c=n.byteStride||u;return{raw:o.buffer,byteStride:c,byteOffset:o.byteOffset+(n.byteOffset||0)+(s.byteOffset||0),entryCount:s.count,isDenselyPacked:c===u,componentCount:a,componentByteSize:i,componentType:s.componentType,min:s.min,max:s.max,normalized:!!s.normalized}}async getIndexData(e,t){if(null==e.indices)return;const r=await this.getAccessor(e.indices,t);if(r.isDenselyPacked)switch(r.componentType){case v.UNSIGNED_BYTE:return new Uint8Array(r.raw,r.byteOffset,r.entryCount);case v.UNSIGNED_SHORT:return new Uint16Array(r.raw,r.byteOffset,r.entryCount);case v.UNSIGNED_INT:return new Uint32Array(r.raw,r.byteOffset,r.entryCount)}else switch(r.componentType){case v.UNSIGNED_BYTE:return E(this._wrapAccessor(b,r));case v.UNSIGNED_SHORT:return E(this._wrapAccessor(y,r));case v.UNSIGNED_INT:return E(this._wrapAccessor(h,r))}}async getPositionData(e,t){const r=this._errorContext;r.errorUnsupportedIf(null==e.attributes.POSITION,"No POSITION vertex data found.");const s=await this.getAccessor(e.attributes.POSITION,t);return r.errorUnsupportedIf(s.componentType!==v.FLOAT,"Expected type FLOAT for POSITION vertex attribute, but found "+X[s.componentType]),r.errorUnsupportedIf(3!==s.componentCount,"POSITION vertex attribute must have 3 components, but found "+s.componentCount.toFixed()),this._wrapAccessor(T,s)}async getNormalData(e,t){const r=this._errorContext;r.assert(null!=e.attributes.NORMAL,"No NORMAL vertex data found.");const s=await this.getAccessor(e.attributes.NORMAL,t);return r.errorUnsupportedIf(s.componentType!==v.FLOAT,"Expected type FLOAT for NORMAL vertex attribute, but found "+X[s.componentType]),r.errorUnsupportedIf(3!==s.componentCount,"NORMAL vertex attribute must have 3 components, but found "+s.componentCount.toFixed()),this._wrapAccessor(T,s)}async getTangentData(e,t){const r=this._errorContext;r.assert(null!=e.attributes.TANGENT,"No TANGENT vertex data found.");const s=await this.getAccessor(e.attributes.TANGENT,t);return r.errorUnsupportedIf(s.componentType!==v.FLOAT,"Expected type FLOAT for TANGENT vertex attribute, but found "+X[s.componentType]),r.errorUnsupportedIf(4!==s.componentCount,"TANGENT vertex attribute must have 4 components, but found "+s.componentCount.toFixed()),new _(s.raw,s.byteOffset,s.byteStride,s.byteOffset+s.byteStride*s.entryCount)}async getTextureCoordinates(e,t){const r=this._errorContext;r.assert(null!=e.attributes.TEXCOORD_0,"No TEXCOORD_0 vertex data found.");const s=await this.getAccessor(e.attributes.TEXCOORD_0,t);return r.errorUnsupportedIf(2!==s.componentCount,"TEXCOORD_0 vertex attribute must have 2 components, but found "+s.componentCount.toFixed()),s.componentType===v.FLOAT?this._wrapAccessor(O,s):(r.errorUnsupportedIf(!s.normalized,"Integer component types are only supported for a normalized accessor for TEXCOORD_0."),Y(s))}async getVertexColors(e,t){const r=this._errorContext;r.assert(null!=e.attributes.COLOR_0,"No COLOR_0 vertex data found.");const s=await this.getAccessor(e.attributes.COLOR_0,t);if(r.errorUnsupportedIf(4!==s.componentCount&&3!==s.componentCount,"COLOR_0 attribute must have 3 or 4 components, but found "+s.componentCount.toFixed()),4===s.componentCount){if(s.componentType===v.FLOAT)return this._wrapAccessor(_,s);if(s.componentType===v.UNSIGNED_BYTE)return this._wrapAccessor(w,s);if(s.componentType===v.UNSIGNED_SHORT)return this._wrapAccessor(N,s)}else if(3===s.componentCount){if(s.componentType===v.FLOAT)return this._wrapAccessor(T,s);if(s.componentType===v.UNSIGNED_BYTE)return this._wrapAccessor(x,s);if(s.componentType===v.UNSIGNED_SHORT)return this._wrapAccessor(S,s)}r.errorUnsupported("Unsupported component type for COLOR_0 attribute: "+X[s.componentType])}hasPositions(e){return void 0!==e.attributes.POSITION}hasNormals(e){return void 0!==e.attributes.NORMAL}hasVertexColors(e){return void 0!==e.attributes.COLOR_0}hasTextureCoordinates(e){return void 0!==e.attributes.TEXCOORD_0}hasTangents(e){return void 0!==e.attributes.TANGENT}async getMaterial(e,t,r){let s=e.material?this._materialCache.get(e.material):void 0;if(!s){const n=null!=e.material?R(this.json.materials[e.material]):R(),o=n.pbrMetallicRoughness,a=this.hasVertexColors(e),i=this.getTexture(o.baseColorTexture,t),u=this.getTexture(n.normalTexture,t),c=r?this.getTexture(n.occlusionTexture,t):void 0,f=r?this.getTexture(n.emissiveTexture,t):void 0,p=r?this.getTexture(o.metallicRoughnessTexture,t):void 0,d=null!=e.material?e.material:-1;s={alphaMode:n.alphaMode,alphaCutoff:n.alphaCutoff,color:o.baseColorFactor,doubleSided:!!n.doubleSided,colorTexture:await i,normalTexture:await u,name:n.name,id:d,occlusionTexture:await c,emissiveTexture:await f,emissiveFactor:n.emissiveFactor,metallicFactor:o.metallicFactor,roughnessFactor:o.roughnessFactor,metallicRoughnessTexture:await p,hasVertexColors:a,ESRI_externalColorMixMode:n.extras.ESRI_externalColorMixMode}}return s}async getTexture(t,r){if(!t)return;this._errorContext.errorUnsupportedIf(0!==(t.texCoord||0),"Only TEXCOORD with index 0 is supported.");const s=t.index,n=this._errorContext,o=this.json.textures[s],a=D(null!=o.sampler?this.json.samplers[o.sampler]:{});n.errorUnsupportedIf(null==o.source,"Source is expected to be defined for a texture.");const i=this.json.images[o.source],u=await this._loadTextureImageData(s,o,r);return e(this._textureCache,s,(()=>{const e=e=>33071===e||33648===e||10497===e,t=e=>(n.error(`Unexpected TextureSampler WrapMode: ${e}. Using default REPEAT(10497).`),10497);return{data:u,wrapS:e(a.wrapS)?a.wrapS:t(a.wrapS),wrapT:e(a.wrapT)?a.wrapT:t(a.wrapT),minFilter:a.minFilter,name:i.name,id:s}}))}getNodeTransform(e){if(void 0===e)return P;let t=this._nodeTransformCache.get(e);if(!t){const r=this.getNodeTransform(this._getNodeParent(e)),s=this.json.nodes[e];s.matrix?t=i(p(),r,s.matrix):s.translation||s.rotation||s.scale?(t=d(r),s.translation&&u(t,t,s.translation),s.rotation&&(V[3]=m(V,s.rotation),c(t,t,V[3],V)),s.scale&&f(t,t,s.scale)):t=r,this._nodeTransformCache.set(e,t)}return t}_wrapAccessor(e,t){return new e(t.raw,t.byteOffset,t.byteStride,t.byteOffset+t.byteStride*(t.entryCount-1)+t.componentByteSize*t.componentCount)}_resolveUri(e){return n(e,this._baseUri)}_getNodeParent(e){return this._nodeParentMap.get(e)}_checkVersionSupported(){const e=o.parse(this.json.asset.version,"glTF");F.validate(e)}_checkRequiredExtensionsSupported(){const e=this.json,t=this._errorContext;e.extensionsRequired&&0!==e.extensionsRequired.length&&t.errorUnsupported("gltf loader was not able to load unsupported feature. Required extensions: "+e.extensionsRequired.join(", "))}_computeNodeParents(){this.json.nodes.forEach(((e,t)=>{e.children&&e.children.forEach((e=>{this._nodeParentMap.set(e,t)}))}))}async _loadTextureImageData(e,t,r){const s=this._textureLoaders.get(e);if(s)return s;const n=this._createTextureLoader(t,r);return this._textureLoaders.set(e,n),n}async _createTextureLoader(e,t){const r=this.json.images[e.source];if(r.uri)return this._context.loadImage(this._resolveUri(r.uri),t);const s=this._errorContext;s.errorUnsupportedIf(null==r.bufferView,"Image bufferView must be defined."),s.errorUnsupportedIf(null==r.mimeType,"Image mimeType must be defined.");const n=this.json.bufferViews[r.bufferView],o=await this.getBuffer(n.buffer,t);return s.errorUnsupportedIf(null!=n.byteStride,"byteStride not supported for image buffer"),q(new Uint8Array(o.buffer,o.byteOffset+(n.byteOffset||0),n.byteLength),r.mimeType)}}const F=new o(2,0,"glTF"),P=a(p(),Math.PI/2),V=l(),k={SCALAR:1,VEC2:2,VEC3:3,VEC4:4},H={[v.BYTE]:1,[v.UNSIGNED_BYTE]:1,[v.SHORT]:2,[v.UNSIGNED_SHORT]:2,[v.FLOAT]:4,[v.UNSIGNED_INT]:4};function Y(e){switch(e.componentType){case v.BYTE:return new A(e.raw,e.byteOffset,e.byteStride,e.byteOffset+e.byteStride*e.entryCount);case v.UNSIGNED_BYTE:return new g(e.raw,e.byteOffset,e.byteStride,e.byteOffset+e.byteStride*e.entryCount);case v.SHORT:return new I(e.raw,e.byteOffset,e.byteStride,e.byteOffset+e.byteStride*e.entryCount);case v.UNSIGNED_SHORT:return new U(e.raw,e.byteOffset,e.byteStride,e.byteOffset+e.byteStride*e.entryCount);case v.UNSIGNED_INT:return new C(e.raw,e.byteOffset,e.byteStride,e.byteOffset+e.byteStride*e.entryCount);case v.FLOAT:return new O(e.raw,e.byteOffset,e.byteStride,e.byteOffset+e.byteStride*e.entryCount)}}async function J(e){return new Promise(((t,r)=>{const s=new Blob([e]),n=new FileReader;n.onload=()=>{const e=n.result;t(JSON.parse(e))},n.onerror=e=>{r(e)},n.readAsText(s)}))}async function q(e,t){return new Promise(((r,s)=>{const n=new Blob([e],{type:t}),o=URL.createObjectURL(n),a=new Image;a.addEventListener("load",(()=>{URL.revokeObjectURL(o),"decode"in a?a.decode().then((()=>r(a)),(()=>r(a))):r(a)})),a.addEventListener("error",(e=>{URL.revokeObjectURL(o),s(e)})),a.src=o}))}const X={5120:"BYTE",5121:"UNSIGNED_BYTE",5122:"SHORT",5123:"UNSIGNED_SHORT",5125:"UNSIGNED_INT",5126:"FLOAT"};export{M as Resource};
|
|
5
|
+
import{getOrCreateMapValue as e}from"../../../../core/MapUtils.js";import{isDataProtocol as t,dataComponents as r,dataToArrayBuffer as s,makeAbsolute as n}from"../../../../core/urlUtils.js";import{Version as o}from"../../../../core/Version.js";import{w as a,m as i,h as u,e as c,l as f}from"../../../../chunks/mat4.js";import{c as p,b as d}from"../../../../chunks/mat4f64.js";import{g as m}from"../../../../chunks/quat.js";import{a as l}from"../../../../chunks/quatf64.js";import{BufferViewUint32 as h,BufferViewUint16 as T,BufferViewUint8 as y,BufferViewVec3f as b,BufferViewVec4f as _,BufferViewVec2f as x,BufferViewVec4u8 as O,BufferViewVec4u16 as w,BufferViewVec3u8 as N,BufferViewVec3u16 as S,BufferViewVec2u32 as C,BufferViewVec2u16 as U,BufferViewVec2i16 as g,BufferViewVec2u8 as I,BufferViewVec2i8 as A}from"../../../../geometry/support/buffer/BufferView.js";import{m as E}from"../../../../chunks/scalar.js";import{BinaryStreamReader as L}from"./BinaryStreamReader.js";import{AttributeType as R}from"./enums.js";import{material as B,textureSampler as D}from"./fillDefaults.js";import{splitURI as G}from"./pathUtils.js";import{DataType as v}from"../../../webgl/enums.js";const j={MAGIC:1179937895,CHUNK_TYPE_JSON:1313821514,CHUNK_TYPE_BIN:5130562,MIN_HEADER_LENGTH:20};class M{constructor(e,t,r,s,n){this._context=e,this._errorContext=t,this.uri=r,this.json=s,this._glbBuffer=n,this._bufferLoaders=new Map,this._textureLoaders=new Map,this._textureCache=new Map,this._materialCache=new Map,this._nodeParentMap=new Map,this._nodeTransformCache=new Map,this._baseUri=G(this.uri).dirPart,this._checkVersionSupported(),this._checkRequiredExtensionsSupported(),t.errorUnsupportedIf(null==s.scenes,"Scenes must be defined."),t.errorUnsupportedIf(null==s.meshes,"Meshes must be defined"),t.errorUnsupportedIf(null==s.nodes,"Nodes must be defined."),this._computeNodeParents()}static async load(e,n,o,a){if(t(o)){const t=r(o);if(t&&"model/gltf-binary"!==t.mediaType)try{const r=JSON.parse(t.isBase64?atob(t.data):t.data);return new M(e,n,o,r)}catch{}const a=s(o);if(M._isGLBData(a))return this._fromGLBData(e,n,o,a)}if(o.endsWith(".gltf")){const t=await e.loadJSON(o,a);return new M(e,n,o,t)}const i=await e.loadBinary(o,a);if(M._isGLBData(i))return this._fromGLBData(e,n,o,i);const u=await e.loadJSON(o,a);return new M(e,n,o,u)}static _isGLBData(e){if(null==e)return!1;const t=new L(e);return t.remainingBytes()>=4&&t.readUint32()===j.MAGIC}static async _fromGLBData(e,t,r,s){const n=await M._parseGLBData(t,s);return new M(e,t,r,n.json,n.binaryData)}static async _parseGLBData(e,t){const r=new L(t);e.assert(r.remainingBytes()>=12,"GLB binary data is insufficiently large.");const s=r.readUint32(),n=r.readUint32(),o=r.readUint32();e.assert(s===j.MAGIC,"Magic first 4 bytes do not fit to expected GLB value."),e.assert(t.byteLength>=o,"GLB binary data is smaller than header specifies."),e.errorUnsupportedIf(2!==n,"An unsupported GLB container version was detected. Only version 2 is supported.");let a,i,u=0;for(;r.remainingBytes()>=8;){const t=r.readUint32(),s=r.readUint32();0===u?(e.assert(s===j.CHUNK_TYPE_JSON,"First GLB chunk must be JSON."),e.assert(t>=0,"No JSON data found."),a=await J(r.readUint8Array(t))):1===u?(e.errorUnsupportedIf(s!==j.CHUNK_TYPE_BIN,"Second GLB chunk expected to be BIN."),i=r.readUint8Array(t)):e.warnUnsupported("More than 2 GLB chunks detected. Skipping."),u+=1}return a||e.error("No GLB JSON chunk detected."),{json:a,binaryData:i}}async getBuffer(e,t){const r=this.json.buffers[e],s=this._errorContext;if(null==r.uri)return s.assert(null!=this._glbBuffer,"GLB buffer not present"),this._glbBuffer;const n=await this._getBufferLoader(e,t);return s.assert(n.byteLength===r.byteLength,"Buffer byte lengths should match."),n}async _getBufferLoader(e,t){const r=this._bufferLoaders.get(e);if(r)return r;const s=this.json.buffers[e].uri,n=this._context.loadBinary(this._resolveUri(s),t).then((e=>new Uint8Array(e)));return this._bufferLoaders.set(e,n),n}async getAccessor(e,t){const r=this._errorContext;r.errorUnsupportedIf(!this.json.accessors,"Accessors missing.");const s=this.json.accessors[e];r.errorUnsupportedIf(null==s?.bufferView,"Some accessor does not specify a bufferView."),r.errorUnsupportedIf(s.type in[R.MAT2,R.MAT3,R.MAT4],`AttributeType ${s.type} is not supported`);const n=this.json.bufferViews[s.bufferView],o=await this.getBuffer(n.buffer,t),a=V[s.type],i=k[s.componentType],u=a*i,c=n.byteStride||u;return{raw:o.buffer,byteStride:c,byteOffset:o.byteOffset+(n.byteOffset||0)+(s.byteOffset||0),entryCount:s.count,isDenselyPacked:c===u,componentCount:a,componentByteSize:i,componentType:s.componentType,min:s.min,max:s.max,normalized:!!s.normalized}}async getIndexData(e,t){if(null==e.indices)return;const r=await this.getAccessor(e.indices,t);if(r.isDenselyPacked)switch(r.componentType){case v.UNSIGNED_BYTE:return new Uint8Array(r.raw,r.byteOffset,r.entryCount);case v.UNSIGNED_SHORT:return new Uint16Array(r.raw,r.byteOffset,r.entryCount);case v.UNSIGNED_INT:return new Uint32Array(r.raw,r.byteOffset,r.entryCount)}else switch(r.componentType){case v.UNSIGNED_BYTE:return E(this._wrapAccessor(y,r));case v.UNSIGNED_SHORT:return E(this._wrapAccessor(T,r));case v.UNSIGNED_INT:return E(this._wrapAccessor(h,r))}}async getPositionData(e,t){const r=this._errorContext;r.errorUnsupportedIf(null==e.attributes.POSITION,"No POSITION vertex data found.");const s=await this.getAccessor(e.attributes.POSITION,t);return r.errorUnsupportedIf(s.componentType!==v.FLOAT,"Expected type FLOAT for POSITION vertex attribute, but found "+q[s.componentType]),r.errorUnsupportedIf(3!==s.componentCount,"POSITION vertex attribute must have 3 components, but found "+s.componentCount.toFixed()),this._wrapAccessor(b,s)}async getNormalData(e,t){const r=this._errorContext;r.assert(null!=e.attributes.NORMAL,"No NORMAL vertex data found.");const s=await this.getAccessor(e.attributes.NORMAL,t);return r.errorUnsupportedIf(s.componentType!==v.FLOAT,"Expected type FLOAT for NORMAL vertex attribute, but found "+q[s.componentType]),r.errorUnsupportedIf(3!==s.componentCount,"NORMAL vertex attribute must have 3 components, but found "+s.componentCount.toFixed()),this._wrapAccessor(b,s)}async getTangentData(e,t){const r=this._errorContext;r.assert(null!=e.attributes.TANGENT,"No TANGENT vertex data found.");const s=await this.getAccessor(e.attributes.TANGENT,t);return r.errorUnsupportedIf(s.componentType!==v.FLOAT,"Expected type FLOAT for TANGENT vertex attribute, but found "+q[s.componentType]),r.errorUnsupportedIf(4!==s.componentCount,"TANGENT vertex attribute must have 4 components, but found "+s.componentCount.toFixed()),new _(s.raw,s.byteOffset,s.byteStride,s.byteOffset+s.byteStride*s.entryCount)}async getTextureCoordinates(e,t){const r=this._errorContext;r.assert(null!=e.attributes.TEXCOORD_0,"No TEXCOORD_0 vertex data found.");const s=await this.getAccessor(e.attributes.TEXCOORD_0,t);return r.errorUnsupportedIf(2!==s.componentCount,"TEXCOORD_0 vertex attribute must have 2 components, but found "+s.componentCount.toFixed()),s.componentType===v.FLOAT?this._wrapAccessor(x,s):(r.errorUnsupportedIf(!s.normalized,"Integer component types are only supported for a normalized accessor for TEXCOORD_0."),Y(s))}async getVertexColors(e,t){const r=this._errorContext;r.assert(null!=e.attributes.COLOR_0,"No COLOR_0 vertex data found.");const s=await this.getAccessor(e.attributes.COLOR_0,t);if(r.errorUnsupportedIf(4!==s.componentCount&&3!==s.componentCount,"COLOR_0 attribute must have 3 or 4 components, but found "+s.componentCount.toFixed()),4===s.componentCount){if(s.componentType===v.FLOAT)return this._wrapAccessor(_,s);if(s.componentType===v.UNSIGNED_BYTE)return this._wrapAccessor(O,s);if(s.componentType===v.UNSIGNED_SHORT)return this._wrapAccessor(w,s)}else if(3===s.componentCount){if(s.componentType===v.FLOAT)return this._wrapAccessor(b,s);if(s.componentType===v.UNSIGNED_BYTE)return this._wrapAccessor(N,s);if(s.componentType===v.UNSIGNED_SHORT)return this._wrapAccessor(S,s)}r.errorUnsupported("Unsupported component type for COLOR_0 attribute: "+q[s.componentType])}hasPositions(e){return void 0!==e.attributes.POSITION}hasNormals(e){return void 0!==e.attributes.NORMAL}hasVertexColors(e){return void 0!==e.attributes.COLOR_0}hasTextureCoordinates(e){return void 0!==e.attributes.TEXCOORD_0}hasTangents(e){return void 0!==e.attributes.TANGENT}async getMaterial(e,t,r){let s=e.material?this._materialCache.get(e.material):void 0;if(!s){const n=null!=e.material?B(this.json.materials[e.material]):B(),o=n.pbrMetallicRoughness,a=this.hasVertexColors(e),i=this.getTexture(o.baseColorTexture,t),u=this.getTexture(n.normalTexture,t),c=r?this.getTexture(n.occlusionTexture,t):void 0,f=r?this.getTexture(n.emissiveTexture,t):void 0,p=r?this.getTexture(o.metallicRoughnessTexture,t):void 0,d=null!=e.material?e.material:-1;s={alphaMode:n.alphaMode,alphaCutoff:n.alphaCutoff,color:o.baseColorFactor,doubleSided:!!n.doubleSided,colorTexture:await i,normalTexture:await u,name:n.name,id:d,occlusionTexture:await c,emissiveTexture:await f,emissiveFactor:n.emissiveFactor,metallicFactor:o.metallicFactor,roughnessFactor:o.roughnessFactor,metallicRoughnessTexture:await p,hasVertexColors:a,ESRI_externalColorMixMode:n.extras.ESRI_externalColorMixMode,colorTextureTransform:o?.baseColorTexture?.extensions?.KHR_texture_transform,normalTextureTransform:n.normalTexture?.extensions?.KHR_texture_transform,occlusionTextureTransform:n.occlusionTexture?.extensions?.KHR_texture_transform,emissiveTextureTransform:n.emissiveTexture?.extensions?.KHR_texture_transform,metallicRoughnessTextureTransform:o?.metallicRoughnessTexture?.extensions?.KHR_texture_transform}}return s}async getTexture(t,r){if(!t)return;this._errorContext.errorUnsupportedIf(0!==(t.texCoord||0),"Only TEXCOORD with index 0 is supported.");const s=t.index,n=this._errorContext,o=this.json.textures[s],a=D(null!=o.sampler?this.json.samplers[o.sampler]:{});n.errorUnsupportedIf(null==o.source,"Source is expected to be defined for a texture.");const i=this.json.images[o.source],u=await this._loadTextureImageData(s,o,r);return e(this._textureCache,s,(()=>{const e=e=>33071===e||33648===e||10497===e,t=e=>(n.error(`Unexpected TextureSampler WrapMode: ${e}. Using default REPEAT(10497).`),10497);return{data:u,wrapS:e(a.wrapS)?a.wrapS:t(a.wrapS),wrapT:e(a.wrapT)?a.wrapT:t(a.wrapT),minFilter:a.minFilter,name:i.name,id:s}}))}getNodeTransform(e){if(void 0===e)return P;let t=this._nodeTransformCache.get(e);if(!t){const r=this.getNodeTransform(this._getNodeParent(e)),s=this.json.nodes[e];s.matrix?t=i(p(),r,s.matrix):s.translation||s.rotation||s.scale?(t=d(r),s.translation&&u(t,t,s.translation),s.rotation&&(H[3]=m(H,s.rotation),c(t,t,H[3],H)),s.scale&&f(t,t,s.scale)):t=r,this._nodeTransformCache.set(e,t)}return t}_wrapAccessor(e,t){return new e(t.raw,t.byteOffset,t.byteStride,t.byteOffset+t.byteStride*(t.entryCount-1)+t.componentByteSize*t.componentCount)}_resolveUri(e){return n(e,this._baseUri)}_getNodeParent(e){return this._nodeParentMap.get(e)}_checkVersionSupported(){const e=o.parse(this.json.asset.version,"glTF");F.validate(e)}_checkRequiredExtensionsSupported(){const e=this.json,t=this._errorContext;e.extensionsRequired&&0!==e.extensionsRequired.length&&t.errorUnsupported("gltf loader was not able to load unsupported feature. Required extensions: "+e.extensionsRequired.join(", "))}_computeNodeParents(){this.json.nodes.forEach(((e,t)=>{e.children&&e.children.forEach((e=>{this._nodeParentMap.set(e,t)}))}))}async _loadTextureImageData(e,t,r){const s=this._textureLoaders.get(e);if(s)return s;const n=this._createTextureLoader(t,r);return this._textureLoaders.set(e,n),n}async _createTextureLoader(e,t){const r=this.json.images[e.source];if(r.uri)return this._context.loadImage(this._resolveUri(r.uri),t);const s=this._errorContext;s.errorUnsupportedIf(null==r.bufferView,"Image bufferView must be defined."),s.errorUnsupportedIf(null==r.mimeType,"Image mimeType must be defined.");const n=this.json.bufferViews[r.bufferView],o=await this.getBuffer(n.buffer,t);return s.errorUnsupportedIf(null!=n.byteStride,"byteStride not supported for image buffer"),K(new Uint8Array(o.buffer,o.byteOffset+(n.byteOffset||0),n.byteLength),r.mimeType)}}const F=new o(2,0,"glTF"),P=a(p(),Math.PI/2),H=l(),V={SCALAR:1,VEC2:2,VEC3:3,VEC4:4},k={[v.BYTE]:1,[v.UNSIGNED_BYTE]:1,[v.SHORT]:2,[v.UNSIGNED_SHORT]:2,[v.FLOAT]:4,[v.UNSIGNED_INT]:4};function Y(e){switch(e.componentType){case v.BYTE:return new A(e.raw,e.byteOffset,e.byteStride,e.byteOffset+e.byteStride*e.entryCount);case v.UNSIGNED_BYTE:return new I(e.raw,e.byteOffset,e.byteStride,e.byteOffset+e.byteStride*e.entryCount);case v.SHORT:return new g(e.raw,e.byteOffset,e.byteStride,e.byteOffset+e.byteStride*e.entryCount);case v.UNSIGNED_SHORT:return new U(e.raw,e.byteOffset,e.byteStride,e.byteOffset+e.byteStride*e.entryCount);case v.UNSIGNED_INT:return new C(e.raw,e.byteOffset,e.byteStride,e.byteOffset+e.byteStride*e.entryCount);case v.FLOAT:return new x(e.raw,e.byteOffset,e.byteStride,e.byteOffset+e.byteStride*e.entryCount)}}async function J(e){return new Promise(((t,r)=>{const s=new Blob([e]),n=new FileReader;n.onload=()=>{const e=n.result;t(JSON.parse(e))},n.onerror=e=>{r(e)},n.readAsText(s)}))}async function K(e,t){return new Promise(((r,s)=>{const n=new Blob([e],{type:t}),o=URL.createObjectURL(n),a=new Image;a.addEventListener("load",(()=>{URL.revokeObjectURL(o),"decode"in a?a.decode().then((()=>r(a)),(()=>r(a))):r(a)})),a.addEventListener("error",(e=>{URL.revokeObjectURL(o),s(e)})),a.src=o}))}const q={5120:"BYTE",5121:"UNSIGNED_BYTE",5122:"SHORT",5123:"UNSIGNED_SHORT",5125:"UNSIGNED_INT",5126:"FLOAT"};export{M as Resource};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{isNone as s,isSome as t}from"../../../../core/maybe.js";import{f as o,c as a}from"../../../../chunks/mat3f32.js";import{Z as r,O as f}from"../../../../chunks/vec2f32.js";import{m as n}from"../../../../chunks/mat3.js";function c(c){if(s(c))return null;const m=t(c.offset)?c.offset:r,e=t(c.rotation)?c.rotation:0,i=t(c.scale)?c.scale:f,h=o(1,0,0,0,1,0,m[0],m[1],1),u=o(Math.cos(e),-Math.sin(e),0,Math.sin(e),Math.cos(e),0,0,0,1),p=o(i[0],0,0,0,i[1],0,0,0,1),j=a();return n(j,u,p),n(j,h,j),j}export{c as getTransformMatrix};
|
package/views/3d/glTF/loader.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isSome as e,isNone as
|
|
5
|
+
import{isSome as e,isNone as o}from"../../../core/maybe.js";import{b as t}from"../../../chunks/mat4f64.js";import{DefaultErrorContext as r}from"./DefaultErrorContext.js";import{makeMaterialParameters as s,makeTextureSource as a}from"./LoaderResult.js";import{Resource as n}from"./internal/Resource.js";import{TextureSamplingMode as i,PrimitiveType as l}from"../../webgl/enums.js";let u=0;async function m(r,s,a={},i=!0){const m=await n.load(r,f,s,a),T="gltf_"+u++,x={lods:[],materials:new Map,textures:new Map,meta:c(m)},R=!(!m.json.asset.extras||"symbolResource"!==m.json.asset.extras.ESRI_type),I=new Map;await d(m,(async(r,s,n,u)=>{const c=I.get(n)??0;I.set(n,c+1);const d=void 0!==r.mode?r.mode:l.TRIANGLES,R=d===l.TRIANGLES||d===l.TRIANGLE_STRIP||d===l.TRIANGLE_FAN?d:null;if(o(R))return void f.warnUnsupported("Unsupported primitive mode ("+h[d]+"). Skipping primitive.");if(!m.hasPositions(r))return void f.warn("Skipping primitive without POSITION vertex attribute.");const E=m.getPositionData(r,a),S=m.getMaterial(r,a,i),_=m.hasNormals(r)?m.getNormalData(r,a):null,g=m.hasTangents(r)?m.getTangentData(r,a):null,v=m.hasTextureCoordinates(r)?m.getTextureCoordinates(r,a):null,w=m.hasVertexColors(r)?m.getVertexColors(r,a):null,N=m.getIndexData(r,a),M={transform:t(s),attributes:{position:await E,normal:_?await _:null,texCoord0:v?await v:null,color:w?await w:null,tangent:g?await g:null},indices:await N,primitiveType:R,material:p(x,await S,T)};let A=null;e(x.meta)&&e(x.meta.ESRI_lod)&&"screenSpaceRadius"===x.meta.ESRI_lod.metric&&(A=x.meta.ESRI_lod.thresholds[n]),x.lods[n]=x.lods[n]||{parts:[],name:u,lodThreshold:A},x.lods[n].parts[c]=M}));for(const e of x.lods)e.parts=e.parts.filter((e=>!!e));return{model:x,meta:{isEsriSymbolResource:R,uri:m.uri},customMeta:{}}}function c(o){const t=o.json;let r=null;return t.nodes.forEach((o=>{const t=o.extras;e(t)&&(t.ESRI_proxyEllipsoid||t.ESRI_lod)&&(r=t)})),r}async function d(e,o){const t=e.json,r=t.scenes[t.scene||0].nodes,s=r.length>1,a=[];for(const i of r){const e=t.nodes[i];if(a.push(n(i,0)),T(e)&&!s){e.extensions.MSFT_lod.ids.forEach(((e,o)=>n(e,o+1)))}}async function n(r,s){const i=t.nodes[r],l=e.getNodeTransform(r);if(f.warnUnsupportedIf(null!=i.weights,"Morph targets are not supported."),null!=i.mesh){const e=t.meshes[i.mesh];for(const t of e.primitives)a.push(o(t,l,s,e.name))}for(const e of i.children||[])a.push(n(e,s))}await Promise.all(a)}function T(e){return e.extensions&&e.extensions.MSFT_lod&&Array.isArray(e.extensions.MSFT_lod.ids)}function p(e,o,t){const r=o=>{const r=`${t}_tex_${o&&o.id}${o&&o.name?"_"+o.name:""}`;if(o&&!e.textures.has(r)){const t=a(o.data,{wrap:{s:o.wrapS,t:o.wrapT},mipmap:x.includes(o.minFilter),noUnpackFlip:!0});e.textures.set(r,t)}return r},n=`${t}_mat_${o.id}_${o.name}`;if(!e.materials.has(n)){const t=s({color:[o.color[0],o.color[1],o.color[2]],opacity:o.color[3],alphaMode:o.alphaMode,alphaCutoff:o.alphaCutoff,doubleSided:o.doubleSided,colorMixMode:o.ESRI_externalColorMixMode,textureColor:o.colorTexture?r(o.colorTexture):void 0,textureNormal:o.normalTexture?r(o.normalTexture):void 0,textureOcclusion:o.occlusionTexture?r(o.occlusionTexture):void 0,textureEmissive:o.emissiveTexture?r(o.emissiveTexture):void 0,textureMetallicRoughness:o.metallicRoughnessTexture?r(o.metallicRoughnessTexture):void 0,emissiveFactor:[o.emissiveFactor[0],o.emissiveFactor[1],o.emissiveFactor[2]],colorTextureTransform:o.colorTextureTransform,normalTextureTransform:o.normalTextureTransform,occlusionTextureTransform:o.occlusionTextureTransform,emissiveTextureTransform:o.emissiveTextureTransform,metallicRoughnessTextureTransform:o.metallicRoughnessTextureTransform,metallicFactor:o.metallicFactor,roughnessFactor:o.roughnessFactor});e.materials.set(n,t)}return n}const f=new r,x=[i.LINEAR_MIPMAP_LINEAR,i.LINEAR_MIPMAP_NEAREST],h=["POINTS","LINES","LINE_LOOP","LINE_STRIP","TRIANGLES","TRIANGLE_STRIP","TRIANGLE_FAN"];export{m as load};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import"../../../../../core/has.js";import t from"../../../../../core/Evented.js";import{HandleOwner as i}from"../../../../../core/HandleOwner.js";import a from"../../../../../core/Handles.js";import{handlesGroup as o,destroyHandle as n}from"../../../../../core/handleUtils.js";import{destroyMaybe as r,isSome as s,isNone as l,unwrap as p,removeMaybe as h}from"../../../../../core/maybe.js";import{zeroMeters as d,scale as u,createLength as c}from"../../../../../core/quantityUtils.js";import{watch as m,when as g,initial as _}from"../../../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as f}from"../../../../../core/unitUtils.js";import{property as v}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as M}from"../../../../../core/accessorSupport/decorators/subclass.js";import{I as y}from"../../../../../chunks/mat4f64.js";import{l as x,b as O,h as b,s as E,a as G,g as S}from"../../../../../chunks/vec3.js";import{f as V,c as I}from"../../../../../chunks/vec3f64.js";import T from"../../../../../geometry/Polyline.js";import{projectPoint as H}from"../../../../../geometry/support/plane.js";import{sv3d as w}from"../../../../../geometry/support/vectorStacks.js";import{makeDehydratedPoint as D}from"../../../../../layers/graphics/dehydratedFeatures.js";import{getGraphicEffectiveElevationInfo as A}from"../../../../../support/elevationInfoUtils.js";import{isVolumetricSymbol as L}from"../../../../../symbols/support/utils.js";import{Manipulator3D as P}from"../../Manipulator3D.js";import{createManipulatorMaterial as j,createManipulatorOutlineMaterial as U,placeAtGraphic as k}from"../../manipulatorUtils.js";import{SegmentLabels3D as N}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as R}from"../../SnappingVisualizer3D.js";import{screenToRenderPlaneFromEvent as C,convertToMapCoordinates as F,screenToMapXYAtLocation as z,screenToMapXYForGraphicAtLocation as X}from"../dragEventPipeline3D.js";import{ManipulatorType as Y}from"../ManipulatorType.js";import{canMoveZ as Z}from"../manipulatorUtils.js";import{settings as q,colors as W}from"../settings.js";import{createVisualElements as K}from"../visualElementUtils.js";import{DISC_RADIUS_SMALL as B}from"../manipulations/config.js";import{ManipulationType as J,MoveManipulation as Q}from"../manipulations/MoveManipulation.js";import{shapeOrientation as $,axisConstrainedDragSign as ee}from"../manipulations/moveUtils.js";import{MoveXYGraphicManipulation as te}from"../manipulations/MoveXYGraphicManipulation.js";import{createEdgeOffsetIntersectionPlane as ie,createEdgeOffsetOperation as ae,edgeOffsetRotationMatrix as oe,screenEdgeLengthSquared as ne}from"./edgeOffsetUtils.js";import{OutlineVisualElement as re}from"../../visualElements/OutlineVisualElement.js";import{GraphicState as se}from"../../../layers/graphics/GraphicState.js";import le from"../../../webgl-engine/lib/GeometryUtil.js";import{MouseButton as pe}from"../../../../input/IViewEvents.js";import{addMapDelta as he,createManipulatorDragEventPipeline as de,dragAtLocation as ue,addScreenDelta as ce}from"../../../../interactive/dragEventPipeline.js";import{ManipulatorStateFlags as me,ManipulatorStateCustomFlags as ge}from"../../../../interactive/interfaces.js";import{EditGeometryOperations as _e}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import{AccumulationBehaviour as fe}from"../../../../interactive/editGeometry/interfaces.js";import{SnappingContext as ve}from"../../../../interactive/snapping/SnappingContext.js";import{SnappingPipeline as Me}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{ReshapeEdgeOffsetTooltipInfo as ye}from"../../../../interactive/tooltip/ReshapeTooltipInfos.js";import{Tooltip as xe}from"../../../../interactive/tooltip/Tooltip.js";import{TranslateGraphicZTooltipInfo as Oe,TranslateGraphicXYTooltipInfo as be,TranslateGraphicTooltipInfo as Ee,TranslateVertexZTooltipInfo as Ge,TranslateVertexXYTooltipInfo as Se,TranslateVertexTooltipInfo as Ve}from"../../../../interactive/tooltip/TranslateTooltipInfos.js";import{autoAreaByDrapedStatus as Ie}from"../../../../support/automaticAreaMeasurementUtils.js";import{autoHorizontalDistanceByElevationModeBetweenPoints as Te,autoLengthByElevationMode as He}from"../../../../support/automaticLengthMeasurementUtils.js";import{verticalSignedDistanceBetweenPoints as we,elevationOfPoint as De}from"../../../../support/euclideanLengthMeasurementUtils.js";import{geodesicDistance as Ae}from"../../../../support/geodesicLengthMeasurementUtils.js";let Le=class extends(t.EventedMixin(i)){constructor(e){super(e),this._vertexManipulatorMaterial=j(q.colorToVec4(q.reshapeManipulators.vertex.color),q.reshapeManipulators.vertex.renderOccluded),this._vertexManipulatorOutlineMaterial=U(q.colorToVec4(q.reshapeManipulators.vertex.outlineColor),q.reshapeManipulators.vertex.renderOccluded),this._vertexManipulatorHoverOutlineMaterial=U(q.colorToVec4(q.reshapeManipulators.vertex.hoverOutlineColor),q.reshapeManipulators.vertex.renderOccluded),this._edgeManipulatorMaterial=j(q.colorToVec4(q.reshapeManipulators.edge.color),q.reshapeManipulators.edge.renderOccluded),this._edgeManipulatorOutlineMaterial=U(q.colorToVec4(q.reshapeManipulators.edge.outlineColor),q.reshapeManipulators.edge.renderOccluded),this._edgeOffsetManipulatorMaterial=j(q.colorToVec4(q.reshapeManipulators.edgeOffset.color),q.reshapeManipulators.edgeOffset.renderOccluded,!1),this._edgeOffsetManipulatorHoverMaterial=j(q.colorToVec4(q.reshapeManipulators.edgeOffset.hoverColor),q.reshapeManipulators.edgeOffset.renderOccluded,!1),this._selectedManipulatorMaterial=j(q.colorToVec4(q.reshapeManipulators.selected.color),q.reshapeManipulators.selected.renderOccluded),this._selectedManipulatorOutlineMaterial=U(q.colorToVec4(q.reshapeManipulators.selected.outlineColor),q.reshapeManipulators.selected.renderOccluded),this._selectedManipulatorHoverOutlineMaterial=U(q.colorToVec4(q.reshapeManipulators.selected.hoverOutlineColor),q.reshapeManipulators.selected.renderOccluded),this._selectedIndex=0,this._vertexManipulatorGeometry=null,this._vertexManipulatorOutlineGeometry=null,this._edgeManipulatorGeometry=null,this._edgeManipulatorOutlineGeometry=null,this._edgeOffsetManipulatorGeometryInside=null,this._edgeOffsetManipulatorGeometryOutside=null,this._manipulatorHandles=new a,this._manipulatorInfos=[],this._editGeometryOperations=null,this._graphicMoveManipulation=null,this._moveManipulation=null,this._numGrabbing=0,this._numDragging=0,this._reshapeEventState=Re.NONE,this._outlineVisualElement=null,this._segmentLabels=null,this.outputGeometry=null,this._snappingPipeline=new Me,this._snappingPipelineHandle=new Me,this._vertexLaserLineVisualElement=null}initialize(){const{graphic:e,view:t}=this,i=this._graphicState=new se({graphic:e});this._tooltip=new xe({view:t}),this.addHandles([m((()=>i.displaying),(e=>{for(const t of this._manipulatorInfos)t.manipulator.available=e})),m((()=>({labels:this._segmentLabels,enabled:this._labelOptions.enabled,edgeOffsetEnabled:this.enableEdgeOffset})),(({labels:e,enabled:t,edgeOffsetEnabled:i})=>{s(e)&&(e.visible=t,e.edgeDistance=i?"far":"default")}),_),g((()=>!this._tooltipOptions.enabled),(()=>this._tooltip.clear()),_),this.view.trackGraphicState(i)])}destroy(){this._segmentLabels=r(this._segmentLabels),this._tooltip=r(this._tooltip),this._editGeometryOperations=r(this._editGeometryOperations),this._moveManipulation=r(this._moveManipulation),this._graphicMoveManipulation=r(this._graphicMoveManipulation),this._manipulatorHandles=r(this._manipulatorHandles),this.manipulators.removeAll(),this._manipulatorInfos=[],this._resetGrabbingDragging()}get inputGeometry(){return s(this._editGeometryOperations)?this._editGeometryOperations.data.geometry:null}set inputGeometry(e){this._recreateEditGeometryAndManipulators(e)}get updating(){return this.updatingHandles.updating}get manipulators(){return this.tool.manipulators}get view(){return this.tool.view}get graphic(){return this.tool.graphic}get enableZShape(){return this.tool.enableZShape}get enableZVertex(){return this.tool.enableZVertex}get enableMoveGraphic(){return this.tool.enableMoveGraphic}get enableMidpoints(){return this.tool.enableMidpoints}get enableEdgeOffset(){return this.tool.enableEdgeOffset}get _labelOptions(){return this.tool.labelOptions}get _tooltipOptions(){return this.tool.tooltipOptions}removeSelectedVertices(){const e=this._manipulatorInfos.filter((e=>e.manipulator.selected&&"vertex"===e.type));this._removeVertices(e)}manipulatorSelectionChanged(){this.emit("manipulators-changed")}_removeManipulators(){this._moveManipulation=r(this._moveManipulation),this._graphicMoveManipulation=r(this._graphicMoveManipulation),this._manipulatorHandles.removeAll(),this.manipulators.removeAll(),this._manipulatorInfos=[]}_resetGrabbingDragging(){this._numGrabbing=0,this._numDragging=0}_createManipulators(){if(l(this._editGeometryOperations))return;const e=A(this.graphic);for(const t of this._editGeometryOperations.data.components){for(const i of t.vertices)this._createVertexOrEdgeManipulator(i,e);for(const i of t.edges)this._createVertexOrEdgeManipulator(i,e)}this._createGraphicMoveManipulators(e)}get canRedo(){return s(this._editGeometryOperations)&&this._editGeometryOperations.canRedo}get canUndo(){return s(this._editGeometryOperations)&&this._editGeometryOperations.canUndo}redo(){if(l(this._editGeometryOperations))return null;const e=this._editGeometryOperations.redo();return s(e)&&(this.outputGeometry=this._editGeometryOperations.data.geometry,this._recreateManipulators()),e}undo(){if(l(this._editGeometryOperations))return null;this.emit("undo");const e=this._editGeometryOperations.undo();return s(e)&&(this.outputGeometry=this._editGeometryOperations.data.geometry,this._recreateManipulators()),e}_recreateManipulators(){this._removeManipulators(),this._resetGrabbingDragging(),this._tooltip.clear(),this._createManipulators()}_recreateEditGeometryAndManipulators(e=this.inputGeometry){this._removeManipulators(),this._resetGrabbingDragging(),this._tooltip.clear(),l(e)||(r(this._editGeometryOperations),this._editGeometryOperations=_e.fromGeometry(e,this.view.state.viewingMode),this._createManipulators(),r(this._segmentLabels),this._segmentLabels=new N({context:{view:this.view,editGeometryOperations:this._editGeometryOperations,elevationInfo:A(this.graphic),labelOptions:this._labelOptions,graphic:this.graphic,graphicState:this._graphicState},visible:this._labelOptions.enabled}))}_perGraphicManipulatorDragAction(e,t){if("end"===t.action)return t;let i=0;const a=[],o=this._manipulatorInfos.some((e=>"vertex"===e.type&&e.manipulator.selected)),n=e===Ce.SELECTED_OR_ALL&&o;for(const r of this._manipulatorInfos)"vertex"===r.type&&(r.manipulator.grabbing||n&&!r.manipulator.selected||a.push(r),i++);if(0===a.length)return t;this._moveVertices(a,t);if(a.length===i){if(this._updateEventState(Re.MOVING),this.destroyed)return t;this.emit("move",{type:"move",dx:t.screenDeltaX,dy:t.screenDeltaY,mover:this.graphic})}else{if(this._updateEventState(Re.RESHAPING),this.destroyed)return t;this.emit("reshape",{type:"reshape",mover:this.graphic})}return t}_isMultiVertexSelection(){let e=0;for(const t of this._manipulatorInfos)"vertex"===t.type&&t.manipulator.selected&&e++;return e>1}_perVertexManipulatorDragAction(e){if(this._updateEventState(Re.RESHAPING),this.destroyed)return;const{mapDeltaX:t,mapDeltaY:i,mapDeltaZ:a}=e;if(!t&&!i&&!a)return;const o=[];for(const n of this._manipulatorInfos)"vertex"===n.type&&(n.manipulator.selected&&!n.manipulator.grabbing||n===e.info)&&o.push(n);this._moveVertices(o,e,fe.ACCUMULATE_STEPS),this.emit("reshape",{type:"reshape",mover:this.graphic})}_updateEventState(e){if(e===this._reshapeEventState)return!1;switch(e){case Re.NONE:if(0!==this._numGrabbing||0!==this._numDragging)return!1;switch(this._reshapeEventState){case Re.MOVING:this.emit("move",{type:"move-stop",dx:0,dy:0,mover:this.graphic});break;case Re.RESHAPING:this.emit("reshape",{type:"reshape-stop",mover:this.graphic})}break;case Re.MOVING:switch(this._reshapeEventState){case Re.NONE:this.emit("move",{type:"move-start",dx:0,dy:0,mover:this.graphic});break;case Re.RESHAPING:this.emit("reshape",{type:"reshape-stop",mover:this.graphic}),this.destroyed||this.emit("move",{type:"move-start",dx:0,dy:0,mover:this.graphic})}break;case Re.RESHAPING:switch(this._reshapeEventState){case Re.NONE:this.emit("reshape",{type:"reshape-start",mover:this.graphic});break;case Re.MOVING:this.emit("move",{type:"move-stop",dx:0,dy:0,mover:this.graphic}),this.destroyed||this.emit("reshape",{type:"reshape-start",mover:this.graphic})}}if(this.destroyed)return!1;const t=this._reshapeEventState!==e;return this._reshapeEventState=e,t}_createGraphicMoveManipulators(e){const{graphic:t,handles:i,tool:a,view:o}=this,n=this._graphicState;if(this._graphicMoveManipulation=new te({tool:a,view:o,graphicState:n}),this.enableMoveGraphic){let e=null;this._manipulatorHandles.add(this._graphicMoveManipulation.createDragPipeline(((t,i,a)=>{i.next((e=>this._trackNumDragging(e))).next((t=>("start"===t.action&&(e=p(this._editGeometryOperations).createUndoGroup()),t))).next((e=>this._perGraphicManipulatorDragAction(Ce.ALL,e))).next((e=>(this._updateTranslateGraphicTooltip(J.XY,e),e))).next((t=>{"end"===t.action&&(this._tooltip.clear(),e=h(e))})),a.next(this._cancelDragOperation((()=>e=h(e))))})))}else this._graphicMoveManipulation.forEachManipulator((e=>{e.grabbable=!1,e.cursor=null}));this._graphicMoveManipulation.forEachManipulator((e=>this._manipulatorHandles.add([this._watchAndUpdateGrabState(e,!1),e.events.on("immediate-click",(e=>{this._manipulatorInfos.some((e=>e.manipulator.selected))?this._clearSelection():this.emit("immediate-click",{...e,graphic:this.graphic}),e.stopPropagation()}))]))),this._moveManipulation=new Q({tool:a,view:o,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZShape&&Z(t),snapToScene:!1,radius:Q.radiusForSymbol(t.symbol)}),this._moveManipulation.forEachManipulator((e=>i.add([e.events.on("immediate-click",(i=>{this._moveManipulation.zManipulation.hasManipulator(e)||this._manipulatorInfos.some((e=>e.manipulator.selected))||this.emit("immediate-click",{...i,graphic:t}),i.stopPropagation()})),this._watchAndUpdateGrabState(e,!1)])));const r=e=>t=>{i.add(t.events.on("focus-changed",(({action:t})=>{"focus"===t&&this._tooltipOptions.enabled?this._updateTranslateTooltip(e):this._tooltip.clear()})))};this._moveManipulation.xyManipulation.forEachManipulator(r(J.XY)),this._moveManipulation.xyAxisManipulation.forEachManipulator(r(J.XY_AXIS)),this._moveManipulation.zManipulation.forEachManipulator(r(J.Z)),this._moveManipulation.elevationInfo={mode:"absolute-height",offset:0};const l=p(t.geometry).spatialReference;i.add([this._moveManipulation.createDragPipeline(((i,o,n,r,s)=>{const l=n.next((e=>this._trackNumDragging(e))).next((e=>{const t=this._manipulatorInfos.filter((e=>"vertex"===e.type&&e.manipulator.selected));return e.manipulatorType===Y.TRANSLATE_XY&&1===t.length?{...e,info:t[0],snapOrigin:t[0].handle.pos}:{...e,info:null}})).next(this._snappingPipelineHandle.createSnapDragEventPipelineStep({predicate:e=>!!e.info,cancel:r,snappingManager:a.snappingManager,snappingContext:new ve({editGeometryOperations:p(this._editGeometryOperations),elevationInfo:e,pointer:s,excludeFeature:t,visualizer:new R}),updatingHandles:this.updatingHandles}),this._snappingPipelineHandle.next).next(he()).next((e=>this._perGraphicManipulatorDragAction(Ce.SELECTED_OR_ALL,e))).next((e=>(this._updateTranslateTooltip(i,e),e)));return r.next(this._cancelDragOperation()),l}),e,l,t),m((()=>n?.displaying),(()=>{this._updateMoveManipulationPosition()}),_),n.on("changed",(()=>this._updateMoveManipulationPosition())),m((()=>n?.isDraped),(e=>{const t="align-move-manipulation";e?i.add(this.view.elevationProvider.on("elevation-change",(()=>this._updateMoveManipulationPosition())),t):i.remove(t)}),_)]),this._updateMoveManipulationPosition();const d=K({view:o,graphic:t,forEachManipulator:e=>{if(!this.destroyed){s(this._graphicMoveManipulation)&&this._graphicMoveManipulation.forEachManipulator(e);for(const t of this._manipulatorInfos)e(t.manipulator,Y.TRANSLATE_XY);this._moveManipulation.forEachManipulator(e)}},onManipulatorsChanged:e=>this.on("manipulators-changed",e)});s(d)&&(this._outlineVisualElement=d.visualElement instanceof re?d.visualElement:null),s(this._outlineVisualElement)&&this._manipulatorHandles.add([this._outlineVisualElement.events.on("attachment-origin-changed",(()=>{n.isDraped||this._updateMoveManipulationPosition()})),m((()=>n.isDraped),(()=>this._updateMoveManipulationPosition()))]),this._manipulatorHandles.add(d)}_createEdgeOffsetManipulator(e,t=A(this.graphic)){const i=q.reshapeManipulators.edgeOffset,a=i.size/2,n=a+i.collisionPadding;if(l(this._edgeOffsetManipulatorGeometryInside)||l(this._edgeOffsetManipulatorGeometryOutside)){const e=a/n,t=e*Math.sqrt(3)/2;this._edgeOffsetManipulatorGeometryInside=le.createExtrudedTriangle(t,e/2,e/2,i.height,i.offset),this._edgeOffsetManipulatorGeometryOutside=le.createExtrudedTriangle(-t,e/2,e/2,i.height,-i.offset)}const r=[{geometry:this._edgeOffsetManipulatorGeometryInside,material:this._edgeOffsetManipulatorMaterial,stateMask:me.Unfocused},{geometry:this._edgeOffsetManipulatorGeometryInside,material:this._edgeOffsetManipulatorHoverMaterial,stateMask:me.Focused},{geometry:this._edgeOffsetManipulatorGeometryOutside,material:this._edgeOffsetManipulatorMaterial,stateMask:me.Unfocused},{geometry:this._edgeOffsetManipulatorGeometryOutside,material:this._edgeOffsetManipulatorHoverMaterial,stateMask:me.Focused}],p=new P({view:this.view,renderObjects:r,elevationInfo:"on-the-ground"!==t.mode||L(this.graphic.symbol)?{mode:"absolute-height",offset:0}:t,worldOriented:!1,focusMultiplier:1,radius:n,available:!(!this.graphic.visible||!this.graphic.layer.visible),collisionType:{type:"disc",direction:V(0,0,1)},collisionPriority:1}),h=new P({view:this.view,renderObjects:[],worldSized:!0,worldOriented:!1,available:!(!this.graphic.visible||!this.graphic.layer.visible),collisionPriority:-10,cursor:this.enableMoveGraphic?"move":"default"}),d={manipulator:p,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0,edgeManipulator:h,elevationInfo:t,visibilityHandle:null};this._autoHideEdgeOffsetManipulator(d,i.minSquaredEdgeLength),this._updateEdgeOffsetManipulator(d);const u=[];for(const o of[d.handle.leftVertex,d.handle.rightVertex]){const e=this._getManipulatorInfoFromHandle(o);s(e)&&u.push(e.manipulator.events.on("location-update",(()=>this._updateEdgeOffsetManipulator(d))))}d.locationUpdateHandle=o(u),this._manipulatorHandles.add(d.locationUpdateHandle,p),this._manipulatorHandles.add([this._watchAndUpdateGrabState(p,!0),this._watchAndUpdateGrabState(h,!0)],p),this._manipulatorHandles.add(de(p,this._createEdgeOffsetPipeline(d,t)),p),this._manipulatorHandles.add(de(h,((e,i,a,o)=>{if("touch"===o){this._createEdgeOffsetPipeline(d,t)(e,i,a)}else if(this.enableMoveGraphic){const o=this.graphic,n=s(o.geometry)?o.geometry.spatialReference:null;i.next((e=>this._trackNumDragging(e))).next(ue(this.view,e.elevationAlignedLocation)).next(z(this.view,e.elevationAlignedLocation,t,n,o)).next(ce()).next(he()).next((e=>this._perGraphicManipulatorDragAction(Ce.ALL,e))).next((e=>(this._updateTranslateGraphicTooltip(J.XY,e),e))).next((e=>{"end"===e.action&&this._tooltip.clear()})),a.next(this._cancelDragOperation())}})),p);const c=e=>{this._manipulatorInfos.some((e=>e.manipulator.selected))?this._clearSelection():this.emit("immediate-click",{...e,graphic:this.graphic}),e.stopPropagation()};return this._manipulatorHandles.add([p.events.on("immediate-click",c),h.events.on("immediate-click",c),p.events.on("focus-changed",(({action:e})=>{const t=this._tooltipOptions;"focus"===e&&t.enabled?this._tooltip.info=new ye({tooltipOptions:t}):this._tooltip.clear()}))],p),this._manipulatorInfos.push(d),this.manipulators.add(p),this.manipulators.add(h),this.emit("manipulators-changed"),d}_autoHideEdgeOffsetManipulator(e,t){const i=e.manipulator,a=e.edgeManipulator,n=()=>{e.visibilityHandle=h(e.visibilityHandle);const n=this._getManipulatorInfoFromHandle(e.handle.leftVertex),r=this._getManipulatorInfoFromHandle(e.handle.rightVertex),l=s(n)&&s(r)&&ne(n.manipulator.renderLocation,r.manipulator.renderLocation,this.view.state.camera)<t;(!i.focused&&!a.focused||l)&&(i.grabbable=!l,a.grabbable=!l,e.visibilityHandle=o([i.disableDisplay(),{remove:()=>{i.grabbable=!0,a.grabbable=this.enableMoveGraphic}}]))};this._manipulatorHandles.add([i.events.on("focus-changed",n),a.events.on("focus-changed",n),{remove:()=>{h(e.visibilityHandle),this.manipulators.remove(a)}}],i),n()}_updateEdgeOffsetManipulator(e){this._updateManipulatorPosition(e);const t=p(this._editGeometryOperations).data.coordinateHelper,i=ie(this.view,e.manipulator.elevationAlignedLocation,ae(t,e.handle,p(e.manipulator.elevationInfo))),a=this._getManipulatorInfoFromHandle(e.handle.leftVertex),o=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(l(a)||l(o))return;const n=a.manipulator.renderLocation,r=o.manipulator.renderLocation,h=s(i)?oe(i,n,r):y;e.manipulator.modelTransform=h,e.edgeManipulator.elevationAlignedLocation=e.manipulator.elevationAlignedLocation,e.edgeManipulator.modelTransform=h;const d=x(O(ke,n,r))/2;e.edgeManipulator.collisionType={type:"line",paths:[[[-d,0,0],[d,0,0]]]}}_createEdgeOffsetPipeline(e,t){return(i,a,o)=>{this._clearSelection();const{step:n,cleanup:r}=this._initializeEdgeOffset(e,t);a.next((e=>this._trackNumDragging(e))).next(ue(this.view,i.elevationAlignedLocation)).next(n).next(C(this.view)).next(F(this.view,p(this._editGeometryOperations).data.spatialReference)).next(he()).next(this._applyComputeEdgeOffsetDistanceStep()).next(this._applyEdgeOffsetStep(e)).next(this._showEdgeOffsetTooltip()).next((e=>{"end"===e.action&&r()})),o.next((e=>(r(),e))).next((e=>(this._tooltip.clear(),e))).next(this._cancelDragOperation())}}_initializeEdgeOffset(e,t){const i=p(this._editGeometryOperations),a=ae(i.data.coordinateHelper,e.handle,t),r=i.createUndoGroup(),d=ie(this.view,e.manipulator.elevationAlignedLocation,a);if(a.requiresSplitEdgeLeft){const t=this._getManipulatorInfoFromHandle(e.handle.leftVertex.leftEdge);s(t)&&this._splitEdgeManipulator(t,1)}if(a.requiresSplitEdgeRight){const t=this._getManipulatorInfoFromHandle(e.handle.rightVertex.rightEdge);s(t)&&this._splitEdgeManipulator(t,0)}const u=()=>new T({paths:[[e.handle.leftVertex.pos,e.handle.rightVertex.pos]],spatialReference:p(this._editGeometryOperations).data.spatialReference}),c=new re({view:this.view,isDraped:this._graphicState.isDraped,geometry:u(),elevationInfo:e.elevationInfo,width:q.visualElements.lineGraphics.outline.width,color:q.colorToVec4(W.main),attached:!0});let g;const _=()=>{this._cleanEdgeOffsetCollapsedEdges(e),g=h(g)},f=this.on("undo",_);return g=o([n(c),m((()=>this._graphicState.isDraped),(e=>c.isDraped=e)),this._graphicState.on("changed",(()=>c.geometry=u())),r,f]),{step:e=>l(a)||l(d)?(_(),null):{...e,operation:a,plane:d},cleanup:_}}_applyEdgeOffsetStep(e){return t=>{if(this.destroyed||l(t.operation))return t;this._updateEventState(Re.RESHAPING);const{mapDeltaX:i,mapDeltaY:a,mapDeltaZ:o}=t;return(i||a||o)&&(this._offsetEdge(e,t),this.emit("reshape",{type:"reshape",mover:this.graphic})),t}}_applyComputeEdgeOffsetDistanceStep(){return e=>{const{operation:t,mapEnd:i}=e;if(l(t)||l(i))return e;const a=t.signedDistanceToPoint(i);return{...e,signedDistance:a}}}_showEdgeOffsetTooltip(){return e=>{const{mapEnd:t,signedDistance:i,operation:a}=e,o=this._tooltip,n=this._tooltipOptions;if(!n.enabled||l(i))return o.clear(),e;const r="end"===e.action?d:je(this._graphicState.isDraped,-i,t,a.plane,p(this._editGeometryOperations).data.coordinateHelper);return l(o.info)||"reshape-edge-offset"!==o.info.type?o.info=new ye({tooltipOptions:n,distance:r}):o.info.distance=r,e}}_cleanEdgeOffsetCollapsedEdges(e){const t=e.handle.leftVertex.leftEdge?.leftVertex,i=e.handle.leftVertex,a=e.handle.rightVertex.rightEdge?.rightVertex,o=e.handle.rightVertex,n=p(this._editGeometryOperations).data.coordinateHelper,r=1e-6,l=[];if(t&&n.distance(t.pos,i.pos)<r){const e=this._getManipulatorInfoFromHandle(i);s(e)&&l.push(e)}if(n.distance(i.pos,o.pos)<r||a&&n.distance(a.pos,o.pos)<r){const e=this._getManipulatorInfoFromHandle(o);s(e)&&l.push(e)}l.length&&this._removeVertices(l)}_computeVertexManipulatorSizeAndOutline(e){const t=e.size/2,i=t+e.collisionPadding;return{size:t/i,outlineSize:(t+e.outlineSize)/i}}_createVertexOrEdgeManipulator(e,t=A(this.graphic)){if("edge"===e.type){if(this.enableEdgeOffset)return this._createEdgeOffsetManipulator(e,t);if(!this.enableMidpoints)return null}if(l(this._vertexManipulatorGeometry)||l(this._vertexManipulatorOutlineGeometry)){const{size:e,outlineSize:t}=this._computeVertexManipulatorSizeAndOutline(q.reshapeManipulators.vertex);this._vertexManipulatorGeometry=le.createSphereGeometry(e,16,16),this._vertexManipulatorOutlineGeometry=le.createSphereGeometry(t,16,16)}if(l(this._edgeManipulatorGeometry)||l(this._edgeManipulatorOutlineGeometry)){const{size:e,outlineSize:t}=this._computeVertexManipulatorSizeAndOutline(q.reshapeManipulators.edge);this._edgeManipulatorGeometry=le.createSphereGeometry(e,16,16),this._edgeManipulatorOutlineGeometry=le.createSphereGeometry(t,16,16)}const i=s(this.graphic.geometry)&&"point"===this.graphic.geometry.type?[]:[{geometry:this._vertexManipulatorGeometry,material:this._vertexManipulatorMaterial,stateMask:Ne.Vertex|me.Unselected},{geometry:this._vertexManipulatorOutlineGeometry,material:this._vertexManipulatorOutlineMaterial,stateMask:Ne.Vertex|me.Unfocused|me.Unselected},{geometry:this._vertexManipulatorOutlineGeometry,material:this._vertexManipulatorHoverOutlineMaterial,stateMask:Ne.Vertex|me.Focused|me.Unselected},{geometry:this._vertexManipulatorGeometry,material:this._selectedManipulatorMaterial,stateMask:me.Selected},{geometry:this._vertexManipulatorOutlineGeometry,material:this._selectedManipulatorOutlineMaterial,stateMask:me.Selected|me.Unfocused},{geometry:this._vertexManipulatorOutlineGeometry,material:this._selectedManipulatorHoverOutlineMaterial,stateMask:me.Selected|me.Focused}];this.enableMidpoints&&i.push({geometry:this._edgeManipulatorGeometry,material:this._vertexManipulatorMaterial,stateMask:Ne.Edge|me.Focused|me.Unselected},{geometry:this._edgeManipulatorOutlineGeometry,material:this._vertexManipulatorHoverOutlineMaterial,stateMask:Ne.Edge|me.Focused|me.Unselected},{geometry:this._edgeManipulatorGeometry,material:this._edgeManipulatorMaterial,stateMask:Ne.Edge|me.Unfocused|me.Unselected},{geometry:this._edgeManipulatorOutlineGeometry,material:this._edgeManipulatorOutlineMaterial,stateMask:Ne.Edge|me.Unfocused|me.Unselected});const a=new P({view:this.view,renderObjects:i,elevationInfo:t,focusMultiplier:1,touchMultiplier:1,available:!(!this.graphic.visible||!this.graphic.layer.visible)});this._setTypeSpecificManipulatorSettings(a,e,t);const n="edge"===e.type?{manipulator:a,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0}:{manipulator:a,handle:e,type:"vertex",selectedIndex:0};if(this._manipulatorInfos.push(n),this.manipulators.add(a),this._updateManipulatorPosition(n),"edge"===n.type){const e=[];for(const t of[n.handle.leftVertex,n.handle.rightVertex]){const i=this._getManipulatorInfoFromHandle(t);s(i)&&e.push(i.manipulator.events.on("location-update",(()=>this._updateManipulatorPosition(n))))}n.locationUpdateHandle=o(e),this._manipulatorHandles.add(n.locationUpdateHandle,a)}this._manipulatorHandles.add(this._watchAndUpdateGrabState(a,!0),a);const r=de(a,((e,i,a,o)=>{let r=null;i.next((e=>this._trackNumDragging(e))).next((e=>{if("start"===e.action&&(r=p(this._editGeometryOperations).createUndoGroup()),"edge"===n.type){const t=this._splitEdgeManipulator(n);return{...e,info:t,snapOrigin:t.handle.pos}}return{...e,info:n,snapOrigin:n.handle.pos}})).next(ue(this.view,e.elevationAlignedLocation)).next(X(this.view,this.graphic,e.elevationAlignedLocation,e.location.spatialReference,this.graphic)).next(this._snappingPipeline.createSnapDragEventPipelineStep({predicate:()=>!this._isMultiVertexSelection(),cancel:a,snappingManager:this.tool.snappingManager,snappingContext:new ve({editGeometryOperations:p(this._editGeometryOperations),elevationInfo:t,pointer:o,excludeFeature:this.graphic,visualizer:new R}),updatingHandles:this.updatingHandles}),this._snappingPipeline.next).next(he()).next((t=>{this._perVertexManipulatorDragAction(t),"end"===t.action&&(r=h(r)),this._updateTranslateVertexTooltip(e,J.XY,t)})),a.next(this._cancelDragOperation((()=>r=h(r))))}));return this._manipulatorHandles.add([r,a.events.on("immediate-click",(e=>this._manipulatorClickCallback(e,n))),a.events.on("select-changed",(()=>{n.selectedIndex=++this._selectedIndex,this._updateMoveManipulationPosition()})),a.events.on("focus-changed",(({action:e})=>{"focus"===e&&"edge"!==n.type?this._updateTranslateVertexTooltip(a,J.XY):this._tooltip.clear()}))],a),this.emit("manipulators-changed"),n}_trackNumDragging(e){switch(e.action){case"start":this._numDragging++;break;case"end":this._numDragging--}return e}_cancelDragOperation(e){return()=>{switch(this._numDragging--,this.undo(),this.outputGeometry=s(this._editGeometryOperations)?this._editGeometryOperations.data.geometry:null,s(this.tool.snappingManager)&&this.tool.snappingManager.doneSnapping(),this._tooltip.clear(),this._reshapeEventState){case Re.NONE:break;case Re.MOVING:this.emit("move",{type:"move",dx:0,dy:0,mover:this.graphic});break;case Re.RESHAPING:this.emit("reshape",{type:"reshape",mover:this.graphic})}e&&e(),this.destroyed||this._updateEventState(Re.NONE)}}_setTypeSpecificManipulatorSettings(e,t,i){switch(t.type){case"vertex":e.state=Ne.Vertex,e.selectable=!0,e.cursor="move",e.collisionPriority=2,e.radius=q.reshapeManipulators.vertex.size/2+q.reshapeManipulators.vertex.collisionPadding,e.elevationInfo=i,e.interactive=s(this.graphic.geometry)&&"point"!==this.graphic.geometry.type;break;case"edge":e.state=Ne.Edge,e.selectable=!1,e.cursor="copy",e.collisionPriority=-1,e.radius=q.reshapeManipulators.edge.size/2+q.reshapeManipulators.edge.collisionPadding,e.elevationInfo="on-the-ground"!==i.mode||L(this.graphic.symbol)?{mode:"absolute-height",offset:0}:i}}_watchAndUpdateGrabState(e,t){return e.events.on("grab-changed",(i=>this._onGrabStateChanged(e,t,i.action,i.pointerType)))}_onGrabStateChanged(e,t,i,a="mouse"){if("start"===i)t&&this._updateSelection(e),this._numGrabbing++;else if(this._numGrabbing--,this._updateEventState(Re.NONE),this.destroyed)return;this._moveManipulation.interactive=!this._numGrabbing,("touch"!==a||this.enableEdgeOffset)&&(this._manipulatorInfos.forEach((e=>{e.manipulator.interactive=e.manipulator.grabbing||!this._numGrabbing&&s(this.graphic.geometry)&&"point"!==this.graphic.geometry.type,"edgeManipulator"in e&&(e.edgeManipulator.interactive=e.edgeManipulator.grabbing||!this._numGrabbing)})),p(this._graphicMoveManipulation).forEachManipulator((e=>{e.interactive=e.grabbing||!this._numGrabbing})))}_clearSelection(){for(const e of this._manipulatorInfos)e.manipulator.grabbing||(e.manipulator.selected=!1)}_updateSelection(e){e.grabbing&&!e.selected&&e.selectable&&(this._clearSelection(),e.selected=!0,this.emit("manipulators-changed"))}_removeManipulator(e){l(e)||(this._manipulatorHandles.remove(e.manipulator),this._manipulatorInfos.splice(this._manipulatorInfos.indexOf(e),1),this.manipulators.remove(e.manipulator),this.emit("manipulators-changed"))}_getManipulatorInfoFromHandle(e){if(e)for(const t of this._manipulatorInfos)if(e===t.handle)return t;return null}_updateManipulatorPosition(e){if(l(e))return;const t=p(this._editGeometryOperations);if("vertex"===e.type)e.manipulator.location=t.data.coordinateHelper.vectorToDehydratedPoint(e.handle.pos,Ue),e.manipulator.grabbing&&s(this._vertexLaserLineVisualElement)&&(this._vertexLaserLineVisualElement.visualElement.intersectsWorldUpAtLocation=e.manipulator.renderLocation);else if("edge"===e.type){const i=this._getManipulatorInfoFromHandle(e.handle.leftVertex),a=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(l(i)||l(a))return;const o=i.manipulator,n=a.manipulator;if(s(e.manipulator.elevationInfo)&&"on-the-ground"===e.manipulator.elevationInfo.mode){const i=o.location,a=n.location,r=.5,s=i.x+r*(a.x-i.x),l=i.y+r*(a.y-i.y),p=i.hasZ&&a.hasZ?0:void 0;e.manipulator.location=D(s,l,p,t.data.spatialReference)}else b(ke,o.renderLocation,n.renderLocation,.5),e.manipulator.renderLocation=ke}}_splitEdgeManipulator(e,t=.5){const i=p(this._editGeometryOperations),a=p(i.splitEdge(e.handle,t).createdVertex);e.locationUpdateHandle.remove(),e.locationUpdateHandle=void 0;const o=A(this.graphic);let n;this.enableEdgeOffset?(this._removeManipulator(e),n=this._createVertexOrEdgeManipulator(a)):(n=e,n.handle=a,n.type="vertex",this._setTypeSpecificManipulatorSettings(e.manipulator,e.handle,o)),a.leftEdge&&this._createVertexOrEdgeManipulator(a.leftEdge),a.rightEdge&&this._createVertexOrEdgeManipulator(a.rightEdge),this.outputGeometry=i.data.geometry,this._updateManipulatorPosition(n),this.enableEdgeOffset||this._updateTranslateVertexTooltip(n.manipulator,J.XY),this._updateSelection(e.manipulator);const r=this._updateEventState(Re.RESHAPING),s=i.data.coordinateHelper.vectorToArray(n.handle.pos),l=i.data.components.indexOf(a.component);return this.emit("vertex-add",{type:"vertex-add",vertices:[{coordinates:s,componentIndex:l,vertexIndex:p(a.index)}],added:s}),r&&this._updateEventState(Re.NONE),n}_updateMoveManipulationPosition(){const e=E(ke,0,0,0);let t=0,i=!1,a=null,o=null;for(const n of this._manipulatorInfos)"vertex"===n.type&&(n.manipulator.selected?(t++,G(e,e,n.manipulator.renderLocation),l(a)||n.selectedIndex>a.selectedIndex?(o=a,a=n):(l(o)||n.selectedIndex>o.selectedIndex)&&(o=n)):i=!0);if(0!==t){const e=this._graphicState.displaying;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.zManipulation.available=e&&this.enableZVertex&&Z(this.graphic),this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e&&1!==t}else{const e=this._graphicState.displaying&&this.enableMoveGraphic;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e,this._moveManipulation.zManipulation.available=e&&this.enableZShape&&Z(this.graphic)}if(0!==t){let e=0;if(s(a)){const t=a.handle.pos,i=s(o)?o.handle.pos:a.handle.leftEdge&&a.handle.leftEdge.leftVertex?a.handle.leftEdge.leftVertex.pos:null,n=l(o)&&a.handle.rightEdge&&a.handle.rightEdge.rightVertex?a.handle.rightEdge.rightVertex.pos:null;i&&n?this._moveManipulation.xyAxisManipulation.available=!1:i?e=Pe(i,t):n&&(e=Pe(t,n))}this._moveManipulation.angle=e,this._moveManipulation.radius=B}else this._moveManipulation.angle=$(p(this.graphic.geometry)),this._moveManipulation.radius=Q.radiusForSymbol(this.graphic.symbol);0!==t&&i?(S(e,e,1/t),Ue.spatialReference=p(this._editGeometryOperations).data.spatialReference,Ue.hasZ=!0,this.view.renderCoordsHelper.fromRenderCoords(e,Ue),this._moveManipulation.elevationAlignedLocation=Ue):s(this._outlineVisualElement)&&!this._graphicState.isDraped&&s(this._outlineVisualElement.attachmentOrigin)?this._moveManipulation.elevationAlignedLocation=this._outlineVisualElement.attachmentOrigin:k(this.view,this._moveManipulation,this.graphic)}_removeVertices(e){const t=[],i=p(this._editGeometryOperations);for(const a of e)if("vertex"===a.type&&i.canRemoveVertex()){t.push(a.handle),this._removeManipulator(a),this._removeManipulator(this._getManipulatorInfoFromHandle(a.handle.leftEdge)),this._removeManipulator(this._getManipulatorInfoFromHandle(a.handle.rightEdge));const e=p(i.removeVertices([a.handle]).removedVertices[0].createdEdge);e&&this._createVertexOrEdgeManipulator(e)}if(t.length>0){const e=t.map((e=>{const t=i.data.components.indexOf(e.component);return{coordinates:i.data.coordinateHelper.vectorToArray(e.pos),componentIndex:t,vertexIndex:p(e.index)}}));this.outputGeometry=i.data.geometry;const a=this._updateEventState(Re.RESHAPING);if(this.destroyed)return;if(this.emit("vertex-remove",{type:"vertex-remove",removed:e.map((e=>e.coordinates)),vertices:e}),this.destroyed)return;if(a&&(this._updateEventState(Re.NONE),this.destroyed))return;this._updateMoveManipulationPosition()}}_moveVertices(e,t,i=("start"===t.action?fe.NEW_STEP:fe.ACCUMULATE_STEPS)){const a=p(this._editGeometryOperations);a.moveVertices(e.map((e=>e.handle)),t.mapDeltaX,t.mapDeltaY,t.mapDeltaZ,i),this.outputGeometry=a.data.geometry;for(const o of e)this._updateManipulatorPosition(o)}_offsetEdge(e,t){if(l(t.operation)||l(t.signedDistance))return;const i=p(this._editGeometryOperations),a=t.operation.clone();a.distance=t.signedDistance,i.updateVertices([e.handle.leftVertex,e.handle.rightVertex],a),this.outputGeometry=i.data.geometry,this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.leftVertex)),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.rightVertex))}_manipulatorClickCallback(e,t){e.shiftKey||this._clearSelection(),"vertex"===t.type&&(t.manipulator.selected=!t.manipulator.selected,e.button===pe.Right&&this._removeVertices([t])),"edge"===t.type&&e.button===pe.Left&&this._splitEdgeManipulator(t),e.stopPropagation()}_updateTranslateTooltip(e,t){const i=this._manipulatorInfos.filter((e=>"vertex"===e.type&&e.manipulator.selected));1===i.length?this._updateTranslateVertexTooltip(i[0].manipulator,e,t):this._updateTranslateGraphicTooltip(e,t)}_updateTranslateGraphicTooltip(e,t){const i=this._tooltipOptions;if(!i.enabled)return;const a=this._graphicState.isDraped?"on-the-ground":"absolute-height";switch(e){case J.XY:this._tooltip.info=new Ee({tooltipOptions:i}),this._updateTranslateTooltipDistance(this._tooltip.info,t,((e,t)=>Te(e,t,a)));break;case J.XY_AXIS:this._tooltip.info=new be({tooltipOptions:i}),this._updateTranslateTooltipDistance(this._tooltip.info,t,((e,i)=>{const o=Te(e,i,a);return u(o,ee(t))}));break;case J.Z:this._tooltip.info=new Oe({tooltipOptions:i}),this._updateTranslateTooltipDistance(this._tooltip.info,t,we)}}_updateTranslateVertexTooltip(e,t,i){const a=this._tooltipOptions;if(!a.enabled)return;let o;const n=this._graphicState.isDraped?"on-the-ground":"absolute-height";switch(t){case J.XY:o=new Ve({tooltipOptions:a}),this._updateTranslateTooltipDistance(o,i,((e,t)=>Te(e,t,n))),this._updateTranslateVertexTooltipSum(o);break;case J.XY_AXIS:o=new Se({tooltipOptions:a}),this._updateTranslateTooltipDistance(o,i,((e,t)=>{const a=Te(e,t,n);return u(a,ee(i))})),this._updateTranslateVertexTooltipSum(o);break;case J.Z:o=new Ge({tooltipOptions:a}),this._updateTranslateTooltipDistance(o,i,we)}const r=De(e.elevationAlignedLocation);s(r)&&(o.elevation={mode:"absolute-height",...r}),this._tooltip.info=o}_updateTranslateTooltipDistance(e,t,i){if(s(t)&&"end"!==t.action){const{mapStart:a,mapEnd:o}=t,n=i(a,o);e.distance=s(n)?n:d}}_updateTranslateVertexTooltipSum(e){const{geometry:t}=this.graphic;s(t)&&(e.area="polygon"===t.type?Ie(t,this._graphicState.isDraped):null,e.totalLength="polyline"===t.type?He(t,this._graphicState.isDraped?"on-the-ground":"absolute-height"):null)}get test(){return{segmentLabels:this._segmentLabels,tooltip:this._tooltip}}};function Pe(e,t){return Math.atan2(t[1]-e[1],t[0]-e[0])+Math.PI/2}function je(e,t,i,a,o){if(e){const e=o.toXYZ(o.pointToVector(i)),n=H(a,e,w.get()),r=Ae(n,e,o.spatialReference);if(s(r))return c(r.value*Math.sign(t),r.unit)}return c(t*f(i.spatialReference),"meters")}e([v()],Le.prototype,"_segmentLabels",void 0),e([v({constructOnly:!0})],Le.prototype,"tool",void 0),e([v()],Le.prototype,"_tooltip",void 0),e([v()],Le.prototype,"inputGeometry",null),e([v()],Le.prototype,"outputGeometry",void 0),e([v({readOnly:!0})],Le.prototype,"updating",null),e([v()],Le.prototype,"manipulators",null),e([v()],Le.prototype,"view",null),e([v()],Le.prototype,"graphic",null),e([v()],Le.prototype,"enableZShape",null),e([v()],Le.prototype,"enableZVertex",null),e([v()],Le.prototype,"enableMoveGraphic",null),e([v()],Le.prototype,"enableMidpoints",null),e([v()],Le.prototype,"enableEdgeOffset",null),e([v()],Le.prototype,"_labelOptions",null),e([v()],Le.prototype,"_tooltipOptions",null),Le=e([M("esri.views.3d.interactive.editingTools.reshapeGraphic.ReshapeOperation")],Le);const Ue=D(0,0,null,null),ke=I();var Ne,Re,Ce;!function(e){e.Vertex=ge.Custom1,e.Edge=ge.Custom2}(Ne||(Ne={})),function(e){e[e.NONE=0]="NONE",e[e.MOVING=1]="MOVING",e[e.RESHAPING=2]="RESHAPING"}(Re||(Re={})),function(e){e[e.ALL=0]="ALL",e[e.SELECTED_OR_ALL=1]="SELECTED_OR_ALL"}(Ce||(Ce={}));export{Le as ReshapeOperation};
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import"../../../../../core/has.js";import t from"../../../../../core/Evented.js";import{HandleOwner as i}from"../../../../../core/HandleOwner.js";import a from"../../../../../core/Handles.js";import{handlesGroup as o,destroyHandle as n}from"../../../../../core/handleUtils.js";import{destroyMaybe as r,isSome as s,isNone as l,unwrap as p,removeMaybe as h}from"../../../../../core/maybe.js";import{zeroMeters as d,scale as u,createLength as c}from"../../../../../core/quantityUtils.js";import{watch as m,when as g,initial as _}from"../../../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as f}from"../../../../../core/unitUtils.js";import{property as v}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as M}from"../../../../../core/accessorSupport/decorators/subclass.js";import{I as y}from"../../../../../chunks/mat4f64.js";import{l as x,b as O,h as b,s as E,a as G,g as S}from"../../../../../chunks/vec3.js";import{f as V,c as I}from"../../../../../chunks/vec3f64.js";import T from"../../../../../geometry/Polyline.js";import{projectPoint as w}from"../../../../../geometry/support/plane.js";import{sv3d as H}from"../../../../../geometry/support/vectorStacks.js";import{makeDehydratedPoint as D}from"../../../../../layers/graphics/dehydratedFeatures.js";import{getGraphicEffectiveElevationInfo as A}from"../../../../../support/elevationInfoUtils.js";import{isVolumetricSymbol as L}from"../../../../../symbols/support/utils.js";import{Manipulator3D as P}from"../../Manipulator3D.js";import{createManipulatorMaterial as j,createManipulatorOutlineMaterial as U,placeAtGraphic as k}from"../../manipulatorUtils.js";import{SegmentLabels3D as N}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as R}from"../../SnappingVisualizer3D.js";import{screenToRenderPlaneFromEvent as C,convertToMapCoordinates as F,screenToMapXYAtLocation as z,screenToMapXYForGraphicAtLocation as X}from"../dragEventPipeline3D.js";import{ManipulatorType as Y}from"../ManipulatorType.js";import{canMoveZ as Z}from"../manipulatorUtils.js";import{settings as q,colors as W}from"../settings.js";import{createVisualElements as K}from"../visualElementUtils.js";import{DISC_RADIUS_SMALL as B}from"../manipulations/config.js";import{ManipulationType as J,MoveManipulation as Q}from"../manipulations/MoveManipulation.js";import{shapeOrientation as $,axisConstrainedDragSign as ee}from"../manipulations/moveUtils.js";import{MoveXYGraphicManipulation as te}from"../manipulations/MoveXYGraphicManipulation.js";import{createEdgeOffsetIntersectionPlane as ie,createEdgeOffsetOperation as ae,edgeOffsetRotationMatrix as oe,screenEdgeLengthSquared as ne}from"./edgeOffsetUtils.js";import{OutlineVisualElement as re}from"../../visualElements/OutlineVisualElement.js";import{GraphicState as se}from"../../../layers/graphics/GraphicState.js";import le from"../../../webgl-engine/lib/GeometryUtil.js";import{MouseButton as pe}from"../../../../input/IViewEvents.js";import{addMapDelta as he,createManipulatorDragEventPipeline as de,dragAtLocation as ue,addScreenDelta as ce}from"../../../../interactive/dragEventPipeline.js";import{ManipulatorStateFlags as me,ManipulatorStateCustomFlags as ge}from"../../../../interactive/interfaces.js";import{EditGeometryOperations as _e}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import{AccumulationBehaviour as fe}from"../../../../interactive/editGeometry/interfaces.js";import{SnappingContext as ve}from"../../../../interactive/snapping/SnappingContext.js";import{SnappingPipeline as Me}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{ReshapeEdgeOffsetTooltipInfo as ye}from"../../../../interactive/tooltip/ReshapeTooltipInfos.js";import{Tooltip as xe}from"../../../../interactive/tooltip/Tooltip.js";import{TranslateGraphicZTooltipInfo as Oe,TranslateGraphicXYTooltipInfo as be,TranslateGraphicTooltipInfo as Ee,TranslateVertexZTooltipInfo as Ge,TranslateVertexXYTooltipInfo as Se,TranslateVertexTooltipInfo as Ve}from"../../../../interactive/tooltip/TranslateTooltipInfos.js";import{autoAreaByDrapedStatus as Ie}from"../../../../support/automaticAreaMeasurementUtils.js";import{autoHorizontalDistanceByElevationModeBetweenPoints as Te,autoLengthByElevationMode as we}from"../../../../support/automaticLengthMeasurementUtils.js";import{verticalSignedDistanceBetweenPoints as He,elevationOfPoint as De}from"../../../../support/euclideanLengthMeasurementUtils.js";import{geodesicDistance as Ae}from"../../../../support/geodesicLengthMeasurementUtils.js";let Le=class extends(t.EventedMixin(i)){constructor(e){super(e),this._vertexManipulatorMaterial=j(q.colorToVec4(q.reshapeManipulators.vertex.color),q.reshapeManipulators.vertex.renderOccluded),this._vertexManipulatorOutlineMaterial=U(q.colorToVec4(q.reshapeManipulators.vertex.outlineColor),q.reshapeManipulators.vertex.renderOccluded),this._vertexManipulatorHoverOutlineMaterial=U(q.colorToVec4(q.reshapeManipulators.vertex.hoverOutlineColor),q.reshapeManipulators.vertex.renderOccluded),this._edgeManipulatorMaterial=j(q.colorToVec4(q.reshapeManipulators.edge.color),q.reshapeManipulators.edge.renderOccluded),this._edgeManipulatorOutlineMaterial=U(q.colorToVec4(q.reshapeManipulators.edge.outlineColor),q.reshapeManipulators.edge.renderOccluded),this._edgeOffsetManipulatorMaterial=j(q.colorToVec4(q.reshapeManipulators.edgeOffset.color),q.reshapeManipulators.edgeOffset.renderOccluded,!1),this._edgeOffsetManipulatorHoverMaterial=j(q.colorToVec4(q.reshapeManipulators.edgeOffset.hoverColor),q.reshapeManipulators.edgeOffset.renderOccluded,!1),this._selectedManipulatorMaterial=j(q.colorToVec4(q.reshapeManipulators.selected.color),q.reshapeManipulators.selected.renderOccluded),this._selectedManipulatorOutlineMaterial=U(q.colorToVec4(q.reshapeManipulators.selected.outlineColor),q.reshapeManipulators.selected.renderOccluded),this._selectedManipulatorHoverOutlineMaterial=U(q.colorToVec4(q.reshapeManipulators.selected.hoverOutlineColor),q.reshapeManipulators.selected.renderOccluded),this._selectedIndex=0,this._vertexManipulatorGeometry=null,this._vertexManipulatorOutlineGeometry=null,this._edgeManipulatorGeometry=null,this._edgeManipulatorOutlineGeometry=null,this._edgeOffsetManipulatorGeometryInside=null,this._edgeOffsetManipulatorGeometryOutside=null,this._manipulatorHandles=new a,this._manipulatorInfos=[],this._editGeometryOperations=null,this._graphicMoveManipulation=null,this._moveManipulation=null,this._numGrabbing=0,this._numDragging=0,this._reshapeEventState=Re.NONE,this._outlineVisualElement=null,this._segmentLabels=null,this.outputGeometry=null,this._snappingPipeline=new Me,this._snappingPipelineHandle=new Me,this._vertexLaserLineVisualElement=null}initialize(){const{graphic:e,view:t}=this,i=this._graphicState=new se({graphic:e});this._tooltip=new xe({view:t}),this.addHandles([m((()=>i.displaying),(e=>{for(const t of this._manipulatorInfos)t.manipulator.available=e})),m((()=>({labels:this._segmentLabels,enabled:this._labelOptions.enabled,edgeOffsetEnabled:this.enableEdgeOffset})),(({labels:e,enabled:t,edgeOffsetEnabled:i})=>{s(e)&&(e.visible=t,e.edgeDistance=i?"far":"default")}),_),g((()=>!this._tooltipOptions.enabled),(()=>this._tooltip.clear()),_),this.view.trackGraphicState(i)])}destroy(){this._segmentLabels=r(this._segmentLabels),this._tooltip=r(this._tooltip),this._editGeometryOperations=r(this._editGeometryOperations),this._moveManipulation=r(this._moveManipulation),this._graphicMoveManipulation=r(this._graphicMoveManipulation),this._manipulatorHandles=r(this._manipulatorHandles),this.manipulators.removeAll(),this._manipulatorInfos=[],this._resetGrabbingDragging()}get inputGeometry(){return s(this._editGeometryOperations)?this._editGeometryOperations.data.geometry:null}set inputGeometry(e){this._recreateEditGeometryAndManipulators(e)}get updating(){return this.updatingHandles.updating}get manipulators(){return this.tool.manipulators}get view(){return this.tool.view}get graphic(){return this.tool.graphic}get enableZShape(){return this.tool.enableZShape}get enableZVertex(){return this.tool.enableZVertex}get enableMoveGraphic(){return this.tool.enableMoveGraphic}get enableMidpoints(){return this.tool.enableMidpoints}get enableEdgeOffset(){return this.tool.enableEdgeOffset}get _labelOptions(){return this.tool.labelOptions}get _tooltipOptions(){return this.tool.tooltipOptions}removeSelectedVertices(){const e=this._manipulatorInfos.filter((e=>e.manipulator.selected&&"vertex"===e.type));this._removeVertices(e)}manipulatorSelectionChanged(){this.emit("manipulators-changed")}_removeManipulators(){this._moveManipulation=r(this._moveManipulation),this._graphicMoveManipulation=r(this._graphicMoveManipulation),this._manipulatorHandles.removeAll(),this.manipulators.removeAll(),this._manipulatorInfos=[]}_resetGrabbingDragging(){this._numGrabbing=0,this._numDragging=0}_createManipulators(){if(l(this._editGeometryOperations))return;const e=A(this.graphic);for(const t of this._editGeometryOperations.data.components){for(const i of t.vertices)this._createVertexOrEdgeManipulator(i,e);for(const i of t.edges)this._createVertexOrEdgeManipulator(i,e)}this._createGraphicMoveManipulators(e)}get canRedo(){return s(this._editGeometryOperations)&&this._editGeometryOperations.canRedo}get canUndo(){return s(this._editGeometryOperations)&&this._editGeometryOperations.canUndo}redo(){if(l(this._editGeometryOperations))return null;const e=this._editGeometryOperations.redo();return s(e)&&(this.outputGeometry=this._editGeometryOperations.data.geometry,this._recreateManipulators()),e}undo(){if(l(this._editGeometryOperations))return null;this.emit("undo");const e=this._editGeometryOperations.undo();return s(e)&&(this.outputGeometry=this._editGeometryOperations.data.geometry,this._recreateManipulators()),e}_recreateManipulators(){this._removeManipulators(),this._resetGrabbingDragging(),this._tooltip.clear(),this._createManipulators()}_recreateEditGeometryAndManipulators(e=this.inputGeometry){this._removeManipulators(),this._resetGrabbingDragging(),this._tooltip.clear(),l(e)||(r(this._editGeometryOperations),this._editGeometryOperations=_e.fromGeometry(e,this.view.state.viewingMode),this._createManipulators(),r(this._segmentLabels),this._segmentLabels=new N({context:{view:this.view,editGeometryOperations:this._editGeometryOperations,elevationInfo:A(this.graphic),labelOptions:this._labelOptions,graphic:this.graphic,graphicState:this._graphicState},visible:this._labelOptions.enabled}))}_perGraphicManipulatorDragAction(e,t){if("end"===t.action)return t;let i=0;const a=[],o=this._manipulatorInfos.some((e=>"vertex"===e.type&&e.manipulator.selected)),n=e===Ce.SELECTED_OR_ALL&&o;for(const r of this._manipulatorInfos)"vertex"===r.type&&(r.manipulator.grabbing||n&&!r.manipulator.selected||a.push(r),i++);if(0===a.length)return t;this._moveVertices(a,t);if(a.length===i){if(this._updateEventState(Re.MOVING),this.destroyed)return t;this.emit("move",{type:"move",dx:t.screenDeltaX,dy:t.screenDeltaY,mover:this.graphic})}else{if(this._updateEventState(Re.RESHAPING),this.destroyed)return t;this.emit("reshape",{type:"reshape",mover:this.graphic})}return t}_isMultiVertexSelection(){let e=0;for(const t of this._manipulatorInfos)"vertex"===t.type&&t.manipulator.selected&&e++;return e>1}_perVertexManipulatorDragAction(e){if(this._updateEventState(Re.RESHAPING),this.destroyed)return;const{mapDeltaX:t,mapDeltaY:i,mapDeltaZ:a}=e;if(!t&&!i&&!a)return;const o=[];for(const n of this._manipulatorInfos)"vertex"===n.type&&(n.manipulator.selected&&!n.manipulator.grabbing||n===e.info)&&o.push(n);this._moveVertices(o,e,fe.ACCUMULATE_STEPS),this.emit("reshape",{type:"reshape",mover:this.graphic})}_updateEventState(e){if(e===this._reshapeEventState)return!1;switch(e){case Re.NONE:if(0!==this._numGrabbing||0!==this._numDragging)return!1;switch(this._reshapeEventState){case Re.MOVING:this.emit("move",{type:"move-stop",dx:0,dy:0,mover:this.graphic});break;case Re.RESHAPING:this.emit("reshape",{type:"reshape-stop",mover:this.graphic})}break;case Re.MOVING:switch(this._reshapeEventState){case Re.NONE:this.emit("move",{type:"move-start",dx:0,dy:0,mover:this.graphic});break;case Re.RESHAPING:this.emit("reshape",{type:"reshape-stop",mover:this.graphic}),this.destroyed||this.emit("move",{type:"move-start",dx:0,dy:0,mover:this.graphic})}break;case Re.RESHAPING:switch(this._reshapeEventState){case Re.NONE:this.emit("reshape",{type:"reshape-start",mover:this.graphic});break;case Re.MOVING:this.emit("move",{type:"move-stop",dx:0,dy:0,mover:this.graphic}),this.destroyed||this.emit("reshape",{type:"reshape-start",mover:this.graphic})}}if(this.destroyed)return!1;const t=this._reshapeEventState!==e;return this._reshapeEventState=e,t}_createGraphicMoveManipulators(e){const{graphic:t,handles:i,tool:a,view:o}=this,n=this._graphicState;if(this._graphicMoveManipulation=new te({tool:a,view:o,graphicState:n}),this.enableMoveGraphic){let e=null;this._manipulatorHandles.add(this._graphicMoveManipulation.createDragPipeline(((t,i,a)=>{i.next((e=>this._trackNumDragging(e))).next((t=>("start"===t.action&&(e=p(this._editGeometryOperations).createUndoGroup()),t))).next((e=>this._perGraphicManipulatorDragAction(Ce.ALL,e))).next((e=>(this._updateTranslateGraphicTooltip(J.XY,e),e))).next((t=>{"end"===t.action&&(this._tooltip.clear(),e=h(e))})),a.next(this._cancelDragOperation((()=>e=h(e))))})))}else this._graphicMoveManipulation.forEachManipulator((e=>{e.grabbable=!1,e.cursor=null}));this._graphicMoveManipulation.forEachManipulator((e=>this._manipulatorHandles.add([this._watchAndUpdateGrabState(e,!1),e.events.on("immediate-click",(e=>{this._manipulatorInfos.some((e=>e.manipulator.selected))?this._clearSelection():this.emit("immediate-click",{...e,graphic:this.graphic}),e.stopPropagation()}))]))),this._moveManipulation=new Q({tool:a,view:o,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZShape&&Z(t),snapToScene:!1,radius:Q.radiusForSymbol(t.symbol)}),this._moveManipulation.forEachManipulator((e=>i.add([e.events.on("immediate-click",(i=>{this._moveManipulation.zManipulation.hasManipulator(e)||this._manipulatorInfos.some((e=>e.manipulator.selected))||this.emit("immediate-click",{...i,graphic:t}),i.stopPropagation()})),this._watchAndUpdateGrabState(e,!1)])));const r=e=>t=>{i.add(t.events.on("focus-changed",(({action:t})=>{"focus"===t&&this._tooltipOptions.enabled?this._updateTranslateTooltip(e):this._tooltip.clear()})))};this._moveManipulation.xyManipulation.forEachManipulator(r(J.XY)),this._moveManipulation.xyAxisManipulation.forEachManipulator(r(J.XY_AXIS)),this._moveManipulation.zManipulation.forEachManipulator(r(J.Z)),this._moveManipulation.elevationInfo={mode:"absolute-height",offset:0};const l=p(t.geometry).spatialReference;i.add([this._moveManipulation.createDragPipeline(((i,o,n,r,s)=>{const l=n.next((e=>this._trackNumDragging(e))).next((e=>{const t=this._manipulatorInfos.filter((e=>"vertex"===e.type&&e.manipulator.selected));return e.manipulatorType===Y.TRANSLATE_XY&&1===t.length?{...e,info:t[0],snapOrigin:t[0].handle.pos}:{...e,info:null}})).next(this._snappingPipelineHandle.createSnapDragEventPipelineStep({predicate:e=>!!e.info,cancel:r,snappingManager:a.snappingManager,snappingContext:new ve({editGeometryOperations:p(this._editGeometryOperations),elevationInfo:e,pointer:s,excludeFeature:t,visualizer:new R}),updatingHandles:this.updatingHandles}),this._snappingPipelineHandle.next).next(he()).next((e=>this._perGraphicManipulatorDragAction(Ce.SELECTED_OR_ALL,e))).next((e=>(this._updateTranslateTooltip(i,e),e)));return r.next(this._cancelDragOperation()),l}),e,l,t),m((()=>n?.displaying),(()=>{this._updateMoveManipulationPosition()}),_),n.on("changed",(()=>this._updateMoveManipulationPosition())),m((()=>n?.isDraped),(e=>{const t="align-move-manipulation";e?i.add(this.view.elevationProvider.on("elevation-change",(()=>this._updateMoveManipulationPosition())),t):i.remove(t)}),_)]),this._updateMoveManipulationPosition();const d=K({view:o,graphic:t,forEachManipulator:e=>{if(!this.destroyed){s(this._graphicMoveManipulation)&&this._graphicMoveManipulation.forEachManipulator(e);for(const t of this._manipulatorInfos)e(t.manipulator,Y.TRANSLATE_XY);this._moveManipulation.forEachManipulator(e)}},onManipulatorsChanged:e=>this.on("manipulators-changed",e)});s(d)&&(this._outlineVisualElement=d.visualElement instanceof re?d.visualElement:null),s(this._outlineVisualElement)&&this._manipulatorHandles.add([this._outlineVisualElement.events.on("attachment-origin-changed",(()=>{n.isDraped||this._updateMoveManipulationPosition()})),m((()=>n.isDraped),(()=>this._updateMoveManipulationPosition()))]),this._manipulatorHandles.add(d)}_createEdgeOffsetManipulator(e,t=A(this.graphic)){const i=q.reshapeManipulators.edgeOffset,a=i.size/2,n=a+i.collisionPadding;if(l(this._edgeOffsetManipulatorGeometryInside)||l(this._edgeOffsetManipulatorGeometryOutside)){const e=a/n,t=e*Math.sqrt(3)/2;this._edgeOffsetManipulatorGeometryInside=le.createExtrudedTriangle(t,e/2,e/2,i.height,i.offset),this._edgeOffsetManipulatorGeometryOutside=le.createExtrudedTriangle(-t,e/2,e/2,i.height,-i.offset)}const r=[{geometry:this._edgeOffsetManipulatorGeometryInside,material:this._edgeOffsetManipulatorMaterial,stateMask:me.Unfocused},{geometry:this._edgeOffsetManipulatorGeometryInside,material:this._edgeOffsetManipulatorHoverMaterial,stateMask:me.Focused},{geometry:this._edgeOffsetManipulatorGeometryOutside,material:this._edgeOffsetManipulatorMaterial,stateMask:me.Unfocused},{geometry:this._edgeOffsetManipulatorGeometryOutside,material:this._edgeOffsetManipulatorHoverMaterial,stateMask:me.Focused}],p=new P({view:this.view,renderObjects:r,elevationInfo:"on-the-ground"!==t.mode||L(this.graphic.symbol)?{mode:"absolute-height",offset:0}:t,worldOriented:!1,focusMultiplier:1,radius:n,available:!(!this.graphic.visible||!this.graphic.layer.visible),collisionType:{type:"disc",direction:V(0,0,1)},collisionPriority:1}),h=new P({view:this.view,renderObjects:[],worldSized:!0,worldOriented:!1,available:!(!this.graphic.visible||!this.graphic.layer.visible),collisionPriority:-10,cursor:this.enableMoveGraphic?"move":"default"}),d={manipulator:p,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0,edgeManipulator:h,elevationInfo:t,visibilityHandle:null};this._autoHideEdgeOffsetManipulator(d,i.minSquaredEdgeLength),this._updateEdgeOffsetManipulator(d);const u=[];for(const o of[d.handle.leftVertex,d.handle.rightVertex]){const e=this._getManipulatorInfoFromHandle(o);s(e)&&u.push(e.manipulator.events.on("location-update",(()=>this._updateEdgeOffsetManipulator(d))))}d.locationUpdateHandle=o(u),this._manipulatorHandles.add(d.locationUpdateHandle,p),this._manipulatorHandles.add([this._watchAndUpdateGrabState(p,!0),this._watchAndUpdateGrabState(h,!0)],p),this._manipulatorHandles.add(de(p,this._createEdgeOffsetPipeline(d,t)),p),this._manipulatorHandles.add(de(h,((e,i,a,o)=>{if("touch"===o){this._createEdgeOffsetPipeline(d,t)(e,i,a)}else if(this.enableMoveGraphic){const o=this.graphic,n=s(o.geometry)?o.geometry.spatialReference:null;i.next((e=>this._trackNumDragging(e))).next(ue(this.view,e.elevationAlignedLocation)).next(z(this.view,e.elevationAlignedLocation,t,n,o)).next(ce()).next(he()).next((e=>this._perGraphicManipulatorDragAction(Ce.ALL,e))).next((e=>(this._updateTranslateGraphicTooltip(J.XY,e),e))).next((e=>{"end"===e.action&&this._tooltip.clear()})),a.next(this._cancelDragOperation())}})),p);const c=e=>{this._manipulatorInfos.some((e=>e.manipulator.selected))?this._clearSelection():this.emit("immediate-click",{...e,graphic:this.graphic}),e.stopPropagation()};return this._manipulatorHandles.add([p.events.on("immediate-click",c),h.events.on("immediate-click",c),p.events.on("focus-changed",(({action:e})=>{const t=this._tooltipOptions;"focus"===e&&t.enabled?this._tooltip.info=new ye({tooltipOptions:t}):this._tooltip.clear()}))],p),this._manipulatorInfos.push(d),this.manipulators.add(p),this.manipulators.add(h),this.emit("manipulators-changed"),d}_autoHideEdgeOffsetManipulator(e,t){const i=e.manipulator,a=e.edgeManipulator,n=()=>{e.visibilityHandle=h(e.visibilityHandle);const n=this._getManipulatorInfoFromHandle(e.handle.leftVertex),r=this._getManipulatorInfoFromHandle(e.handle.rightVertex),l=s(n)&&s(r)&&ne(n.manipulator.renderLocation,r.manipulator.renderLocation,this.view.state.camera)<t;(!i.focused&&!a.focused||l)&&(i.grabbable=!l,a.grabbable=!l,e.visibilityHandle=o([i.disableDisplay(),{remove:()=>{i.grabbable=!0,a.grabbable=this.enableMoveGraphic}}]))};this._manipulatorHandles.add([i.events.on("focus-changed",n),a.events.on("focus-changed",n),{remove:()=>{h(e.visibilityHandle),this.manipulators.remove(a)}}],i),n()}_updateEdgeOffsetManipulator(e){this._updateManipulatorPosition(e);const t=p(this._editGeometryOperations).data.coordinateHelper,i=ie(this.view,e.manipulator.elevationAlignedLocation,ae(t,e.handle,p(e.manipulator.elevationInfo))),a=this._getManipulatorInfoFromHandle(e.handle.leftVertex),o=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(l(a)||l(o))return;const n=a.manipulator.renderLocation,r=o.manipulator.renderLocation,h=s(i)?oe(i,n,r):y;e.manipulator.modelTransform=h,e.edgeManipulator.elevationAlignedLocation=e.manipulator.elevationAlignedLocation,e.edgeManipulator.modelTransform=h;const d=x(O(ke,n,r))/2;e.edgeManipulator.collisionType={type:"line",paths:[[[-d,0,0],[d,0,0]]]}}_createEdgeOffsetPipeline(e,t){return(i,a,o)=>{this._clearSelection();const{step:n,cleanup:r}=this._initializeEdgeOffset(e,t);a.next((e=>this._trackNumDragging(e))).next(ue(this.view,i.elevationAlignedLocation)).next(n).next(C(this.view)).next(F(this.view,p(this._editGeometryOperations).data.spatialReference)).next(he()).next(this._applyComputeEdgeOffsetDistanceStep()).next(this._applyEdgeOffsetStep(e)).next(this._showEdgeOffsetTooltip()).next((e=>{"end"===e.action&&r()})),o.next((e=>(r(),e))).next((e=>(this._tooltip.clear(),e))).next(this._cancelDragOperation())}}_initializeEdgeOffset(e,t){const i=p(this._editGeometryOperations),a=ae(i.data.coordinateHelper,e.handle,t),r=i.createUndoGroup(),d=ie(this.view,e.manipulator.elevationAlignedLocation,a);if(a.requiresSplitEdgeLeft){const t=this._getManipulatorInfoFromHandle(e.handle.leftVertex.leftEdge);s(t)&&this._splitEdgeManipulator(t,1)}if(a.requiresSplitEdgeRight){const t=this._getManipulatorInfoFromHandle(e.handle.rightVertex.rightEdge);s(t)&&this._splitEdgeManipulator(t,0)}const u=()=>new T({paths:[[e.handle.leftVertex.pos,e.handle.rightVertex.pos]],spatialReference:p(this._editGeometryOperations).data.spatialReference}),c=new re({view:this.view,isDraped:this._graphicState.isDraped,geometry:u(),elevationInfo:e.elevationInfo,width:q.visualElements.lineGraphics.outline.width,color:q.colorToVec4(W.main),attached:!0});let g;const _=()=>{this._cleanEdgeOffsetCollapsedEdges(e),g=h(g)},f=this.on("undo",_);return g=o([n(c),m((()=>this._graphicState.isDraped),(e=>c.isDraped=e)),this._graphicState.on("changed",(()=>c.geometry=u())),r,f]),{step:e=>l(a)||l(d)?(_(),null):{...e,operation:a,plane:d},cleanup:_}}_applyEdgeOffsetStep(e){return t=>{if(this.destroyed||l(t.operation))return t;this._updateEventState(Re.RESHAPING);const{mapDeltaX:i,mapDeltaY:a,mapDeltaZ:o}=t;return(i||a||o)&&(this._offsetEdge(e,t),this.emit("reshape",{type:"reshape",mover:this.graphic})),t}}_applyComputeEdgeOffsetDistanceStep(){return e=>{const{operation:t,mapEnd:i}=e;return l(t)||l(i)?e:("start"===e.action&&t.selectArrowFromStartPoint(i),{...e,signedDistance:t.signedDistanceToPoint(i)})}}_showEdgeOffsetTooltip(){return e=>{const{mapEnd:t,signedDistance:i,operation:a}=e,o=this._tooltip,n=this._tooltipOptions;if(!n.enabled||l(i))return o.clear(),e;const r="end"===e.action?d:je(this._graphicState.isDraped,i*a.selectedArrow,t,a.plane,p(this._editGeometryOperations).data.coordinateHelper);return l(o.info)||"reshape-edge-offset"!==o.info.type?o.info=new ye({tooltipOptions:n,distance:r}):o.info.distance=r,e}}_cleanEdgeOffsetCollapsedEdges(e){const t=e.handle.leftVertex.leftEdge?.leftVertex,i=e.handle.leftVertex,a=e.handle.rightVertex.rightEdge?.rightVertex,o=e.handle.rightVertex,n=p(this._editGeometryOperations).data.coordinateHelper,r=1e-6,l=[];if(t&&n.distance(t.pos,i.pos)<r){const e=this._getManipulatorInfoFromHandle(i);s(e)&&l.push(e)}if(n.distance(i.pos,o.pos)<r||a&&n.distance(a.pos,o.pos)<r){const e=this._getManipulatorInfoFromHandle(o);s(e)&&l.push(e)}l.length&&this._removeVertices(l)}_computeVertexManipulatorSizeAndOutline(e){const t=e.size/2,i=t+e.collisionPadding;return{size:t/i,outlineSize:(t+e.outlineSize)/i}}_createVertexOrEdgeManipulator(e,t=A(this.graphic)){if("edge"===e.type){if(this.enableEdgeOffset)return this._createEdgeOffsetManipulator(e,t);if(!this.enableMidpoints)return null}if(l(this._vertexManipulatorGeometry)||l(this._vertexManipulatorOutlineGeometry)){const{size:e,outlineSize:t}=this._computeVertexManipulatorSizeAndOutline(q.reshapeManipulators.vertex);this._vertexManipulatorGeometry=le.createSphereGeometry(e,16,16),this._vertexManipulatorOutlineGeometry=le.createSphereGeometry(t,16,16)}if(l(this._edgeManipulatorGeometry)||l(this._edgeManipulatorOutlineGeometry)){const{size:e,outlineSize:t}=this._computeVertexManipulatorSizeAndOutline(q.reshapeManipulators.edge);this._edgeManipulatorGeometry=le.createSphereGeometry(e,16,16),this._edgeManipulatorOutlineGeometry=le.createSphereGeometry(t,16,16)}const i=s(this.graphic.geometry)&&"point"===this.graphic.geometry.type?[]:[{geometry:this._vertexManipulatorGeometry,material:this._vertexManipulatorMaterial,stateMask:Ne.Vertex|me.Unselected},{geometry:this._vertexManipulatorOutlineGeometry,material:this._vertexManipulatorOutlineMaterial,stateMask:Ne.Vertex|me.Unfocused|me.Unselected},{geometry:this._vertexManipulatorOutlineGeometry,material:this._vertexManipulatorHoverOutlineMaterial,stateMask:Ne.Vertex|me.Focused|me.Unselected},{geometry:this._vertexManipulatorGeometry,material:this._selectedManipulatorMaterial,stateMask:me.Selected},{geometry:this._vertexManipulatorOutlineGeometry,material:this._selectedManipulatorOutlineMaterial,stateMask:me.Selected|me.Unfocused},{geometry:this._vertexManipulatorOutlineGeometry,material:this._selectedManipulatorHoverOutlineMaterial,stateMask:me.Selected|me.Focused}];this.enableMidpoints&&i.push({geometry:this._edgeManipulatorGeometry,material:this._vertexManipulatorMaterial,stateMask:Ne.Edge|me.Focused|me.Unselected},{geometry:this._edgeManipulatorOutlineGeometry,material:this._vertexManipulatorHoverOutlineMaterial,stateMask:Ne.Edge|me.Focused|me.Unselected},{geometry:this._edgeManipulatorGeometry,material:this._edgeManipulatorMaterial,stateMask:Ne.Edge|me.Unfocused|me.Unselected},{geometry:this._edgeManipulatorOutlineGeometry,material:this._edgeManipulatorOutlineMaterial,stateMask:Ne.Edge|me.Unfocused|me.Unselected});const a=new P({view:this.view,renderObjects:i,elevationInfo:t,focusMultiplier:1,touchMultiplier:1,available:!(!this.graphic.visible||!this.graphic.layer.visible)});this._setTypeSpecificManipulatorSettings(a,e,t);const n="edge"===e.type?{manipulator:a,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0}:{manipulator:a,handle:e,type:"vertex",selectedIndex:0};if(this._manipulatorInfos.push(n),this.manipulators.add(a),this._updateManipulatorPosition(n),"edge"===n.type){const e=[];for(const t of[n.handle.leftVertex,n.handle.rightVertex]){const i=this._getManipulatorInfoFromHandle(t);s(i)&&e.push(i.manipulator.events.on("location-update",(()=>this._updateManipulatorPosition(n))))}n.locationUpdateHandle=o(e),this._manipulatorHandles.add(n.locationUpdateHandle,a)}this._manipulatorHandles.add(this._watchAndUpdateGrabState(a,!0),a);const r=de(a,((e,i,a,o)=>{let r=null;i.next((e=>this._trackNumDragging(e))).next((e=>{if("start"===e.action&&(r=p(this._editGeometryOperations).createUndoGroup()),"edge"===n.type){const t=this._splitEdgeManipulator(n);return{...e,info:t,snapOrigin:t.handle.pos}}return{...e,info:n,snapOrigin:n.handle.pos}})).next(ue(this.view,e.elevationAlignedLocation)).next(X(this.view,this.graphic,e.elevationAlignedLocation,e.location.spatialReference,this.graphic)).next(this._snappingPipeline.createSnapDragEventPipelineStep({predicate:()=>!this._isMultiVertexSelection(),cancel:a,snappingManager:this.tool.snappingManager,snappingContext:new ve({editGeometryOperations:p(this._editGeometryOperations),elevationInfo:t,pointer:o,excludeFeature:this.graphic,visualizer:new R}),updatingHandles:this.updatingHandles}),this._snappingPipeline.next).next(he()).next((t=>{this._perVertexManipulatorDragAction(t),"end"===t.action&&(r=h(r)),this._updateTranslateVertexTooltip(e,J.XY,t)})),a.next(this._cancelDragOperation((()=>r=h(r))))}));return this._manipulatorHandles.add([r,a.events.on("immediate-click",(e=>this._manipulatorClickCallback(e,n))),a.events.on("select-changed",(()=>{n.selectedIndex=++this._selectedIndex,this._updateMoveManipulationPosition()})),a.events.on("focus-changed",(({action:e})=>{"focus"===e&&"edge"!==n.type?this._updateTranslateVertexTooltip(a,J.XY):this._tooltip.clear()}))],a),this.emit("manipulators-changed"),n}_trackNumDragging(e){switch(e.action){case"start":this._numDragging++;break;case"end":this._numDragging--}return e}_cancelDragOperation(e){return()=>{switch(this._numDragging--,this.undo(),this.outputGeometry=s(this._editGeometryOperations)?this._editGeometryOperations.data.geometry:null,s(this.tool.snappingManager)&&this.tool.snappingManager.doneSnapping(),this._tooltip.clear(),this._reshapeEventState){case Re.NONE:break;case Re.MOVING:this.emit("move",{type:"move",dx:0,dy:0,mover:this.graphic});break;case Re.RESHAPING:this.emit("reshape",{type:"reshape",mover:this.graphic})}e&&e(),this.destroyed||this._updateEventState(Re.NONE)}}_setTypeSpecificManipulatorSettings(e,t,i){switch(t.type){case"vertex":e.state=Ne.Vertex,e.selectable=!0,e.cursor="move",e.collisionPriority=2,e.radius=q.reshapeManipulators.vertex.size/2+q.reshapeManipulators.vertex.collisionPadding,e.elevationInfo=i,e.interactive=s(this.graphic.geometry)&&"point"!==this.graphic.geometry.type;break;case"edge":e.state=Ne.Edge,e.selectable=!1,e.cursor="copy",e.collisionPriority=-1,e.radius=q.reshapeManipulators.edge.size/2+q.reshapeManipulators.edge.collisionPadding,e.elevationInfo="on-the-ground"!==i.mode||L(this.graphic.symbol)?{mode:"absolute-height",offset:0}:i}}_watchAndUpdateGrabState(e,t){return e.events.on("grab-changed",(i=>this._onGrabStateChanged(e,t,i.action,i.pointerType)))}_onGrabStateChanged(e,t,i,a="mouse"){if("start"===i)t&&this._updateSelection(e),this._numGrabbing++;else if(this._numGrabbing--,this._updateEventState(Re.NONE),this.destroyed)return;this._moveManipulation.interactive=!this._numGrabbing,("touch"!==a||this.enableEdgeOffset)&&(this._manipulatorInfos.forEach((e=>{e.manipulator.interactive=e.manipulator.grabbing||!this._numGrabbing&&s(this.graphic.geometry)&&"point"!==this.graphic.geometry.type,"edgeManipulator"in e&&(e.edgeManipulator.interactive=e.edgeManipulator.grabbing||!this._numGrabbing)})),p(this._graphicMoveManipulation).forEachManipulator((e=>{e.interactive=e.grabbing||!this._numGrabbing})))}_clearSelection(){for(const e of this._manipulatorInfos)e.manipulator.grabbing||(e.manipulator.selected=!1)}_updateSelection(e){e.grabbing&&!e.selected&&e.selectable&&(this._clearSelection(),e.selected=!0,this.emit("manipulators-changed"))}_removeManipulator(e){l(e)||(this._manipulatorHandles.remove(e.manipulator),this._manipulatorInfos.splice(this._manipulatorInfos.indexOf(e),1),this.manipulators.remove(e.manipulator),this.emit("manipulators-changed"))}_getManipulatorInfoFromHandle(e){if(e)for(const t of this._manipulatorInfos)if(e===t.handle)return t;return null}_updateManipulatorPosition(e){if(l(e))return;const t=p(this._editGeometryOperations);if("vertex"===e.type)e.manipulator.location=t.data.coordinateHelper.vectorToDehydratedPoint(e.handle.pos,Ue),e.manipulator.grabbing&&s(this._vertexLaserLineVisualElement)&&(this._vertexLaserLineVisualElement.visualElement.intersectsWorldUpAtLocation=e.manipulator.renderLocation);else if("edge"===e.type){const i=this._getManipulatorInfoFromHandle(e.handle.leftVertex),a=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(l(i)||l(a))return;const o=i.manipulator,n=a.manipulator;if(s(e.manipulator.elevationInfo)&&"on-the-ground"===e.manipulator.elevationInfo.mode){const i=o.location,a=n.location,r=.5,s=i.x+r*(a.x-i.x),l=i.y+r*(a.y-i.y),p=i.hasZ&&a.hasZ?0:void 0;e.manipulator.location=D(s,l,p,t.data.spatialReference)}else b(ke,o.renderLocation,n.renderLocation,.5),e.manipulator.renderLocation=ke}}_splitEdgeManipulator(e,t=.5){const i=p(this._editGeometryOperations),a=p(i.splitEdge(e.handle,t).createdVertex);e.locationUpdateHandle.remove(),e.locationUpdateHandle=void 0;const o=A(this.graphic);let n;this.enableEdgeOffset?(this._removeManipulator(e),n=this._createVertexOrEdgeManipulator(a)):(n=e,n.handle=a,n.type="vertex",this._setTypeSpecificManipulatorSettings(e.manipulator,e.handle,o)),a.leftEdge&&this._createVertexOrEdgeManipulator(a.leftEdge),a.rightEdge&&this._createVertexOrEdgeManipulator(a.rightEdge),this.outputGeometry=i.data.geometry,this._updateManipulatorPosition(n),this.enableEdgeOffset||this._updateTranslateVertexTooltip(n.manipulator,J.XY),this._updateSelection(e.manipulator);const r=this._updateEventState(Re.RESHAPING),s=i.data.coordinateHelper.vectorToArray(n.handle.pos),l=i.data.components.indexOf(a.component);return this.emit("vertex-add",{type:"vertex-add",vertices:[{coordinates:s,componentIndex:l,vertexIndex:p(a.index)}],added:s}),r&&this._updateEventState(Re.NONE),n}_updateMoveManipulationPosition(){const e=E(ke,0,0,0);let t=0,i=!1,a=null,o=null;for(const n of this._manipulatorInfos)"vertex"===n.type&&(n.manipulator.selected?(t++,G(e,e,n.manipulator.renderLocation),l(a)||n.selectedIndex>a.selectedIndex?(o=a,a=n):(l(o)||n.selectedIndex>o.selectedIndex)&&(o=n)):i=!0);if(0!==t){const e=this._graphicState.displaying;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.zManipulation.available=e&&this.enableZVertex&&Z(this.graphic),this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e&&1!==t}else{const e=this._graphicState.displaying&&this.enableMoveGraphic;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e,this._moveManipulation.zManipulation.available=e&&this.enableZShape&&Z(this.graphic)}if(0!==t){let e=0;if(s(a)){const t=a.handle.pos,i=s(o)?o.handle.pos:a.handle.leftEdge&&a.handle.leftEdge.leftVertex?a.handle.leftEdge.leftVertex.pos:null,n=l(o)&&a.handle.rightEdge&&a.handle.rightEdge.rightVertex?a.handle.rightEdge.rightVertex.pos:null;i&&n?this._moveManipulation.xyAxisManipulation.available=!1:i?e=Pe(i,t):n&&(e=Pe(t,n))}this._moveManipulation.angle=e,this._moveManipulation.radius=B}else this._moveManipulation.angle=$(p(this.graphic.geometry)),this._moveManipulation.radius=Q.radiusForSymbol(this.graphic.symbol);0!==t&&i?(S(e,e,1/t),Ue.spatialReference=p(this._editGeometryOperations).data.spatialReference,Ue.hasZ=!0,this.view.renderCoordsHelper.fromRenderCoords(e,Ue),this._moveManipulation.elevationAlignedLocation=Ue):s(this._outlineVisualElement)&&!this._graphicState.isDraped&&s(this._outlineVisualElement.attachmentOrigin)?this._moveManipulation.elevationAlignedLocation=this._outlineVisualElement.attachmentOrigin:k(this.view,this._moveManipulation,this.graphic)}_removeVertices(e){const t=[],i=p(this._editGeometryOperations);for(const a of e)if("vertex"===a.type&&i.canRemoveVertex()){t.push(a.handle),this._removeManipulator(a),this._removeManipulator(this._getManipulatorInfoFromHandle(a.handle.leftEdge)),this._removeManipulator(this._getManipulatorInfoFromHandle(a.handle.rightEdge));const e=p(i.removeVertices([a.handle]).removedVertices[0].createdEdge);e&&this._createVertexOrEdgeManipulator(e)}if(t.length>0){const e=t.map((e=>{const t=i.data.components.indexOf(e.component);return{coordinates:i.data.coordinateHelper.vectorToArray(e.pos),componentIndex:t,vertexIndex:p(e.index)}}));this.outputGeometry=i.data.geometry;const a=this._updateEventState(Re.RESHAPING);if(this.destroyed)return;if(this.emit("vertex-remove",{type:"vertex-remove",removed:e.map((e=>e.coordinates)),vertices:e}),this.destroyed)return;if(a&&(this._updateEventState(Re.NONE),this.destroyed))return;this._updateMoveManipulationPosition()}}_moveVertices(e,t,i=("start"===t.action?fe.NEW_STEP:fe.ACCUMULATE_STEPS)){const a=p(this._editGeometryOperations);a.moveVertices(e.map((e=>e.handle)),t.mapDeltaX,t.mapDeltaY,t.mapDeltaZ,i),this.outputGeometry=a.data.geometry;for(const o of e)this._updateManipulatorPosition(o)}_offsetEdge(e,t){if(l(t.operation)||l(t.signedDistance))return;const i=p(this._editGeometryOperations),a=t.operation.clone();a.distance=t.signedDistance,i.updateVertices([e.handle.leftVertex,e.handle.rightVertex],a),this.outputGeometry=i.data.geometry,this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.leftVertex)),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.rightVertex))}_manipulatorClickCallback(e,t){e.shiftKey||this._clearSelection(),"vertex"===t.type&&(t.manipulator.selected=!t.manipulator.selected,e.button===pe.Right&&this._removeVertices([t])),"edge"===t.type&&e.button===pe.Left&&this._splitEdgeManipulator(t),e.stopPropagation()}_updateTranslateTooltip(e,t){const i=this._manipulatorInfos.filter((e=>"vertex"===e.type&&e.manipulator.selected));1===i.length?this._updateTranslateVertexTooltip(i[0].manipulator,e,t):this._updateTranslateGraphicTooltip(e,t)}_updateTranslateGraphicTooltip(e,t){const i=this._tooltipOptions;if(!i.enabled)return;const a=this._graphicState.isDraped?"on-the-ground":"absolute-height";switch(e){case J.XY:this._tooltip.info=new Ee({tooltipOptions:i}),this._updateTranslateTooltipDistance(this._tooltip.info,t,((e,t)=>Te(e,t,a)));break;case J.XY_AXIS:this._tooltip.info=new be({tooltipOptions:i}),this._updateTranslateTooltipDistance(this._tooltip.info,t,((e,i)=>{const o=Te(e,i,a);return u(o,ee(t))}));break;case J.Z:this._tooltip.info=new Oe({tooltipOptions:i}),this._updateTranslateTooltipDistance(this._tooltip.info,t,He)}}_updateTranslateVertexTooltip(e,t,i){const a=this._tooltipOptions;if(!a.enabled)return;let o;const n=this._graphicState.isDraped?"on-the-ground":"absolute-height";switch(t){case J.XY:o=new Ve({tooltipOptions:a}),this._updateTranslateTooltipDistance(o,i,((e,t)=>Te(e,t,n))),this._updateTranslateVertexTooltipSum(o);break;case J.XY_AXIS:o=new Se({tooltipOptions:a}),this._updateTranslateTooltipDistance(o,i,((e,t)=>{const a=Te(e,t,n);return u(a,ee(i))})),this._updateTranslateVertexTooltipSum(o);break;case J.Z:o=new Ge({tooltipOptions:a}),this._updateTranslateTooltipDistance(o,i,He)}const r=De(e.elevationAlignedLocation);s(r)&&(o.elevation={mode:"absolute-height",...r}),this._tooltip.info=o}_updateTranslateTooltipDistance(e,t,i){if(s(t)&&"end"!==t.action){const{mapStart:a,mapEnd:o}=t,n=i(a,o);e.distance=s(n)?n:d}}_updateTranslateVertexTooltipSum(e){const{geometry:t}=this.graphic;s(t)&&(e.area="polygon"===t.type?Ie(t,this._graphicState.isDraped):null,e.totalLength="polyline"===t.type?we(t,this._graphicState.isDraped?"on-the-ground":"absolute-height"):null)}get test(){return{segmentLabels:this._segmentLabels,tooltip:this._tooltip}}};function Pe(e,t){return Math.atan2(t[1]-e[1],t[0]-e[0])+Math.PI/2}function je(e,t,i,a,o){if(e){const e=o.toXYZ(o.pointToVector(i)),n=w(a,e,H.get()),r=Ae(n,e,o.spatialReference);if(s(r))return c(r.value*Math.sign(t),r.unit)}return c(t*f(i.spatialReference),"meters")}e([v()],Le.prototype,"_segmentLabels",void 0),e([v({constructOnly:!0})],Le.prototype,"tool",void 0),e([v()],Le.prototype,"_tooltip",void 0),e([v()],Le.prototype,"inputGeometry",null),e([v()],Le.prototype,"outputGeometry",void 0),e([v({readOnly:!0})],Le.prototype,"updating",null),e([v()],Le.prototype,"manipulators",null),e([v()],Le.prototype,"view",null),e([v()],Le.prototype,"graphic",null),e([v()],Le.prototype,"enableZShape",null),e([v()],Le.prototype,"enableZVertex",null),e([v()],Le.prototype,"enableMoveGraphic",null),e([v()],Le.prototype,"enableMidpoints",null),e([v()],Le.prototype,"enableEdgeOffset",null),e([v()],Le.prototype,"_labelOptions",null),e([v()],Le.prototype,"_tooltipOptions",null),Le=e([M("esri.views.3d.interactive.editingTools.reshapeGraphic.ReshapeOperation")],Le);const Ue=D(0,0,null,null),ke=I();var Ne,Re,Ce;!function(e){e.Vertex=ge.Custom1,e.Edge=ge.Custom2}(Ne||(Ne={})),function(e){e[e.NONE=0]="NONE",e[e.MOVING=1]="MOVING",e[e.RESHAPING=2]="RESHAPING"}(Re||(Re={})),function(e){e[e.ALL=0]="ALL",e[e.SELECTED_OR_ALL=1]="SELECTED_OR_ALL"}(Ce||(Ce={}));export{Le as ReshapeOperation};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../Graphic.js";import t from"../../../core/Error.js";import s from"../../../core/Logger.js";import{applySome as i,isSome as l,isNone as o}from"../../../core/maybe.js";import{initial as a}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{WhereClause as d}from"../../../core/sql/WhereClause.js";import"../../../layers/buildingSublayers/BuildingComponentSublayer.js";import p from"../../../layers/support/FeatureFilter.js";import{fixFields as h,unpackFieldNames as y,populateMissingFields as c}from"../../../layers/support/fieldUtils.js";import f from"../../../rest/support/Query.js";import{BuildingSublayerView3DMixin as m}from"./BuildingSublayerView3D.js";import{I3SMeshView3D as g}from"./I3SMeshView3D.js";import{ForAllFeaturesReturnType as F,ForAllFeaturesVisibilityMode as b}from"./II3SMeshView3D.js";import{applyFilterMode as _}from"./i3s/BuildingFilterUtil.js";import{createGetFeatureExtent as E}from"./i3s/I3SGeometryUtil.js";import{I3SMeshViewFilter as w}from"./i3s/I3SMeshViewFilter.js";import{I3SQueryEngine as x}from"./i3s/I3SQueryEngine.js";import{I3SQueryFeatureAdapter as S}from"./i3s/I3SQueryFeatureAdapter.js";import{I3SQueryFeatureStore as j}from"./i3s/I3SQueryFeatureStore.js";import{findFieldsCaseInsensitive as
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../Graphic.js";import t from"../../../core/Error.js";import s from"../../../core/Logger.js";import{applySome as i,isSome as l,isNone as o}from"../../../core/maybe.js";import{initial as a}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{WhereClause as d}from"../../../core/sql/WhereClause.js";import"../../../layers/buildingSublayers/BuildingComponentSublayer.js";import p from"../../../layers/support/FeatureFilter.js";import{fixFields as h,unpackFieldNames as y,populateMissingFields as c}from"../../../layers/support/fieldUtils.js";import f from"../../../rest/support/Query.js";import{BuildingSublayerView3DMixin as m}from"./BuildingSublayerView3D.js";import{I3SMeshView3D as g}from"./I3SMeshView3D.js";import{ForAllFeaturesReturnType as F,ForAllFeaturesVisibilityMode as b}from"./II3SMeshView3D.js";import{applyFilterMode as _}from"./i3s/BuildingFilterUtil.js";import{createGetFeatureExtent as E}from"./i3s/I3SGeometryUtil.js";import{I3SMeshViewFilter as w}from"./i3s/I3SMeshViewFilter.js";import{I3SQueryEngine as x}from"./i3s/I3SQueryEngine.js";import{I3SQueryFeatureAdapter as S}from"./i3s/I3SQueryFeatureAdapter.js";import{I3SQueryFeatureStore as j}from"./i3s/I3SQueryFeatureStore.js";import{findFieldsCaseInsensitive as I,getIndexCrs as v}from"./i3s/I3SUtil.js";import{DefinitionExpressionSceneLayerView as Q}from"./support/DefinitionExpressionSceneLayerView.js";import L from"../../layers/BuildingComponentSublayerView.js";import{getRequiredFields as q,getFetchPopupTemplate as A}from"../../layers/support/popupUtils.js";import{TaskPriority as R}from"../../support/Scheduler.js";let C=class extends(Q(g(m(L)))){constructor(){super(...arguments),this.type="building-component-sublayer-3d",this.layerView=null,this._elevationContext="scene",this._isIntegratedMesh=!1,this._supportsLabeling=!1,this.progressiveLoadFactor=1,this._queryEngine=null}get i3slayer(){return this.sublayer}get layerUid(){return this.sublayer.layer.uid}get sublayerUid(){return this.sublayer.uid}initialize(){this.updatingHandles.add((()=>[this.sublayer.renderer,this.definitionExpressionFields,this.filterExpressionFields]),(()=>this._updateRequiredFields())),this.updatingHandles.add((()=>this.sublayer.renderer),(e=>this._rendererChange(e)),a),this.updatingHandles.add((()=>[this.parsedDefinitionExpression,this.filter,i(this._filter,(({parsedWhereClause:e,parsedGeometry:r,sortedObjectIds:t})=>[e,r,t]))]),(()=>this._filterChange())),this.updatingHandles.add((()=>this.parsedFilterExpressions),(()=>this._updateSymbologyOverride()),a),this.addResolvingPromise(this._updateRequiredFields())}get lodFactor(){return this.view.qualitySettings.sceneService.object.lodFactor}get parsedFilterExpressions(){return"Overview"===this.sublayer.modelName?[]:this.layerView.filterExpressions.map((([e,r])=>{let t;try{t=d.create(e,this.sublayer.fieldsIndex)}catch(o){return s.getLogger(this.declaredClass).error("Failed to parse filterExpression: "+o),null}if(!t.isStandardized)return s.getLogger(this.declaredClass).error("filterExpression is using non standard function"),null;const i=[],l=t.fieldNames;return I(l,this.sublayer.fields,{missingFields:i}),i.length>0?(s.getLogger(this.declaredClass).error(`filterExpression references unknown fields: ${i.join(", ")}`),null):[t,r]})).filter((e=>null!=e))}get filter(){return l(this._filter)?this._filter.viewFilter:null}set filter(e){!o(e)&&w.checkSupport(e)?l(this._filter)?this._filter.viewFilter=e:this._filter=new w({viewFilter:e,layerFieldsIndex:this.sublayer.fieldsIndex,loadAsyncModule:e=>this._loadAsyncModule(e),applyFilters:()=>this._applyFilters(!0),addSqlFilter:(e,r)=>this.addSqlFilter(e,r,this.logError)}):this._filter=null}_updateSymbologyOverride(){const e=this.parsedFilterExpressions;e.length>0?this._setSymbologyOverride(((r,t)=>{for(const[i,l]of e)try{if(i.testFeature(r))return _(t,l)}catch(s){this.logError(s)}return _(t,null)}),this.filterExpressionFields):this._setSymbologyOverride(null,null)}get filterExpressionFields(){return h(this.sublayer.fieldsIndex,this.parsedFilterExpressions.reduce(((e,[r])=>e.concat(r.fieldNames)),[]))}get availableFields(){const e=this.sublayer,r=e.fieldsIndex;let t=this.requiredFields;if(e.outFields||e.layer.outFields){const s=[...e.outFields||[],...e.layer.outFields||[]];t=[...y(r,s),...t]}return h(r,t)}_createLayerGraphic(e){const t=new r(null,null,e);return t.layer=this.sublayer.layer,t.sourceLayer=this.sublayer,t}canResume(){return super.canResume()&&(!this._controller||this._controller.rootNodeVisible)}async fetchPopupFeatures(e,r){const t=this._validateFetchPopupFeatures(r);if(t)throw t;if(o(r)||!r.clientGraphics||0===r.clientGraphics.length)return[];const i=[],a=[],n=l(this.sublayer.associatedLayer)?await this.sublayer.associatedLayer.load():this.sublayer,u=y(this.sublayer.fieldsIndex,await q(n,A(this.sublayer,r))),d=new Set;for(const s of r.clientGraphics)c(u,s,d)?a.push(s):i.push(s);return 0===a.length?i:(l(this.sublayer.associatedLayer)&&await this.sublayer.associatedLayer.load().catch((()=>s.getLogger(this.declaredClass).warn("Failed to load associated feature layer. Displaying popup attributes from cached attributes."))),this.whenGraphicAttributes(a,Array.from(d)).catch((()=>a)).then((e=>i.concat(e))))}async _updateRequiredFields(){const e=h(this.sublayer.fieldsIndex,[...this.sublayer.renderer?await this.sublayer.renderer.getRequiredFields(this.sublayer.fieldsIndex):[],...this.definitionExpressionFields||[],...this.filterExpressionFields||[]]);this._set("requiredFields",e)}_validateFetchPopupFeatures(e){const{sublayer:r}=this,{popupEnabled:s}=r;return s?A(r,e)?void 0:new t("buildingscenelayerview3d:fetchPopupFeatures","Layer does not define a popup template",{sublayer:r}):new t("buildingscenelayerview3d:fetchPopupFeatures","Popups are disabled",{sublayer:r})}getFilters(){const e=super.getFilters();return this.addSqlFilter(e,this.parsedDefinitionExpression,this.logError),l(this._filter)&&this._filter.addFilters(e,this.view,this._controller.crsIndex,this._collection),e}createQuery(){const e={outFields:["*"],returnGeometry:!1,outSpatialReference:this.view.spatialReference};return l(this.filter)?this.filter.createQuery(e):new f(e)}queryExtent(e,r){return this._ensureQueryEngine().executeQueryForExtent(this._ensureQuery(e),r?.signal)}queryFeatureCount(e,r){return this._ensureQueryEngine().executeQueryForCount(this._ensureQuery(e),r?.signal)}queryFeatures(e,r){return this._ensureQueryEngine().executeQuery(this._ensureQuery(e),r?.signal).then((e=>{if(!e?.features)return e;const r=this.sublayer,t=r.layer;for(const s of e.features)s.layer=t,s.sourceLayer=r;return e}))}queryObjectIds(e,r){return this._ensureQueryEngine().executeQueryForIds(this._ensureQuery(e),r?.signal)}_ensureQueryEngine(){return o(this._queryEngine)&&(this._queryEngine=this._createQueryEngine()),this._queryEngine}_createQueryEngine(){const e=E(this.view.spatialReference,this.view.renderSpatialReference,this._collection);return new x({layerView:this,priority:R.FEATURE_QUERY_ENGINE,spatialIndex:new j({featureAdapter:new S({objectIdField:this.sublayer.objectIdField,attributeStorageInfo:this.sublayer.attributeStorageInfo,getFeatureExtent:e}),toArray:()=>{const e=new Array;return this._forAllFeatures(((r,t,s)=>(e.push({id:r,index:t,meta:s}),F.CONTINUE)),null,b.ALL_IN_CLIPPING_AREA),e},forAllFeatures:(e,r)=>this._forAllFeatures(((r,t,s)=>e({id:r,index:t,meta:s})),r,b.ALL_IN_CLIPPING_AREA),getFeatureExtent:e,sourceSpatialReference:v(this.sublayer),viewSpatialReference:this.view.spatialReference})})}_ensureQuery(e){return this._addDefinitionExpressionToQuery(o(e)?this.createQuery():f.from(e))}};e([n()],C.prototype,"i3slayer",null),e([n()],C.prototype,"layerView",void 0),e([n()],C.prototype,"suspended",void 0),e([n()],C.prototype,"lodFactor",null),e([n({readOnly:!0})],C.prototype,"parsedFilterExpressions",null),e([n({type:p})],C.prototype,"filter",null),e([n()],C.prototype,"_filter",void 0),e([n({type:[String],readOnly:!0})],C.prototype,"filterExpressionFields",null),e([n({type:[String],readOnly:!0})],C.prototype,"requiredFields",void 0),e([n({type:[String],readOnly:!0})],C.prototype,"availableFields",null),C=e([u("esri.views.3d.layers.BuildingComponentSublayerView3D")],C);const G=C;export{G as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Error.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{LayerView3D as i}from"./LayerView3D.js";import{TiledLayerView3D as t}from"./TiledLayerView3D.js";import a from"../../layers/LayerView.js";let l=class extends(t(i(a))){constructor(){super(...arguments),this.type="elevation-3d"}initialize(){const e=this.view?.map?.allLayers,o=e&&e.includes(this.layer),s=this.view?.map?.ground?.layers,i=s&&s.includes(this.layer);if(o&&!i){const e=new r("layerview:elevation-layer-only","3D elevation layer '"+this.layer.id+"' can only be added to layers in map.ground");this.addResolvingPromise(Promise.reject(e))}this._addTilingSchemeMatchPromise()}};e([o()],l.prototype,"layer",void 0),e([o(
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Error.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{LayerView3D as i}from"./LayerView3D.js";import{TiledLayerView3D as t}from"./TiledLayerView3D.js";import a from"../../layers/LayerView.js";let l=class extends(t(i(a))){constructor(){super(...arguments),this.type="elevation-3d"}get tileInfo(){return this.layer.tileInfo}initialize(){const e=this.view?.map?.allLayers,o=e&&e.includes(this.layer),s=this.view?.map?.ground?.layers,i=s&&s.includes(this.layer);if(o&&!i){const e=new r("layerview:elevation-layer-only","3D elevation layer '"+this.layer.id+"' can only be added to layers in map.ground");this.addResolvingPromise(Promise.reject(e))}this._addTilingSchemeMatchPromise()}};e([o()],l.prototype,"layer",void 0),e([o()],l.prototype,"tileInfo",null),l=e([s("esri.views.3d.layers.ElevationLayerView3D")],l);const p=l;export{p as default};
|