@arcgis/core 4.24.0-next.20220401 → 4.24.0-next.20220404
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/{c665e9b7d09fe516f138.js → 2fe10c5c01056babeae5.js} +1 -1
- package/assets/esri/core/workers/chunks/{8771296b537f366596c4.js → 37aa4532e25d54055e40.js} +54 -54
- package/assets/esri/core/workers/chunks/528033aa0d663b4d41bf.js +1 -0
- package/assets/esri/core/workers/chunks/{0e29250c24a3a7b1ce13.js → 6de5a790c14f04c6c302.js} +1 -1
- package/assets/esri/core/workers/chunks/b1188ca77b975c6a7d92.js +1 -0
- package/chunks/BlendLayers.glsl.js +1 -1
- package/chunks/DefaultMaterial.glsl.js +26 -26
- package/chunks/HUDMaterial.glsl.js +37 -37
- package/chunks/HighlightDownsample.glsl.js +1 -1
- package/chunks/ImageMaterial.glsl.js +10 -10
- package/chunks/LineMarker.glsl.js +75 -32
- package/chunks/RealisticTree.glsl.js +26 -26
- package/chunks/SMAA.glsl.js +2 -2
- package/chunks/SSAO.glsl.js +2 -2
- package/chunks/SimpleAtmosphere.glsl.js +10 -10
- package/chunks/TextureOnly.glsl.js +2 -2
- package/core/accessorSupport/Property.js +1 -1
- package/interfaces.d.ts +25 -7
- package/package.json +1 -1
- package/smartMapping/renderers/color.js +1 -1
- package/smartMapping/renderers/dotDensity.js +1 -1
- package/smartMapping/renderers/heatmap.js +1 -1
- package/smartMapping/renderers/location.js +1 -1
- package/smartMapping/renderers/predominance.js +1 -1
- package/smartMapping/renderers/relationship.js +1 -1
- package/smartMapping/renderers/size.js +1 -1
- package/smartMapping/renderers/type.js +1 -1
- package/smartMapping/symbology/color.js +1 -1
- package/smartMapping/symbology/dotDensity.js +1 -1
- package/smartMapping/symbology/flow.js +1 -1
- package/smartMapping/symbology/heatmap.js +1 -1
- package/smartMapping/symbology/location.js +1 -1
- package/smartMapping/symbology/predominance.js +1 -1
- package/smartMapping/symbology/relationship.js +1 -1
- package/smartMapping/symbology/size.js +1 -1
- package/smartMapping/symbology/type.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/Stage.js +1 -1
- package/views/2d/engine/flow/BrushFlow.js +1 -1
- package/views/2d/engine/imagery/BrushRasterBitmap.js +1 -1
- package/views/2d/engine/imagery/BrushVectorField.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTileRendererHelper3D.js +1 -1
- package/views/2d/engine/webgl/Painter.js +1 -1
- package/views/2d/engine/webgl/brushes/BrushBitmap.js +1 -1
- package/views/2d/engine/webgl/brushes/BrushClip.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLBrushInfo.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLBrushStencil.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLBrushVTLBackground.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLBrushVTLCircle.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLBrushVTLFill.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLBrushVTLLine.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLBrushVTLSymbol.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLGeometryBrushFill.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLGeometryBrushLabel.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLGeometryBrushLine.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLGeometryBrushMarker.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLGeometryBrushText.js +1 -1
- package/views/2d/engine/webgl/effects/post-processing/EffectManager.js +1 -1
- package/views/3d/environment/CloudsComposition.js +1 -1
- package/views/3d/environment/PanoramicAtmosphere.js +1 -1
- package/views/3d/environment/SimpleAtmosphere.glsl.js +1 -1
- package/views/3d/environment/SimpleAtmosphere.js +1 -1
- package/views/3d/environment/SimpleAtmosphereTechnique.js +1 -1
- package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/core/material/MaterialBase.js +1 -1
- package/views/3d/webgl-engine/core/material/RenderTexture.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js +6 -6
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexTextureCoordinates.glsl.js +6 -6
- package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeNormalTexture.glsl.js +5 -5
- package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +12 -12
- package/views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js +7 -7
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadBaseColorTexture.glsl.js +4 -9
- package/views/3d/webgl-engine/core/shaderModules/BooleanUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Float2Uniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Float4Uniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Float4sUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/FloatUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/FloatsUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/IntegerUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Matrix3Uniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Texture2DUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Uniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderTechnique/BindType.js +1 -1
- package/views/3d/webgl-engine/lib/GLTextureMaterial.js +1 -1
- package/views/3d/webgl-engine/lib/Program.js +1 -1
- package/views/3d/webgl-engine/lighting/SceneLighting.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
- package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/parts/ScreenshotManager.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/HUDMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/HUDMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ImageMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/LineMarkerTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/LineMarkerTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/RealisticTree.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/TerrainTechniqueConfiguration.js +1 -1
- package/views/MapView.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/support/DefaultsFromMap.js +1 -1
- package/views/support/screenshotUtils.js +1 -1
- package/widgets/Editor.js +1 -1
- package/assets/esri/core/workers/chunks/5682039666f874836451.js +0 -1
- package/assets/esri/core/workers/chunks/79bdb26244ec7b4472fe.js +0 -1
- package/chunks/color.js +0 -5
- package/chunks/dotDensity.js +0 -5
- package/chunks/heatmap.js +0 -5
- package/chunks/location.js +0 -5
- package/chunks/predominance.js +0 -5
- package/chunks/relationship.js +0 -5
- package/chunks/size.js +0 -5
- package/chunks/type.js +0 -5
- package/renderers/smartMapping/creators/color.js +0 -5
- package/renderers/smartMapping/creators/dotDensity.js +0 -5
- package/renderers/smartMapping/creators/heatmap.js +0 -5
- package/renderers/smartMapping/creators/location.js +0 -5
- package/renderers/smartMapping/creators/opacity.js +0 -5
- package/renderers/smartMapping/creators/predominance.js +0 -5
- package/renderers/smartMapping/creators/relationship.js +0 -5
- package/renderers/smartMapping/creators/size.js +0 -5
- package/renderers/smartMapping/creators/support/utils.js +0 -5
- package/renderers/smartMapping/creators/type.js +0 -5
- package/renderers/smartMapping/creators/univariateColorSize.js +0 -5
- package/renderers/smartMapping/heuristics/scaleRange.js +0 -5
- package/renderers/smartMapping/heuristics/sizeRange.js +0 -5
- package/renderers/smartMapping/statistics/classBreaks.js +0 -5
- package/renderers/smartMapping/statistics/heatmapStatistics.js +0 -5
- package/renderers/smartMapping/statistics/histogram.js +0 -5
- package/renderers/smartMapping/statistics/predominantCategories.js +0 -5
- package/renderers/smartMapping/statistics/summaryStatistics.js +0 -5
- package/renderers/smartMapping/statistics/summaryStatisticsForAge.js +0 -5
- package/renderers/smartMapping/statistics/support/ageUtils.js +0 -5
- package/renderers/smartMapping/statistics/uniqueValues.js +0 -5
- package/renderers/smartMapping/symbology/color.js +0 -5
- package/renderers/smartMapping/symbology/dotDensity.js +0 -5
- package/renderers/smartMapping/symbology/heatmap.js +0 -5
- package/renderers/smartMapping/symbology/location.js +0 -5
- package/renderers/smartMapping/symbology/predominance.js +0 -5
- package/renderers/smartMapping/symbology/relationship.js +0 -5
- package/renderers/smartMapping/symbology/size.js +0 -5
- package/renderers/smartMapping/symbology/support/colorRamps.js +0 -5
- package/renderers/smartMapping/symbology/support/utils.js +0 -5
- package/renderers/smartMapping/symbology/type.js +0 -5
package/views/MapView.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.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../Graphic.js";import i from"../Viewpoint.js";import s from"../core/Collection.js";import n from"../core/CollectionFlattener.js";import r from"../core/Error.js";import a from"../core/has.js";import{isIterable as o}from"../core/iteratorUtils.js";import l from"../core/Logger.js";import{isSome as p,unwrap as h,isNone as c}from"../core/maybe.js";import{throwIfAborted as d}from"../core/promiseUtils.js";import{watch as u,whenOnce as m,sync as g,syncAndInitial as f}from"../core/reactiveUtils.js";import{createScreenPoint as w}from"../core/screenUtils.js";import y from"../core/Warning.js";import{initialize as v}from"../core/workers/workers.js";import{property as _}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/accessorSupport/ensureType.js";import{subclass as V}from"../core/accessorSupport/decorators/subclass.js";import S from"../geometry/Extent.js";import j from"../geometry/Point.js";import{load as T,canProjectWithoutEngine as R,project as b,isLoaded as x}from"../geometry/projection.js";import{equals as M}from"../geometry/support/spatialReferenceUtils.js";import O from"../layers/support/TileInfo.js";import{BreakpointsOwner as k}from"./BreakpointsOwner.js";import{DOMContainer as z}from"./DOMContainer.js";import{PopupView as L}from"./PopupView.js";import P from"./View.js";import C from"./ViewAnimation.js";import E from"./2d/AnimationManager.js";import G from"./2d/FrameTask.js";import{layerView2DImporter as N}from"./2d/layerViewModuleImportUtils.js";import D from"./2d/MapViewConstraints.js";import q from"./2d/PaddedViewState.js";import"./2d/tiling/PagedTileQueue.js";import U from"./2d/tiling/TileInfoView.js";import"./2d/tiling/TileKey.js";import"./2d/tiling/TileQueue.js";import"./2d/tiling/TileStrategy.js";import{centerAt as A,setExtent as I,rotateTo as F,scaleTo as W,copy as B,create as H,extentToScale as $,resize as J,angleBetween as Q}from"./2d/viewpointUtils.js";import Z from"./2d/input/MapViewInputManager.js";import K from"./2d/layers/features/support/TileStore.js";import X from"./2d/support/HighlightOptions.js";import{Timeline as Y}from"./2d/support/Timeline.js";import ee from"./support/createScreenshotPlan.js";import{getMaximumResolutionScale as te,getFormatAndQuality as ie}from"./support/screenshotUtils.js";import{isSupportedScreenPointEvent as se,createScreenPointFromSupportedEvent as ne}from"./support/screenUtils.js";import{check as re}from"./support/WebGLRequirements.js";import ae from"./ui/2d/DefaultUI2D.js";import oe from"../webmap/background/ColorBackground.js";const le=l.getLogger("esri.views.MapView");let pe,he,ce,de,ue,me;async function ge(){const[,{GraphicsView2D:e,GraphicContainer:t,LabelManager:i,MapViewNavigation:s,MagnifierView2D:n,Stage:r}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);he=e,ce=t,de=i,ue=s,me=n,pe=r}const fe=160;function we(e){return e&&"esri.Viewpoint"===e.declaredClass}let ye=class extends(k(z(L(P)))){constructor(e){super(e),this._magnifierView=null,this._stage=null,this._resolveWhenReady=[],this.rootLayerViews=new n({getCollections:()=>{var e,t;return[null==(e=this.basemapView)?void 0:e.baseLayerViews,this.layerViews,null==(t=this.basemapView)?void 0:t.referenceLayerViews]},getChildrenFunction:()=>null}),this.featuresTilingScheme=null,this.fullOpacity=1,this.graphicsView=null,this.labelManager=null,this.mapViewNavigation=null,this.renderingOptions={samplingMode:"dynamic",edgeLabelsVisible:!0,labelsAnimationTime:125,labelCollisionsEnabled:!0},this.rendering=!1,this.supersampleScreenshotsEnabled=!1,this.supportsGround=!1,this._stationaryTimer=null,this.frameTask=new G(this),this._pePromise=null,this.floors=new s,this.highlightOptions=new X,this.inputManager=new Z({view:this}),this.map=null,this.resizeAlign="center",this.spatialReferenceLocked=!1,this.timeline=new Y,this.type="2d",this.ui=new ae,this.constraints=new D,this.padding={top:0,right:0,bottom:0,left:0},this.handles.add([u((()=>this.viewpoint),(()=>{this._lastStationaryEventTimestamp=performance.now(),this._flipStationary(fe)}),g),this.on("resize",(e=>this._resizeHandler(e))),u((()=>{var e;return null==(e=this.animationManager)?void 0:e.animation}),(e=>{this.animation=e}))]),v()}destroy(){this._set("preconditionsReady",!1),this._gotoTask=this.frameTask=null,this.rootLayerViews.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get graphicsTileStore(){return new K(this.featuresTilingScheme)}get initialExtentRequired(){var e;const{scale:t,constraints:i,center:s,viewpoint:n,extent:r}=this;let a=this.zoom;return!(this.map&&"initialViewProperties"in this.map&&null!=(e=this.map.initialViewProperties)&&e.viewpoint)&&(!r&&(null!=i&&i.effectiveLODs||(a=-1),(!s||0===t&&-1===a)&&(!n||!p(n.targetGeometry)||"extent"!==n.targetGeometry.type&&!n.scale)))}get resourceManager(){return this._stage.resourceManager}get textureManager(){return this._stage.painter.textureManager}get _defaultsFromMapSettings(){return{required:{tileInfo:!0,heightModelInfo:!1,extent:!1},requiresExtentInSpatialReference:this.spatialReferenceLocked}}get _projectionEngineLoaded(){return!!x()||(this._pePromise||(this._pePromise=T().finally((()=>{this._pePromise=null}))),!1)}get typeSpecificPreconditionsReady(){const e=this._getDefaultViewpoint();if(!e)return!1;const t=this.spatialReference,i=h(e.targetGeometry);return!!R(i.spatialReference,t)||this._projectionEngineLoaded}set animation(e){const t=this._get("animation");if(e===t)return;if(t&&t.stop(),!e||e.isFulfilled())return void this._set("animation",null);this._set("animation",e),this.frameTask.animationInProgress=!0;const i=()=>{e===this._get("animation")&&(this._set("animation",null),this.frameTask.requestFrame()),this.frameTask.animationInProgress=!1};e.when(i,i)}get background(){return this.get("map.initialViewProperties.background")||null}set background(e){void 0===e?this._clearOverride("background"):this._override("background",e)}get center(){if(!this.ready)return this._get("center");const{center:e,spatialReference:t}=this.state.paddedViewState;return new j({x:e[0],y:e[1],spatialReference:t})}set center(e){if(null==e)return;if(!this.ready)return this._set("center",e),void this.notifyChange("initialExtentRequired");let t;try{t=this._project(e,this.spatialReference)}catch(s){return void le.error(new r("mapview:invalid-center","could not project the value in the view's spatial reference",{input:e,error:s}))}const i=this.viewpoint;A(i,i,t),this.viewpoint=i}set constraints(e){const t=this._get("constraints");t&&(this.handles.remove("map-view-constraints"),t.destroy()),this._set("constraints",e),e&&(e.view=this,this.ready&&(this.state.viewpoint=e.fit(this.state.paddedViewState.viewpoint)),this.handles.add(u((()=>e.version),(()=>{this.ready&&this.state&&(this.state.viewpoint=e.fit(this.state.paddedViewState.viewpoint))}),g),"map-view-constraints"))}get extent(){return this.ready?this.state.paddedViewState.extent.clone():this._get("extent")}set extent(e){if(null==e)return;if(!e.width||!e.height)return void le.error(new r("mapview:invalid-extent","invalid extent size"));if(!this.ready)return this._set("extent",e),this._set("center",null),this._set("viewpoint",null),this._set("scale",0),this._set("zoom",-1),void this.notifyChange("initialExtentRequired");let t;try{t=this._project(e,this.spatialReference)}catch(s){return void le.error(new r("mapview:invalid-extent","could not project the value in the view's spatial reference",{error:s}))}const i=this.viewpoint;I(i,i,t,this.size,{constraints:this.constraints}),this.viewpoint=i}get padding(){return this.ready?this.state.padding:this._get("padding")}set padding(e){this.ready?(this.state.padding=e,this._set("padding",this.state.padding)):this._set("padding",e)}get resolution(){return this.state?this.state.resolution:0}get rotation(){return this.ready?this.state.rotation:this._get("rotation")}set rotation(e){if(isNaN(e))return;if(!this.ready)return void this._set("rotation",e);const t=this.viewpoint;F(t,t,e),this.viewpoint=t}get scale(){return this.ready?this.state.scale:this._get("scale")}set scale(e){if(!e||isNaN(e))return;if(!this.ready){this._set("scale",e),this._set("zoom",-1);const t=this._get("extent");return t&&(this._set("extent",null),this._set("center",t.center)),void this.notifyChange("initialExtentRequired")}const t=this.viewpoint;W(t,t,e),this.viewpoint=t}get stationary(){return!(this.animation||this.navigating||this.resizing||this._stationaryTimer)}get updating(){return!this.destroyed&&(!this.layerViewManager||!this.labelManager||!this.graphicsView||!0===this.layerViewManager.updating||!0===this.labelManager.updating||!0===this.graphicsView.updating||this.allLayerViews.some((e=>!e.destroyed&&!("layerViews"in e)&&!0===e.updating)))}get viewpoint(){if(!this.ready)return this._get("viewpoint");const e=this.state.paddedViewState;return e&&e.viewpoint.clone()}set viewpoint(e){if(null==e)return;if(!this.ready)return this._set("viewpoint",e),this._set("extent",null),this._set("center",null),this._set("zoom",-1),this._set("scale",0),void this.notifyChange("initialExtentRequired");let t,s;try{t=this._project(e,this.spatialReference),!e.scale||isNaN(e.scale)?s=new r("mapview:invalid-viewpoint",`invalid scale value of ${e.scale}`):c(e.targetGeometry)&&(s=new r("mapview:invalid-viewpoint","geometry not defined"))}catch(a){s=new r("mapview:invalid-viewpoint","could not project the value in the view's spatial reference",{error:a})}if(s)return void le.error(s);this._scaleBeforeChangingSpatialReference=null;const n=new i({targetGeometry:new j,scale:0,rotation:0});B(n,t),this.constraints.constrain(n,this.state.paddedViewState.viewpoint),this.state.viewpoint=n,this.frameTask.requestFrame(),this._set("viewpoint",n)}get zoom(){return this.ready?this.constraints.scaleToZoom(this.scale):this._get("zoom")}set zoom(e){if(null==e)return;if(!this.ready){this._set("zoom",e),this._set("scale",0);const t=this._get("extent");return t&&(this._set("extent",null),this._set("center",t.center)),void this.notifyChange("initialExtentRequired")}if(!this.constraints.effectiveLODs)return void this._set("zoom",-1);const t=this.viewpoint;W(t,t,this.constraints.zoomToScale(e)),this.viewpoint=t,this._set("zoom",this.constraints.scaleToZoom(this.scale))}get navigating(){return!(!this.mapViewNavigation||!this.mapViewNavigation.interacting)}goTo(e,t){if(e)return this.animation&&(this.animation=null),this._createAnimation(),m((()=>this.ready),t).then((()=>{const i={animate:!0,...t},s=H(e,this);return this.animation.update(s),this._gotoTask={},i.animate?this._gotoAnimated(s,i):this._gotoImmediate(s,i)}));le.error("#goTo()","target cannot be null or undefined")}async hitTest(e,t){const i=se(e)?ne(this,e):e;if(!this.ready||isNaN(i.x)||isNaN(i.y))return{screenPoint:i,results:[]};let s=new Set,n=!1,r=null,a=null;null!=t&&t.include?Se(t.include,Ve(this,(e=>s.add(e)),(e=>{r||(r=new Set),r.add(e)}),(e=>s.add(e)),(()=>n=!0))):(n=!0,s=new Set(this.allLayerViews)),null!=t&&t.exclude&&Se(t.exclude,Ve(this,(e=>s.delete(e)),(e=>{a||(a=new Set),a.add(e)})));const o=this.allLayerViews.filter((e=>!e.suspended&&s.has(e))).reverse(),l=this.toMap(i);let h=(await Promise.all([n?this.graphicsView.hitTest(l):null,...o.map((e=>e.hitTest(l,i)))])).filter(p).flat();return r&&(h=h.filter((e=>r.has(_e(e))))),a&&(h=h.filter((e=>!a.has(_e(e))))),{screenPoint:i,results:h.map((e=>({mapPoint:l,graphic:e})))}}takeScreenshot(e){e=e||{};const t=this.supersampleScreenshotsEnabled?Math.min(4,te(this.size,Math.min(4096,this._stage.context.parameters.maxTextureSize))):1;let i;e.layers?(i=[],e.layers.forEach((e=>{const t=this.allLayerViews.find((t=>t.layer.id===e.id));t&&"container"in t&&t.container&&i.push(t.container)}))):i=this._stage.children;const{format:s,quality:n}=ie(e.format,e.quality),r=ee(e,t,this.size,this.padding,s,n,i,e.rotation);return this._stage.takeScreenshot(r)}toMap(e){if(!this.ready)return null;const t=se(e)?ne(this,e):e,i=[0,0],[s,n]=this.state.toMap(i,[t.x,t.y]),r=this.spatialReference;return new j({x:s,y:n,spatialReference:r})}toScreen(e){if(!this.ready)return null;const t=this._project(e,this.spatialReference),i=[t.x,t.y];return this.state.toScreen(i,i),w(i[0],i[1])}on(e,t,i,s){const n=this.inputManager&&this.viewEvents.on(e,t,i,s);return n||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}whenLayerView(e){return super.whenLayerView(e)}graphicChanged(e){if(this.graphicsView){this.graphicsView.graphicUpdateHandler(e)}}whenReady(){return new Promise((e=>{this.ready?e(this):this._resolveWhenReady.push(e)}))}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){var e,t,i;return this.map&&"initialViewProperties"in this.map&&(null==(e=this.map)||null==(t=e.initialViewProperties)?void 0:t.spatialReference)||(null==(i=this.defaultsFromMap)?void 0:i.spatialReference)||null}hasLayerViewModule(e){return N.hasLayerViewModule(e)}importLayerView(e){return N.importLayerView(e)}pixelSizeAt(){return this.ready?this.state.resolution:(le.error("#pixelSizeAt()","Map view cannot be used before it is ready"),null)}popupHitTest(e){return this.hitTest(e).then((t=>({...t,mapPoint:this.toMap(e)})))}requestUpdate(){this.ready&&this.frameTask.requestUpdate()}validate(){let e=re(this.type);return a("safari")&&a("safari")<9&&(e=new r("mapview:browser-not-supported","This browser is not supported by MapView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:a("safari")})),p(e)?(le.warn("#validate()",e.message),Promise.reject(e)):ge()}_createAnimation(){return this.animation&&!this.animation.done||(this.animation=new C),this.animation}_cancellableGoTo(e,t,i){const s=()=>e===this._gotoTask,n=i.then((()=>{s()&&(this.animation=null)})).catch((e=>{throw s()&&(this.animation=null,t.done||(t.stop(),this.frameTask.animationInProgress=!1)),e})),r=new Promise((e=>e(n)));return t.when().catch((()=>{s()&&r.cancel&&r.cancel()})),r}_gotoImmediate(e,t){const i=this._gotoTask,s=this.animation,n=e.then((e=>{if(d(t),i!==this._gotoTask)throw new r("view:goto-interrupted","Goto was interrupted");this.viewpoint=s.target=e,s.finish()}));return this._cancellableGoTo(i,s,n)}_flipStationary(e){return null!==this._stationaryTimer||(this._stationaryTimer=setTimeout((()=>{this._stationaryTimer=null;const e=performance.now()-this._lastStationaryEventTimestamp;e<fe&&(this._stationaryTimer=this._flipStationary(e))}),e)),this._stationaryTimer}_getDefaultViewpoint(){var e,t,s,n;const{constraints:r,initialExtent:a,map:o}=this;if(!r)return null;const l=o&&"initialViewProperties"in o&&o.initialViewProperties,c={zoom:this._get("zoom"),scale:this._get("scale"),center:this._get("center"),extent:this._get("extent"),rotation:this._get("rotation"),viewpoint:this._get("viewpoint"),spatialReference:this._userSpatialReference};r.effectiveLODs?-1!==c.zoom&&(c.scale=r.zoomToScale(c.zoom)):c.zoom=-1;let d=null,u=null,m=0;const g=c.viewpoint&&c.viewpoint.rotation,f=c.viewpoint&&c.viewpoint.targetGeometry;p(f)&&("extent"===f.type?d=f:"point"===f.type&&(u=f,m=c.viewpoint.scale));const w=c.extent||d||(null==(e=h(null==l||null==(t=l.viewpoint)?void 0:t.targetGeometry))?void 0:e.extent)||a,y=c.center||u||(null==w?void 0:w.center),v=c.scale||m||(null==l||null==(s=l.viewpoint)?void 0:s.scale)||w&&$(w,this.size),_=c.rotation||g||(null==l||null==(n=l.viewpoint)?void 0:n.rotation)||0;return y&&v?new i({targetGeometry:y,scale:v,rotation:_}):null}_gotoAnimated(e,t){const i=this._gotoTask,s=this.animation,n=e.then((e=>{if(d(t),i!==this._gotoTask)throw new r("view:goto-interrupted","Goto was interrupted");return s.update(e),this.animationManager.animate(s,this.viewpoint,t),s.when().then((()=>{}),(()=>{}))}));return this._cancellableGoTo(i,s,n)}_project(e,t){var i;const s=e&&e.targetGeometry||e;if(!t)return e;if(!s)return null;if(t.imageCoordinateSystem||null!=(i=s.spatialReference)&&i.imageCoordinateSystem)return e;if(M(t,s.spatialReference))return e;const n=b(s,t);if(!n)throw new r("mapview:projection-not-possible","projecting input geometry to target spatial reference returned a null value",{geometry:s,spatialReference:t});return we(e)?(e.targetGeometry=n,e):n}_resizeHandler(e){if(!this.ready)return;const t=this.state;let i=this.state.paddedViewState.viewpoint;const s=this.state.paddedViewState.size.concat();t.size=[e.width,e.height],J(i,i,s,this.state.paddedViewState.size,this.resizeAlign),i=this.constraints.constrain(i,null),this.state.viewpoint=i}_startup(){var e;this.timeline.begin("MapView Startup");const t=this._getDefaultViewpoint(),i=t.targetGeometry;try{this._project(t,this.spatialReference)}catch(p){var s;le.warn(new y("mapview:startup-projection-error","projection of initial viewpoint to the view's spatial reference, defaulting to the initial viewpoint.",{center:i.toJSON(),spatialReference:this.spatialReference,error:p})),t.targetGeometry=(null==(s=this.defaultsFromMap.extent)?void 0:s.center)||new j({x:0,y:0,spatialReference:this.spatialReference})}null==(e=this.constraints)||e.fit(t),this._set("state",new q({padding:this._get("padding"),size:this.size,viewpoint:t})),this.graphics.owner=this;const n=new pe(this.surface,{canvas:this.renderCanvas,supersampleScreenshots:this.supersampleScreenshotsEnabled,contextOptions:{disabledExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions},renderingOptions:this.renderingOptions,timeline:this.timeline});this._stage=n,this._magnifierView=new me,this._magnifierView.magnifier=this.magnifier;const r=new de({view:this});this._set("labelManager",r);const a=new E({view:this});this._set("animationManager",a);const o=new ue({view:this,animationManager:a});this._set("mapViewNavigation",o),this._setupSpatialReferenceDependentProperties(),this.handles.add([this.rootLayerViews.on("change",(()=>this._updateStageChildren())),n.on("post-render",(()=>this._set("rendering",n.renderRequested))),n.on("will-render",(()=>this._set("rendering",n.renderRequested))),n.on("webgl-error",(e=>this.fatalError=e.error)),u((()=>this.stationary),(e=>n.stationary=e),f),u((()=>this.background),(e=>{n.background=e,this._magnifierView.background=e}),f),u((()=>this.magnifier),(e=>this._magnifierView.magnifier=e),f),u((()=>this.renderingOptions),(e=>n.renderingOptions=e),f),u((()=>this.highlightOptions),(e=>n.highlightOptions=e),f),u((()=>this.state.id),(()=>n.state=this.state),f)],"map-view"),this._updateStageChildren();const l=this._resolveWhenReady;this._resolveWhenReady=[],l.forEach((e=>e(this))),this.timeline.end("MapView Startup"),this.frameTask&&this.frameTask.start(),this._set("ready",!0)}_teardown(){this._destroySpatialReferenceDependentProperties(),this.handles.remove("map-view"),this.mapViewNavigation.destroy(),this._set("mapViewNavigation",null),this.animationManager.destroy(),this._set("animationManager",null),this.layerViewManager.clear(),this.labelManager.destroy(),this._magnifierView.destroy(),this._stage.destroy(),this._stage=null,this._set("graphicsView",null),this._magnifierView=null,this._set("labelManager",null),this._set("mapViewNavigation",null),this.graphics.owner=null,this.frameTask&&this.frameTask.stop(),this._stationaryTimer&&(clearTimeout(this._stationaryTimer),this._stationaryTimer=null),this._set("ready",!1);const{center:[e,t],spatialReference:i,rotation:s,scale:n}=this.state.paddedViewState,r=new j({x:e,y:t,spatialReference:i});this._set("viewpoint",null),this._set("extent",null),this._set("center",r),this._set("zoom",-1),this._set("rotation",s),this._set("scale",n),this._set("spatialReference",i),this._set("state",null),this.animation=null}_updateStageChildren(){this._stage.removeAllChildren(),this.rootLayerViews.forEach((e=>{this._stage.addChild(e.container)}));const e=this.graphicsView;this._stage.addChild(e.container),this._stage.addChild(this._magnifierView)}_setupSpatialReferenceDependentProperties(){const e=new U(O.create({spatialReference:this.spatialReference,size:512,numLODs:36}));this._set("featuresTilingScheme",e);const t=new he({view:this,graphics:this.graphics,requestUpdateCallback:()=>this.requestUpdate(),container:new ce(e)});this.frameTask.graphicsView=t,this._set("graphicsView",t)}_destroySpatialReferenceDependentProperties(){const e=this.graphicsView;this._set("graphicsView",null),this.frameTask.graphicsView=null,e.destroy(),this._set("featuresTilingScheme",null)}_spatialReferenceChanged(e){if(!this.ready)return;this.frameTask.stop();for(const i of this.allLayerViews)i.processDetach();this._destroySpatialReferenceDependentProperties();const t=this.state.paddedViewState.clone();if(c(this._scaleBeforeChangingSpatialReference))this._scaleBeforeChangingSpatialReference=t.scale;else{const e=t.viewpoint.clone();e.scale=this._scaleBeforeChangingSpatialReference,t.viewpoint=e}const s=t.clone(),[n,r]=t.center;let o=null;try{o=this._project(new j({x:n,y:r,spatialReference:t.spatialReference}),e)}catch(p){x()||le.warn(new y("mapview:spatial-reference-change","could not project the view's center to the new spatial reference",{center:o.toJSON(),spatialReference:e,error:p}))}o||(o=new j({x:0,y:0,spatialReference:e}));const l=A(new i({targetGeometry:new j,scale:0,rotation:0}),t.viewpoint,o);s.viewpoint=l;try{const i=20,n=[t.size[0]/2,t.size[1]/2],r=[n[0]+i,n[1]],o=t.toMap([0,0],r),{x:p,y:h}=this._project(new j({x:o[0],y:o[1],spatialReference:t.spatialReference}),e);o[0]=p,o[1]=h,s.toScreen(o,o);const c=Q(n,o,r),d=Math.hypot(o[0]-n[0],o[1]-n[1])/i;!Number.isFinite(d)||Math.abs(d)>4?(l.rotation=0,l.targetGeometry=new j({x:0,y:0,spatialReference:e})):(l.scale*=d,l.scale>a("mapview-srswitch-adjust-rotation-scale-threshold")?l.rotation=0:l.rotation+=Number.isFinite(c)?c:0)}catch{}this._get("constraints").constrain(l,null),this._get("state").viewpoint=l,this._stage.state=this.state,this._setupSpatialReferenceDependentProperties();for(const i of this.allLayerViews)i.processAttach();this.frameTask.requestFrame(),this.frameTask.start(),this._updateStageChildren()}};e([_({readOnly:!0})],ye.prototype,"animationManager",void 0),e([_({constructOnly:!0})],ye.prototype,"deactivatedWebGLExtensions",void 0),e([_({constructOnly:!0})],ye.prototype,"debugWebGLExtensions",void 0),e([_({readOnly:!0})],ye.prototype,"featuresTilingScheme",void 0),e([_({readOnly:!0})],ye.prototype,"fullOpacity",void 0),e([_({readOnly:!0})],ye.prototype,"graphicsTileStore",null),e([_()],ye.prototype,"graphicsView",void 0),e([_({readOnly:!0})],ye.prototype,"state",void 0),e([_()],ye.prototype,"initialExtentRequired",null),e([_()],ye.prototype,"labelManager",void 0),e([_({readOnly:!0})],ye.prototype,"resourceManager",null),e([_({readOnly:!0})],ye.prototype,"textureManager",null),e([_({readOnly:!0})],ye.prototype,"mapViewNavigation",void 0),e([_({constructOnly:!0})],ye.prototype,"renderCanvas",void 0),e([_()],ye.prototype,"renderingOptions",void 0),e([_({readOnly:!0})],ye.prototype,"rendering",void 0),e([_({constructOnly:!0})],ye.prototype,"supersampleScreenshotsEnabled",void 0),e([_({readOnly:!0})],ye.prototype,"supportsGround",void 0),e([_()],ye.prototype,"_stationaryTimer",void 0),e([_()],ye.prototype,"_defaultsFromMapSettings",null),e([_()],ye.prototype,"_pePromise",void 0),e([_({readOnly:!0})],ye.prototype,"typeSpecificPreconditionsReady",null),e([_()],ye.prototype,"animation",null),e([_({type:oe})],ye.prototype,"background",null),e([_({value:null,type:j,dependsOn:["state.id","ready"]})],ye.prototype,"center",null),e([_({type:D})],ye.prototype,"constraints",null),e([_({value:null,type:S,dependsOn:["state.id","ready"]})],ye.prototype,"extent",null),e([_()],ye.prototype,"floors",void 0),e([_({type:X})],ye.prototype,"highlightOptions",void 0),e([_({readOnly:!0})],ye.prototype,"inputManager",void 0),e([_()],ye.prototype,"map",void 0),e([_({value:{top:0,right:0,bottom:0,left:0},cast:e=>({top:0,right:0,bottom:0,left:0,...e})})],ye.prototype,"padding",null),e([_()],ye.prototype,"resizeAlign",void 0),e([_({readOnly:!0,dependsOn:["state.id"]})],ye.prototype,"resolution",null),e([_({value:0,type:Number,dependsOn:["state.id","ready"]})],ye.prototype,"rotation",null),e([_({value:0,type:Number,dependsOn:["state.id","ready"]})],ye.prototype,"scale",null),e([_({constructOnly:!0})],ye.prototype,"spatialReferenceLocked",void 0),e([_()],ye.prototype,"stationary",null),e([_({type:Y,readOnly:!0})],ye.prototype,"timeline",void 0),e([_({readOnly:!0})],ye.prototype,"type",void 0),e([_({readOnly:!0})],ye.prototype,"updating",null),e([_({value:null,type:i,dependsOn:["state.id","ready"]})],ye.prototype,"viewpoint",null),e([_({value:-1,dependsOn:["state.id"]})],ye.prototype,"zoom",null),e([_({type:Boolean})],ye.prototype,"navigating",null),e([_({type:ae})],ye.prototype,"ui",void 0),ye=e([V("esri.views.MapView")],ye);const ve=ye;function _e(e){const t=e.getObjectId();var i,s,n,r;return t?`${null!=(i=null!=(s=null==(n=e.layer)?void 0:n.uid)?s:null==(r=e.sourceLayer)?void 0:r.uid)?i:"MapView"}/${t}`:`"MapView/${e.uid}`}function Ve(e,i,s,n,r){return a=>{if(a instanceof t){if(a.layer===e)null==r||r();else{const t=e.allLayerViews.find((e=>e.layer===a.layer));t&&(null==n||n(t))}s(_e(a))}else{const t=e.allLayerViews.find((e=>e.layer===a));t&&i(t)}}}function Se(e,t){if(e)if(o(e))for(const i of e)if(o(i))for(const e of i)t(e);else t(i);else t(e)}export{ve as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../Graphic.js";import i from"../Viewpoint.js";import s from"../core/Collection.js";import r from"../core/CollectionFlattener.js";import n from"../core/Error.js";import a from"../core/has.js";import{isIterable as o}from"../core/iteratorUtils.js";import l from"../core/Logger.js";import{isSome as p,unwrap as h,isNone as c}from"../core/maybe.js";import{throwIfAborted as d}from"../core/promiseUtils.js";import{watch as u,whenOnce as m,sync as g,syncAndInitial as f}from"../core/reactiveUtils.js";import{createScreenPoint as w}from"../core/screenUtils.js";import y from"../core/Warning.js";import{initialize as v}from"../core/workers/workers.js";import{property as _}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/accessorSupport/ensureType.js";import{subclass as V}from"../core/accessorSupport/decorators/subclass.js";import S from"../geometry/Extent.js";import j from"../geometry/Point.js";import{load as T,canProjectWithoutEngine as R,project as b,isLoaded as x}from"../geometry/projection.js";import{equals as M}from"../geometry/support/spatialReferenceUtils.js";import O from"../layers/support/TileInfo.js";import{BreakpointsOwner as k}from"./BreakpointsOwner.js";import{DOMContainer as z}from"./DOMContainer.js";import{PopupView as L}from"./PopupView.js";import P from"./View.js";import C from"./ViewAnimation.js";import E from"./2d/AnimationManager.js";import G from"./2d/FrameTask.js";import{layerView2DImporter as N}from"./2d/layerViewModuleImportUtils.js";import q from"./2d/MapViewConstraints.js";import D from"./2d/PaddedViewState.js";import"./2d/tiling/PagedTileQueue.js";import F from"./2d/tiling/TileInfoView.js";import"./2d/tiling/TileKey.js";import"./2d/tiling/TileQueue.js";import"./2d/tiling/TileStrategy.js";import{centerAt as U,setExtent as A,rotateTo as I,scaleTo as W,copy as B,create as H,extentToScale as $,resize as J,angleBetween as Q}from"./2d/viewpointUtils.js";import Z from"./2d/input/MapViewInputManager.js";import K from"./2d/layers/features/support/TileStore.js";import Y from"./2d/support/HighlightOptions.js";import{Timeline as X}from"./2d/support/Timeline.js";import ee from"./support/createScreenshotPlan.js";import{encode as te,encodeData as ie,getMaximumResolutionScale as se,getFormatAndQuality as re}from"./support/screenshotUtils.js";import{isSupportedScreenPointEvent as ne,createScreenPointFromSupportedEvent as ae}from"./support/screenUtils.js";import{check as oe}from"./support/WebGLRequirements.js";import le from"./ui/2d/DefaultUI2D.js";import pe from"../webmap/background/ColorBackground.js";const he=l.getLogger("esri.views.MapView");let ce,de,ue,me,ge,fe;async function we(){const[,{GraphicsView2D:e,GraphicContainer:t,LabelManager:i,MapViewNavigation:s,MagnifierView2D:r,Stage:n}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);de=e,ue=t,me=i,ge=s,fe=r,ce=n}const ye=160;function ve(e){return e&&"esri.Viewpoint"===e.declaredClass}let _e=class extends(k(z(L(P)))){constructor(e){super(e),this._magnifierView=null,this._stage=null,this._resolveWhenReady=[],this.rootLayerViews=new r({getCollections:()=>{var e,t;return[null==(e=this.basemapView)?void 0:e.baseLayerViews,this.layerViews,null==(t=this.basemapView)?void 0:t.referenceLayerViews]},getChildrenFunction:()=>null}),this.featuresTilingScheme=null,this.fullOpacity=1,this.graphicsView=null,this.labelManager=null,this.mapViewNavigation=null,this.renderingOptions={samplingMode:"dynamic",edgeLabelsVisible:!0,labelsAnimationTime:125,labelCollisionsEnabled:!0},this.rendering=!1,this.supersampleScreenshotsEnabled=!1,this.supportsGround=!1,this._stationaryTimer=null,this.frameTask=new G(this),this._pePromise=null,this.floors=new s,this.highlightOptions=new Y,this.inputManager=new Z({view:this}),this.map=null,this.resizeAlign="center",this.spatialReferenceLocked=!1,this.timeline=new X,this.type="2d",this.ui=new le,this._pixelFormat={flipY:!0,premultipliedAlpha:!0},this.constraints=new q,this.padding={top:0,right:0,bottom:0,left:0},this.handles.add([u((()=>this.viewpoint),(()=>{this._lastStationaryEventTimestamp=performance.now(),this._flipStationary(ye)}),g),this.on("resize",(e=>this._resizeHandler(e))),u((()=>{var e;return null==(e=this.animationManager)?void 0:e.animation}),(e=>{this.animation=e}))]),v()}destroy(){this._set("preconditionsReady",!1),this._gotoTask=this.frameTask=null,this.rootLayerViews.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get graphicsTileStore(){return new K(this.featuresTilingScheme)}get initialExtentRequired(){var e;const{scale:t,constraints:i,center:s,viewpoint:r,extent:n}=this;let a=this.zoom;return!(this.map&&"initialViewProperties"in this.map&&null!=(e=this.map.initialViewProperties)&&e.viewpoint)&&(!n&&(null!=i&&i.effectiveLODs||(a=-1),(!s||0===t&&-1===a)&&(!r||!p(r.targetGeometry)||"extent"!==r.targetGeometry.type&&!r.scale)))}get resourceManager(){return this._stage.resourceManager}get textureManager(){return this._stage.painter.textureManager}get _defaultsFromMapSettings(){return{required:{tileInfo:!0,heightModelInfo:!1,extent:!1},requiresExtentInSpatialReference:this.spatialReferenceLocked}}get _projectionEngineLoaded(){return!!x()||(this._pePromise||(this._pePromise=T().finally((()=>{this._pePromise=null}))),!1)}get typeSpecificPreconditionsReady(){const e=this._getDefaultViewpoint();if(!e)return!1;const t=this.spatialReference,i=h(e.targetGeometry);return!!R(i.spatialReference,t)||this._projectionEngineLoaded}set animation(e){const t=this._get("animation");if(e===t)return;if(t&&t.stop(),!e||e.isFulfilled())return void this._set("animation",null);this._set("animation",e),this.frameTask.animationInProgress=!0;const i=()=>{e===this._get("animation")&&(this._set("animation",null),this.frameTask.requestFrame()),this.frameTask.animationInProgress=!1};e.when(i,i)}get background(){return this.get("map.initialViewProperties.background")||null}set background(e){void 0===e?this._clearOverride("background"):this._override("background",e)}get center(){if(!this.ready)return this._get("center");const{center:e,spatialReference:t}=this.state.paddedViewState;return new j({x:e[0],y:e[1],spatialReference:t})}set center(e){if(null==e)return;if(!this.ready)return this._set("center",e),void this.notifyChange("initialExtentRequired");let t;try{t=this._project(e,this.spatialReference)}catch(s){return void he.error(new n("mapview:invalid-center","could not project the value in the view's spatial reference",{input:e,error:s}))}const i=this.viewpoint;U(i,i,t),this.viewpoint=i}set constraints(e){const t=this._get("constraints");t&&(this.handles.remove("map-view-constraints"),t.destroy()),this._set("constraints",e),e&&(e.view=this,this.ready&&(this.state.viewpoint=e.fit(this.state.paddedViewState.viewpoint)),this.handles.add(u((()=>e.version),(()=>{this.ready&&this.state&&(this.state.viewpoint=e.fit(this.state.paddedViewState.viewpoint))}),g),"map-view-constraints"))}get extent(){return this.ready?this.state.paddedViewState.extent.clone():this._get("extent")}set extent(e){if(null==e)return;if(!e.width||!e.height)return void he.error(new n("mapview:invalid-extent","invalid extent size"));if(!this.ready)return this._set("extent",e),this._set("center",null),this._set("viewpoint",null),this._set("scale",0),this._set("zoom",-1),void this.notifyChange("initialExtentRequired");let t;try{t=this._project(e,this.spatialReference)}catch(s){return void he.error(new n("mapview:invalid-extent","could not project the value in the view's spatial reference",{error:s}))}const i=this.viewpoint;A(i,i,t,this.size,{constraints:this.constraints}),this.viewpoint=i}get padding(){return this.ready?this.state.padding:this._get("padding")}set padding(e){this.ready?(this.state.padding=e,this._set("padding",this.state.padding)):this._set("padding",e)}get resolution(){return this.state?this.state.resolution:0}get rotation(){return this.ready?this.state.rotation:this._get("rotation")}set rotation(e){if(isNaN(e))return;if(!this.ready)return void this._set("rotation",e);const t=this.viewpoint;I(t,t,e),this.viewpoint=t}get scale(){return this.ready?this.state.scale:this._get("scale")}set scale(e){if(!e||isNaN(e))return;if(!this.ready){this._set("scale",e),this._set("zoom",-1);const t=this._get("extent");return t&&(this._set("extent",null),this._set("center",t.center)),void this.notifyChange("initialExtentRequired")}const t=this.viewpoint;W(t,t,e),this.viewpoint=t}get stationary(){return!(this.animation||this.navigating||this.resizing||this._stationaryTimer)}get updating(){return!this.destroyed&&(!this.layerViewManager||!this.labelManager||!this.graphicsView||!0===this.layerViewManager.updating||!0===this.labelManager.updating||!0===this.graphicsView.updating||this.allLayerViews.some((e=>!e.destroyed&&!("layerViews"in e)&&!0===e.updating)))}get viewpoint(){if(!this.ready)return this._get("viewpoint");const e=this.state.paddedViewState;return e&&e.viewpoint.clone()}set viewpoint(e){if(null==e)return;if(!this.ready)return this._set("viewpoint",e),this._set("extent",null),this._set("center",null),this._set("zoom",-1),this._set("scale",0),void this.notifyChange("initialExtentRequired");let t,s;try{t=this._project(e,this.spatialReference),!e.scale||isNaN(e.scale)?s=new n("mapview:invalid-viewpoint",`invalid scale value of ${e.scale}`):c(e.targetGeometry)&&(s=new n("mapview:invalid-viewpoint","geometry not defined"))}catch(a){s=new n("mapview:invalid-viewpoint","could not project the value in the view's spatial reference",{error:a})}if(s)return void he.error(s);this._scaleBeforeChangingSpatialReference=null;const r=new i({targetGeometry:new j,scale:0,rotation:0});B(r,t),this.constraints.constrain(r,this.state.paddedViewState.viewpoint),this.state.viewpoint=r,this.frameTask.requestFrame(),this._set("viewpoint",r)}get zoom(){return this.ready?this.constraints.scaleToZoom(this.scale):this._get("zoom")}set zoom(e){if(null==e)return;if(!this.ready){this._set("zoom",e),this._set("scale",0);const t=this._get("extent");return t&&(this._set("extent",null),this._set("center",t.center)),void this.notifyChange("initialExtentRequired")}if(!this.constraints.effectiveLODs)return void this._set("zoom",-1);const t=this.viewpoint;W(t,t,this.constraints.zoomToScale(e)),this.viewpoint=t,this._set("zoom",this.constraints.scaleToZoom(this.scale))}get navigating(){return!(!this.mapViewNavigation||!this.mapViewNavigation.interacting)}goTo(e,t){if(e)return this.animation&&(this.animation=null),this._createAnimation(),m((()=>this.ready),t).then((()=>{const i={animate:!0,...t},s=H(e,this);return this.animation.update(s),this._gotoTask={},i.animate?this._gotoAnimated(s,i):this._gotoImmediate(s,i)}));he.error("#goTo()","target cannot be null or undefined")}async hitTest(e,t){const i=ne(e)?ae(this,e):e;if(!this.ready||isNaN(i.x)||isNaN(i.y))return{screenPoint:i,results:[]};let s=new Set,r=!1,n=null,a=null;null!=t&&t.include?Te(t.include,je(this,(e=>s.add(e)),(e=>{n||(n=new Set),n.add(e)}),(e=>s.add(e)),(()=>r=!0))):(r=!0,s=new Set(this.allLayerViews)),null!=t&&t.exclude&&Te(t.exclude,je(this,(e=>s.delete(e)),(e=>{a||(a=new Set),a.add(e)})));const o=this.allLayerViews.filter((e=>!e.suspended&&s.has(e))).reverse(),l=this.toMap(i);let h=(await Promise.all([r?this.graphicsView.hitTest(l):null,...o.map((e=>e.hitTest(l,i)))])).filter(p).flat();return n&&(h=h.filter((e=>n.has(Se(e))))),a&&(h=h.filter((e=>!a.has(Se(e))))),{screenPoint:i,results:h.map((e=>({mapPoint:l,graphic:e})))}}async takeScreenshot(e){const t=this._createScreenshotPlan(e),i=await this._stage.takeScreenshot(t);return te(i,{format:t.format,quality:t.quality,rotation:0,disableDecorations:!1},this._pixelFormat)}async _takeScreenshot(e){const t=this._createScreenshotPlan(e),i=await this._stage.takeScreenshot(t);return ie(i,this._pixelFormat)}_createScreenshotPlan(e){e=e||{};const t=this.supersampleScreenshotsEnabled?Math.min(4,se(this.size,Math.min(4096,this._stage.context.parameters.maxTextureSize))):1;let i;e.layers?(i=[],e.layers.forEach((e=>{const t=this.allLayerViews.find((t=>t.layer.id===e.id));t&&"container"in t&&t.container&&i.push(t.container)}))):i=this._stage.children;const{format:s,quality:r}=re(e.format,e.quality);return ee(e,t,this.size,this.padding,s,r,i,e.rotation)}get test(){return{takeScreenshot:e=>this._takeScreenshot(e)}}toMap(e){if(!this.ready)return null;const t=ne(e)?ae(this,e):e,i=[0,0],[s,r]=this.state.toMap(i,[t.x,t.y]),n=this.spatialReference;return new j({x:s,y:r,spatialReference:n})}toScreen(e){if(!this.ready)return null;const t=this._project(e,this.spatialReference),i=[t.x,t.y];return this.state.toScreen(i,i),w(i[0],i[1])}on(e,t,i,s){const r=this.inputManager&&this.viewEvents.on(e,t,i,s);return r||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}whenLayerView(e){return super.whenLayerView(e)}graphicChanged(e){if(this.graphicsView){this.graphicsView.graphicUpdateHandler(e)}}whenReady(){return new Promise((e=>{this.ready?e(this):this._resolveWhenReady.push(e)}))}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){var e,t,i;return this.map&&"initialViewProperties"in this.map&&(null==(e=this.map)||null==(t=e.initialViewProperties)?void 0:t.spatialReference)||(null==(i=this.defaultsFromMap)?void 0:i.spatialReference)||null}hasLayerViewModule(e){return N.hasLayerViewModule(e)}importLayerView(e){return N.importLayerView(e)}pixelSizeAt(){return this.ready?this.state.resolution:(he.error("#pixelSizeAt()","Map view cannot be used before it is ready"),null)}popupHitTest(e){return this.hitTest(e).then((t=>({...t,mapPoint:this.toMap(e)})))}requestUpdate(){this.ready&&this.frameTask.requestUpdate()}validate(){let e=oe(this.type);return a("safari")&&a("safari")<9&&(e=new n("mapview:browser-not-supported","This browser is not supported by MapView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:a("safari")})),p(e)?(he.warn("#validate()",e.message),Promise.reject(e)):we()}_createAnimation(){return this.animation&&!this.animation.done||(this.animation=new C),this.animation}_cancellableGoTo(e,t,i){const s=()=>e===this._gotoTask,r=i.then((()=>{s()&&(this.animation=null)})).catch((e=>{throw s()&&(this.animation=null,t.done||(t.stop(),this.frameTask.animationInProgress=!1)),e})),n=new Promise((e=>e(r)));return t.when().catch((()=>{s()&&n.cancel&&n.cancel()})),n}_gotoImmediate(e,t){const i=this._gotoTask,s=this.animation,r=e.then((e=>{if(d(t),i!==this._gotoTask)throw new n("view:goto-interrupted","Goto was interrupted");this.viewpoint=s.target=e,s.finish()}));return this._cancellableGoTo(i,s,r)}_flipStationary(e){return null!==this._stationaryTimer||(this._stationaryTimer=setTimeout((()=>{this._stationaryTimer=null;const e=performance.now()-this._lastStationaryEventTimestamp;e<ye&&(this._stationaryTimer=this._flipStationary(e))}),e)),this._stationaryTimer}_getDefaultViewpoint(){var e,t,s,r;const{constraints:n,initialExtent:a,map:o}=this;if(!n)return null;const l=o&&"initialViewProperties"in o&&o.initialViewProperties,c={zoom:this._get("zoom"),scale:this._get("scale"),center:this._get("center"),extent:this._get("extent"),rotation:this._get("rotation"),viewpoint:this._get("viewpoint"),spatialReference:this._userSpatialReference};n.effectiveLODs?-1!==c.zoom&&(c.scale=n.zoomToScale(c.zoom)):c.zoom=-1;let d=null,u=null,m=0;const g=c.viewpoint&&c.viewpoint.rotation,f=c.viewpoint&&c.viewpoint.targetGeometry;p(f)&&("extent"===f.type?d=f:"point"===f.type&&(u=f,m=c.viewpoint.scale));const w=c.extent||d||(null==(e=h(null==l||null==(t=l.viewpoint)?void 0:t.targetGeometry))?void 0:e.extent)||a,y=c.center||u||(null==w?void 0:w.center),v=c.scale||m||(null==l||null==(s=l.viewpoint)?void 0:s.scale)||w&&$(w,this.size),_=c.rotation||g||(null==l||null==(r=l.viewpoint)?void 0:r.rotation)||0;return y&&v?new i({targetGeometry:y,scale:v,rotation:_}):null}_gotoAnimated(e,t){const i=this._gotoTask,s=this.animation,r=e.then((e=>{if(d(t),i!==this._gotoTask)throw new n("view:goto-interrupted","Goto was interrupted");return s.update(e),this.animationManager.animate(s,this.viewpoint,t),s.when().then((()=>{}),(()=>{}))}));return this._cancellableGoTo(i,s,r)}_project(e,t){var i;const s=e&&e.targetGeometry||e;if(!t)return e;if(!s)return null;if(t.imageCoordinateSystem||null!=(i=s.spatialReference)&&i.imageCoordinateSystem)return e;if(M(t,s.spatialReference))return e;const r=b(s,t);if(!r)throw new n("mapview:projection-not-possible","projecting input geometry to target spatial reference returned a null value",{geometry:s,spatialReference:t});return ve(e)?(e.targetGeometry=r,e):r}_resizeHandler(e){if(!this.ready)return;const t=this.state;let i=this.state.paddedViewState.viewpoint;const s=this.state.paddedViewState.size.concat();t.size=[e.width,e.height],J(i,i,s,this.state.paddedViewState.size,this.resizeAlign),i=this.constraints.constrain(i,null),this.state.viewpoint=i}_startup(){var e;this.timeline.begin("MapView Startup");const t=this._getDefaultViewpoint(),i=t.targetGeometry;try{this._project(t,this.spatialReference)}catch(p){var s;he.warn(new y("mapview:startup-projection-error","projection of initial viewpoint to the view's spatial reference, defaulting to the initial viewpoint.",{center:i.toJSON(),spatialReference:this.spatialReference,error:p})),t.targetGeometry=(null==(s=this.defaultsFromMap.extent)?void 0:s.center)||new j({x:0,y:0,spatialReference:this.spatialReference})}null==(e=this.constraints)||e.fit(t),this._set("state",new D({padding:this._get("padding"),size:this.size,viewpoint:t})),this.graphics.owner=this;const r=new ce(this.surface,{canvas:this.renderCanvas,supersampleScreenshots:this.supersampleScreenshotsEnabled,contextOptions:{disabledExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions},renderingOptions:this.renderingOptions,timeline:this.timeline});this._stage=r,this._magnifierView=new fe,this._magnifierView.magnifier=this.magnifier;const n=new me({view:this});this._set("labelManager",n);const a=new E({view:this});this._set("animationManager",a);const o=new ge({view:this,animationManager:a});this._set("mapViewNavigation",o),this._setupSpatialReferenceDependentProperties(),this.handles.add([this.rootLayerViews.on("change",(()=>this._updateStageChildren())),r.on("post-render",(()=>this._set("rendering",r.renderRequested))),r.on("will-render",(()=>this._set("rendering",r.renderRequested))),r.on("webgl-error",(e=>this.fatalError=e.error)),u((()=>this.stationary),(e=>r.stationary=e),f),u((()=>this.background),(e=>{r.background=e,this._magnifierView.background=e}),f),u((()=>this.magnifier),(e=>this._magnifierView.magnifier=e),f),u((()=>this.renderingOptions),(e=>r.renderingOptions=e),f),u((()=>this.highlightOptions),(e=>r.highlightOptions=e),f),u((()=>this.state.id),(()=>r.state=this.state),f)],"map-view"),this._updateStageChildren();const l=this._resolveWhenReady;this._resolveWhenReady=[],l.forEach((e=>e(this))),this.timeline.end("MapView Startup"),this.frameTask&&this.frameTask.start(),this._set("ready",!0)}_teardown(){this._destroySpatialReferenceDependentProperties(),this.handles.remove("map-view"),this.mapViewNavigation.destroy(),this._set("mapViewNavigation",null),this.animationManager.destroy(),this._set("animationManager",null),this.layerViewManager.clear(),this.labelManager.destroy(),this._magnifierView.destroy(),this._stage.destroy(),this._stage=null,this._set("graphicsView",null),this._magnifierView=null,this._set("labelManager",null),this._set("mapViewNavigation",null),this.graphics.owner=null,this.frameTask&&this.frameTask.stop(),this._stationaryTimer&&(clearTimeout(this._stationaryTimer),this._stationaryTimer=null),this._set("ready",!1);const{center:[e,t],spatialReference:i,rotation:s,scale:r}=this.state.paddedViewState,n=new j({x:e,y:t,spatialReference:i});this._set("viewpoint",null),this._set("extent",null),this._set("center",n),this._set("zoom",-1),this._set("rotation",s),this._set("scale",r),this._set("spatialReference",i),this._set("state",null),this.animation=null}_updateStageChildren(){this._stage.removeAllChildren(),this.rootLayerViews.forEach((e=>{this._stage.addChild(e.container)}));const e=this.graphicsView;this._stage.addChild(e.container),this._stage.addChild(this._magnifierView)}_setupSpatialReferenceDependentProperties(){const e=new F(O.create({spatialReference:this.spatialReference,size:512,numLODs:36}));this._set("featuresTilingScheme",e);const t=new de({view:this,graphics:this.graphics,requestUpdateCallback:()=>this.requestUpdate(),container:new ue(e)});this.frameTask.graphicsView=t,this._set("graphicsView",t)}_destroySpatialReferenceDependentProperties(){const e=this.graphicsView;this._set("graphicsView",null),this.frameTask.graphicsView=null,e.destroy(),this._set("featuresTilingScheme",null)}_spatialReferenceChanged(e){if(!this.ready)return;this.frameTask.stop();for(const i of this.allLayerViews)i.processDetach();this._destroySpatialReferenceDependentProperties();const t=this.state.paddedViewState.clone();if(c(this._scaleBeforeChangingSpatialReference))this._scaleBeforeChangingSpatialReference=t.scale;else{const e=t.viewpoint.clone();e.scale=this._scaleBeforeChangingSpatialReference,t.viewpoint=e}const s=t.clone(),[r,n]=t.center;let o=null;try{o=this._project(new j({x:r,y:n,spatialReference:t.spatialReference}),e)}catch(p){x()||he.warn(new y("mapview:spatial-reference-change","could not project the view's center to the new spatial reference",{center:o.toJSON(),spatialReference:e,error:p}))}o||(o=new j({x:0,y:0,spatialReference:e}));const l=U(new i({targetGeometry:new j,scale:0,rotation:0}),t.viewpoint,o);s.viewpoint=l;try{const i=20,r=[t.size[0]/2,t.size[1]/2],n=[r[0]+i,r[1]],o=t.toMap([0,0],n),{x:p,y:h}=this._project(new j({x:o[0],y:o[1],spatialReference:t.spatialReference}),e);o[0]=p,o[1]=h,s.toScreen(o,o);const c=Q(r,o,n),d=Math.hypot(o[0]-r[0],o[1]-r[1])/i;!Number.isFinite(d)||Math.abs(d)>4?(l.rotation=0,l.targetGeometry=new j({x:0,y:0,spatialReference:e})):(l.scale*=d,l.scale>a("mapview-srswitch-adjust-rotation-scale-threshold")?l.rotation=0:l.rotation+=Number.isFinite(c)?c:0)}catch{}this._get("constraints").constrain(l,null),this._get("state").viewpoint=l,this._stage.state=this.state,this._setupSpatialReferenceDependentProperties();for(const i of this.allLayerViews)i.processAttach();this.frameTask.requestFrame(),this.frameTask.start(),this._updateStageChildren()}};e([_({readOnly:!0})],_e.prototype,"animationManager",void 0),e([_({constructOnly:!0})],_e.prototype,"deactivatedWebGLExtensions",void 0),e([_({constructOnly:!0})],_e.prototype,"debugWebGLExtensions",void 0),e([_({readOnly:!0})],_e.prototype,"featuresTilingScheme",void 0),e([_({readOnly:!0})],_e.prototype,"fullOpacity",void 0),e([_({readOnly:!0})],_e.prototype,"graphicsTileStore",null),e([_()],_e.prototype,"graphicsView",void 0),e([_({readOnly:!0})],_e.prototype,"state",void 0),e([_()],_e.prototype,"initialExtentRequired",null),e([_()],_e.prototype,"labelManager",void 0),e([_({readOnly:!0})],_e.prototype,"resourceManager",null),e([_({readOnly:!0})],_e.prototype,"textureManager",null),e([_({readOnly:!0})],_e.prototype,"mapViewNavigation",void 0),e([_({constructOnly:!0})],_e.prototype,"renderCanvas",void 0),e([_()],_e.prototype,"renderingOptions",void 0),e([_({readOnly:!0})],_e.prototype,"rendering",void 0),e([_({constructOnly:!0})],_e.prototype,"supersampleScreenshotsEnabled",void 0),e([_({readOnly:!0})],_e.prototype,"supportsGround",void 0),e([_()],_e.prototype,"_stationaryTimer",void 0),e([_()],_e.prototype,"_defaultsFromMapSettings",null),e([_()],_e.prototype,"_pePromise",void 0),e([_({readOnly:!0})],_e.prototype,"typeSpecificPreconditionsReady",null),e([_()],_e.prototype,"animation",null),e([_({type:pe})],_e.prototype,"background",null),e([_({value:null,type:j,dependsOn:["state.id","ready"]})],_e.prototype,"center",null),e([_({type:q})],_e.prototype,"constraints",null),e([_({value:null,type:S,dependsOn:["state.id","ready"]})],_e.prototype,"extent",null),e([_()],_e.prototype,"floors",void 0),e([_({type:Y})],_e.prototype,"highlightOptions",void 0),e([_({readOnly:!0})],_e.prototype,"inputManager",void 0),e([_()],_e.prototype,"map",void 0),e([_({value:{top:0,right:0,bottom:0,left:0},cast:e=>({top:0,right:0,bottom:0,left:0,...e})})],_e.prototype,"padding",null),e([_()],_e.prototype,"resizeAlign",void 0),e([_({readOnly:!0,dependsOn:["state.id"]})],_e.prototype,"resolution",null),e([_({value:0,type:Number,dependsOn:["state.id","ready"]})],_e.prototype,"rotation",null),e([_({value:0,type:Number,dependsOn:["state.id","ready"]})],_e.prototype,"scale",null),e([_({constructOnly:!0})],_e.prototype,"spatialReferenceLocked",void 0),e([_()],_e.prototype,"stationary",null),e([_({type:X,readOnly:!0})],_e.prototype,"timeline",void 0),e([_({readOnly:!0})],_e.prototype,"type",void 0),e([_({readOnly:!0})],_e.prototype,"updating",null),e([_({value:null,type:i,dependsOn:["state.id","ready"]})],_e.prototype,"viewpoint",null),e([_({value:-1,dependsOn:["state.id"]})],_e.prototype,"zoom",null),e([_({type:Boolean})],_e.prototype,"navigating",null),e([_({type:le})],_e.prototype,"ui",void 0),_e=e([V("esri.views.MapView")],_e);const Ve=_e;function Se(e){const t=e.getObjectId();var i,s,r,n;return t?`${null!=(i=null!=(s=null==(r=e.layer)?void 0:r.uid)?s:null==(n=e.sourceLayer)?void 0:n.uid)?i:"MapView"}/${t}`:`"MapView/${e.uid}`}function je(e,i,s,r,n){return a=>{if(a instanceof t){if(a.layer===e)null==n||n();else{const t=e.allLayerViews.find((e=>e.layer===a.layer));t&&(null==r||r(t))}s(Se(a))}else{const t=e.allLayerViews.find((e=>e.layer===a));t&&i(t)}}}function Te(e,t){if(e)if(o(e))for(const i of e)if(o(i))for(const e of i)t(e);else t(i);else t(e)}export{Ve as default};
|
package/views/SceneView.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.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../Camera.js";import"../geometry.js";import i from"../Graphic.js";import r from"../Ground.js";import s from"../Viewpoint.js";import n from"../core/Collection.js";import{byId as a}from"../core/domUtils.js";import o from"../core/Error.js";import{on as l}from"../core/events.js";import{handlesGroup as p,makeHandle as h}from"../core/handleUtils.js";import d from"../core/has.js";import{isIterable as c}from"../core/iteratorUtils.js";import u from"../core/Logger.js";import{destroyMaybe as g,isNone as m,isSome as f,unwrapOr as y}from"../core/maybe.js";import{ObservableChangesType as w}from"../core/ObservableChangesType.js";import{throwIfAborted as v}from"../core/promiseUtils.js";import{on as _,initial as b,syncAndInitial as M,whenOnce as S,watch as R}from"../core/reactiveUtils.js";import{setFrameDuration as V}from"../core/scheduling.js";import{screenPointObjectToArray as T,createScreenPoint as C,createScreenPointArray as O}from"../core/screenUtils.js";import{initialize as x}from"../core/workers/workers.js";import{property as E}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import{cast as j}from"../core/accessorSupport/decorators/cast.js";import{subclass as P}from"../core/accessorSupport/decorators/subclass.js";import{ensureType as I}from"../core/accessorSupport/ensureType.js";import{c as G}from"../chunks/vec3f64.js";import{owningCollectionProperty as L}from"../core/support/OwningCollection.js";import H from"../geometry/HeightModelInfo.js";import{canProjectWithoutEngine as U,project as A,projectPointToVector as D,projectVectorToVector as F,projectBoundingRect as W}from"../geometry/projection.js";import{create as q,toExtent as z}from"../geometry/support/aaBoundingRect.js";import{B as k,a as N}from"../chunks/boundedPlane.js";import{renderSRFromViewSR as B}from"../geometry/support/coordinateSystem.js";import{getResolutionForScale as Q}from"../geometry/support/scaleUtils.js";import $ from"../layers/VoxelWasmManager.js";import{isImageryTileLayer as X,isTiledLayer as Z,isVoxelLayer as J}from"../layers/support/layerUtils.js";import{AnalysesCollection as K}from"../support/AnalysesCollection.js";import{BreakpointsOwner as Y}from"./BreakpointsOwner.js";import{DOMContainer as ee}from"./DOMContainer.js";import te from"./GroundView.js";import{PopupView as ie}from"./PopupView.js";import re from"./View.js";import se from"./ViewAnimation.js";import{ViewingMode as ne,stringFromViewingMode as ae,viewingModeFromString as oe}from"./ViewingMode.js";import{layerView3DImporter as le}from"./3d/layerViewModuleImportUtils.js";import pe from"./3d/analysis/AnalysisViewManager3D.js";import{Constraints as he}from"./3d/constraints/Constraints.js";import de from"./3d/environment/SceneViewEnvironment.js";import{SceneViewEnvironmentManager as ce}from"./3d/environment/SceneViewEnvironmentManager.js";import ue from"./3d/input/SceneInputManager.js";import{GraphicsDeconflictor as ge}from"./3d/layers/graphics/GraphicsDeconflictor.js";import{Labeler as me}from"./3d/layers/graphics/Labeler.js";import{ObjectResourceCache as fe}from"./3d/layers/graphics/ObjectResourceCache.js";import{FeatureTileTree3D as ye}from"./3d/layers/support/FeatureTileTree3D.js";import we from"./3d/state/ViewState.js";import ve from"./3d/state/ViewStateManager.js";import{SceneIntersectionHelper as _e}from"./3d/state/helpers/SceneIntersectionHelper.js";import{CombinedElevationProvider as be}from"./3d/support/CombinedElevationProvider.js";import Me from"./3d/support/debugFlags.js";import Se from"./3d/support/DisplayQualityProfile.js";import{getElevationAtPoint as Re}from"./3d/support/ElevationProvider.js";import Ve from"./3d/support/HighlightOptions.js";import{MapCoordsHelper as Te}from"./3d/support/MapCoordsHelper.js";import{PropertiesPool as Ce}from"./3d/support/PropertiesPool.js";import Oe from"./3d/support/QualitySettings.js";import{RenderCoordsHelper as xe}from"./3d/support/RenderCoordsHelper.js";import{newResourceController as Ee}from"./3d/support/ResourceController.js";import je from"./3d/support/SceneViewPerformanceInfo.js";import{SharedSymbolResources as Pe}from"./3d/support/SharedSymbolResources.js";import{PointsOfInterest as Ie}from"./3d/support/pointsOfInterest/PointsOfInterest.js";import Ge from"./3d/terrain/TerrainSurface.js";import{isSurfaceLayerView as Le,getTiledLayerInfo as He,checkIfTileInfoSupportedForView as Ue}from"./3d/terrain/terrainUtils.js";import{Stage as Ae}from"./3d/webgl-engine/Stage.js";import{newIntersector as De,DEFAULT_TOLERANCE as Fe}from"./3d/webgl-engine/lib/Intersector.js";import{StoreResults as We,IntersectorType as qe}from"./3d/webgl-engine/lib/IntersectorInterfaces.js";import{isValidIntersectorResult as ze}from"./3d/webgl-engine/lib/intersectorUtils.js";import{toGraphic as ke,toOwner as Ne}from"./3d/webgl-engine/lib/intersectorUtilsConversions.js";import{TERRAIN_ID as Be}from"./3d/webgl-engine/lib/verticalOffsetUtils.js";import{hitTestSelectSimilarDistance as Qe}from"./support/hitTestSelectUtils.js";import{occludeesSupported as $e}from"./support/layerViewUtils.js";import{toRenderSettings as Xe,screenshotSuperSampleSettings as Ze}from"./support/screenshotUtils.js";import{isSupportedScreenPointEvent as Je,createScreenPointFromSupportedEvent as Ke}from"./support/screenUtils.js";import{isSpatialReferenceSupported as Ye}from"./support/spatialReferenceSupport.js";import{check as et}from"./support/WebGLRequirements.js";import tt from"./ui/3d/DefaultUI3D.js";import it from"../webscene/Environment.js";import rt from"../geometry/Extent.js";import st from"../geometry/SpatialReference.js";import nt from"../geometry/Point.js";const at=u.getLogger("esri.views.SceneView");let ot=class extends(Y(ee(ie(re)))){constructor(e){super(e),this._userClippingArea=null,this._clippingArea=null,this._initialDefaultSpatialReference=null,this._defaults={},this._externallySet={environment:!1},this._createGraphicsViewController=null,this._resolveWhenReady=[],this.propertiesPool=new Ce({slicePlane:k},this),this._resourceController=Ee(this),this._defaultToMapOptions={include:new Set},this._defaultHitTestOptions={exclude:new Set},this.deconflictor=new ge({view:this}),this.labeler=new me({view:this,deconflictor:this.deconflictor.labels}),this.sharedSymbolResources=null,this.analyses=new K,this.basemapTerrain=null,this.elevationProvider=null,this.camera=null,this.canvas=null,this.center=null,this.constraints=new he,this.environmentManager=new ce,this.extent=null,this.floors=new n,this.fullOpacity=1,this.graphicsView=null,this.analysisViewManager=new pe({view:this}),this.groundView=null,this.navigating=!1,this.map=null,this.screenSizePerspectiveEnabled=!0,this.state=new we,this.scale=null,this.spatialReference=null,this.alphaCompositingEnabled=!1,this.supersampleScreenshotsEnabled=!0,this.type="3d",this.ui=new tt,this._numUpdating=0,this._lastUpdateTime=0,this.updatingProgress=.5,this.viewpoint=null,this.zoom=null,this.highlightOptions=new Ve,x(),e&&e.environment||(this._defaults.environment=new de,this.environment=this._defaults.environment);const t=(e=null)=>{f(e)&&e.type===w.MOVE||(this._updatingChanged(),this.map&&this.map.allLayers.forEach((async e=>{try{await e.when()}catch{}this._updatingChanged()})))};this.handles.add([_((()=>{var e;return null==(e=this.map)?void 0:e.allLayers}),"after-changes",(e=>t(e)),{onListenerAdd:()=>t(),onListenerRemove:()=>t(),sync:!0}),this.allLayerViews.on("after-changes",(e=>this._updateUpdatingMonitors(e))),this.watch("map",(e=>{e&&e.load&&e.load().catch((()=>{}))}))]),this.inputManager=new ue({view:this}),this.stateManager=new ve({view:this})}initialize(){this.groundView=new te({view:this}),this._updateUpdatingMonitors();const e=()=>this._updateDefaultToMapOptions();this.handles.add(_((()=>{var e;return null==(e=this.map)?void 0:e.allLayers}),"after-changes",e,{onListenerAdd:e,onListenerRemove:e})),this.updatingHandles.add((()=>this.qualitySettings.memoryLimit),(e=>{this.resourceController&&(this.resourceController.memoryController.maxMemory=e)}),b),this.updatingHandles.add((()=>this.qualitySettings.additionalCacheMemory),(e=>{this.resourceController&&(this.resourceController.memoryController.additionalCacheMemory=e)}),b),this.updatingHandles.add((()=>this.qualitySettings.frameRate),(e=>V(e>0?1e3/Math.ceil(e):0)),b),this.updatingHandles.add((()=>{var e;return null==(e=this.map)?void 0:e.ground}),e,M),this.updatingHandles.add((()=>{var e,t;return null==(e=this.map)||null==(t=e.ground)?void 0:t.opacity}),(()=>this._updateDefaultHitTestOptions()),M),this.handles.add(this.watch("spatialReference",(()=>this.notifyChange("clippingArea")),!0))}destroy(){this.destroyed||(this.invalidate(),this.activeTool=null,this.layerViewManager.clear(),this._exitSurface(),this._disposeGraphicsView(),this.sharedSymbolResources=g(this.sharedSymbolResources),this.labeler.destroy(),this._set("labeler",null),this.deconflictor.destroy(),this._set("deconflictor",null),this._resourceController=g(this._resourceController),this.stateManager.destroy(),this._set("stateManager",null),this.inputManager.destroy(),this._set("inputManager",null),this.propertiesPool.destroy(),this.handles.remove("updatingMonitors"),this.environmentManager.destroy(),this._set("environmentManager",null),this.groundView=g(this.groundView))}get renderSpatialReference(){return this.renderCoordsHelper&&this.renderCoordsHelper.spatialReference}get basemapSpatialReference(){return this.basemapTerrain&&this.basemapTerrain.spatialReference}installContentCameraReset(e={sticky:!1}){return this.stateManager.installContentCameraReset(e)}get clippingArea(){if("global"===this.viewingMode)return null;let e=this._userClippingArea||this.get("map.clippingArea");return!(!!this._userClippingArea||this.get("map.clippingEnabled"))||m(e)?(this._clippingArea=null,null):e instanceof rt?this.spatialReference&&(e=ht(e,this.spatialReference),m(e))?(at.error("#clippingArea","setting clippingArea with incompatible SpatialReference"),this._clippingArea):(e=e.clone(),m(e.intersection(this.groundAndLayersExtent))&&(e.xmin=e.xmax,e.ymin=e.ymax),e.zmin=void 0,e.zmax=void 0,e.equals(this._clippingArea)||(this._clippingArea=e),this._clippingArea):(at.error("#clippingArea","only clippingArea geometries of type Extent are supported"),this._clippingArea)}set clippingArea(e){this.ready&&"global"===this.viewingMode&&f(e)?at.error("#clippingArea=","Clipping area is only supported in local viewingMode"):this._userClippingArea=e}get renderDataExtent(){if(this.state.viewingMode===ne.Global)return null;const e=this.renderSpatialReference,t=this.dataExtent;return m(t)||m(e)||t.spatialReference.equals(e)?t:ht(t,e)}get dataExtent(){let e=this.groundAndLayersExtent;const t=this.spatialReference||st.WGS84,i=ht(this.clippingArea,t);f(i)&&(e=f(e)?e.intersection(i):i);const r=this._get("dataExtent");return f(e)&&e.equals(r)?r:e}get groundAndLayersExtent(){const e=this.spatialReference||st.WGS84;let t;const i=i=>{const r=ht(i,e);m(r)||(f(t)?t.union(r):t=r.clone())},r=this.basemapTerrain;if(null!=r&&r.spatialReference){const e=r.groundExtent;i(new rt({xmin:e[0],ymin:e[1],zmin:0,xmax:e[2],ymax:e[3],zmax:0,spatialReference:r.spatialReference}))}if(this.map){const e=e=>{!f(e.fullExtent)||"graphics"===e.type&&e.internal||i(e.fullExtent)};this.map.allLayers.forEach((t=>e(t)))}if(m(t))return null;t.hasZ?(t.zmin=Math.min(0,t.zmin),t.zmax=Math.max(0,t.zmax)):(t.zmin=0,t.zmax=0);const s=this._get("groundAndLayersExtent");return t.equals(s)?s:t}set environment(e){e!==this._defaults.environment&&(this._externallySet.environment=!0),this._set("environment",e)}castEnvironment(e){return e?e instanceof de?e:e instanceof it?null!=this.environment?this.environment.cloneWithWebsceneEnvironment(e):de.fromWebsceneEnvironment(e):I(de,e):new de}get initialExtentRequired(){return this.stateManager&&!this.stateManager.hasInitialView}get _defaultsFromMapSettings(){return{required:{tileInfo:!1,heightModelInfo:!0,extent:!1}}}get interacting(){return this.navigating||f(this.activeTool)}get stationary(){return!this.animation&&!this.resizing&&(m(this.state)||this.state.stationary)}set qualityProfile(e){Se.isValidProfile(e)&&(Se.apply(e,this.qualitySettings),this._set("qualityProfile",e))}get qualityProfile(){return this._get("qualityProfile")||Se.getDefaultProfile()}set slicePlane(e){if(f(this._stage)&&this._stage.renderView.setRenderParameters({slicePlane:e}),m(e))return void this._set("slicePlane",null);const t=this.propertiesPool.get("slicePlane");N(e,t),this._set("slicePlane",t)}get typeSpecificPreconditionsReady(){return!!this.viewingMode}get resolution(){return null!=this.spatialReference?Q(this.scale,this.spatialReference):0}get heightModelInfo(){const e=this.getDefaultHeightModelInfo();return null!=e?H.deriveUnitFromSR(e,this.spatialReference):null}get updating(){var e,t,i;if(this.destroyed)return!1;let r=0,s=this.layerViewManager.updating,n=s?this.layerViewManager.updatingRemaining:0;this.allLayerViews.forEach((e=>{if(e.isFulfilled()){if(e.updating){if(s=!0,e.suspended||Le(e))return;++n,r+=e.updatingProgress}}else++n}));for(const a of[this.graphicsView,this.basemapView,this._resourceController,this._stage,this.featureTiles,this.pointsOfInterest,this.environmentManager,this.overlay,this.featureTreeDebugger,this.toolViewManager,this.analysisViewManager])if(f(a)&&a.updating){const e=.1;n+=e,r+=.5*e}for(const a of[this.deconflictor,this.labeler,this.basemapTerrain])f(a)&&a.updating&&(++n,r+=a.updatingProgress);if(s=!!(s||n>0||this.updatingHandles.updating||!this.ready||!this.stationary||this._createGraphicsViewController||null!=(e=this.inputManager)&&e.hasPendingInputs||null!=(t=this.map)&&null!=(i=t.allLayers)&&i.some((e=>!e.isFulfilled()))),s?(this._numUpdating=Math.max(n,this._numUpdating),r+=this._numUpdating-n):this._numUpdating=0,this._numUpdating>0?r/=this._numUpdating:r=s?0:1,this._get("updatingProgress")!==r){const e=this._resourceController.scheduler.now;if(r<1){const t=Math.min((e-this._lastUpdateTime)/2e3,1);r=this.updatingProgress*(1-t)+r*t}this._set("updatingProgress",r),this._lastUpdateTime=s&&r<1?e:0}return s}get viewingMode(){var e;const t=this._predeterminedViewingMode;if(f(t))return ae(t);const i=this.spatialReference;return i?f(null==(e=this.defaultsFromMap)?void 0:e.viewingMode)&&i.equals(this.defaultsFromMap.spatialReference)?ae(this.defaultsFromMap.viewingMode):Ye(i,ne.Global)?"global":"local":"global"}set viewingMode(e){this.ready?at.error("#viewingMode","viewingMode cannot be set once view is ready"):e?this._override("viewingMode",e):void 0===e&&this._clearOverride("viewingMode")}get resourceController(){return this._resourceController}get performanceInfo(){return new je(this)}forceAnimationTime(e){this._stage.renderView.forcedAnimationTime=this.basemapTerrain.overlayManager.forcedAnimationTime=e}on(e,t,i,r){const s=this.viewEvents.on(e,t,i,r);return s||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}toMap(e,t){if(!this.ready)return at.error("#toMap()","Scene view cannot be used before it is ready"),null;const i=t?this.externalToInternalIntersectOptions(t):this._defaultToMapOptions,r=f(i.graphics)&&(f(i.graphics.include)||f(i.graphics.exclude)),s=Je(e)?Ke(this,e):e,n=T(s);i.enableDraped=i.include&&!i.include.has(Be)||i.exclude&&i.exclude.has(Be);const a=this.sceneIntersectionHelper,o=De(this.state.viewingMode);if(o.options.selectionMode=!0,o.options.store=r?We.ALL:We.MIN,a.intersectIntersectorScreen(n,o,i),r){for(const e of o.results.all){const t=ke(e,this);if(m(t))return this._intersectResultToMapPoint(e);if(this._testGraphicUidFilter(i.graphics,t))return this._intersectResultToMapPoint(e)}return null}return this._intersectResultToMapPoint(o.results.min)}toScreen(e){if(!this.ready)return at.error("#toScreen()","Scene view cannot be used before it is ready"),null;const t=y(null==e.z&&Re(this.elevationProvider,e),0);return D(e,ct,this.renderSpatialReference,t),this.state.camera.projectToScreen(ct,ut),C(ut[0],ut[1])}pixelSizeAt(e){return this.ready?e?(D(e,ct,this.renderSpatialReference),this.state.camera.computeScreenPixelSizeAt(ct)):0:(at.error("#pixelSizeAt()","Scene view cannot be used before it is ready"),null)}overlayPixelSizeInMapUnits(e){const t=this.basemapTerrain.overlayManager;return t?t.overlayPixelSizeInMapUnits(e):1}hitTest(e,t){if(!this.ready)return at.error("#hitTest()","Scene view cannot be used before it is ready"),null;const i=Je(e)?Ke(this,e):e,r=O(i.x,i.y),s=t?this.externalToInternalIntersectOptions(t):this._defaultHitTestOptions;s.requiresGroundFeedback=!0,s.enableDraped=!0;const n=De(this.state.viewingMode);n.options.selectionMode=!0,n.options.store=We.ALL,this.sceneIntersectionHelper.intersectIntersectorScreen(r,n,s);const a=this._intersectResultsToHits(n.results.all,s.graphics),o=n.results.ground,l=Ne(o,this),p=f(l)&&"type"in l&&"integrated-mesh"===l.type?l:null,h={screenPoint:i,results:a,ground:{mapPoint:this._intersectResultToMapPoint(o),distance:ze(o)?o.distanceInRenderSpace:0,layer:p}};return Me.SCENEVIEW_HITTEST_RETURN_INTERSECTOR&&(h.intersector=n),Promise.resolve(h)}popupHitTest(e){return Qe(this,e).then((({results:t,ground:i})=>{let r=null;return!(0===t.length||Math.abs(y(t[0].distance,0)-i.distance)<1e-5)||i.layer&&"integrated-mesh"===i.layer.type||(r=i.mapPoint),{results:t,screenPoint:e,mapPoint:r}}))}goTo(e,t){return this.updatingHandles.addPromise(this.stateManager.goTo(e,t))}async whenAnalysisView(e){if(await this.whenReady(),m(e.parent))throw new o("view:no-analysisview-for-analysis","The analysis has not been added to view.analyses",{analysis:e});if("analysis"===e.parent.type){return(await this.whenLayerView(e.parent)).whenAnalysisView(e)}return this.analysisViewManager.whenAnalysisView(e)}whenLayerView(e){return super.whenLayerView(e)}takeScreenshot(e){return this.whenReady().then((()=>{const t=Xe(e,this);return t.pixelRatio/=this.state.pixelRatio,this._stage.renderView.takeScreenshot(Ze(t,this.supersampleScreenshotsEnabled,this.padding))}))}addUpdatingPromise(e){return this.updatingHandles.addPromise(e)}importLayerView(e){return le.importLayerView(e)}hasLayerViewModule(e){return le.hasLayerViewModule(e)}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){var e,t,i,r;return this.map&&"initialViewProperties"in this.map&&(null==(e=this.map)||null==(t=e.initialViewProperties)?void 0:t.spatialReference)||(null==(i=this.defaultsFromMap)?void 0:i.spatialReference)||(null==(r=this.defaultsFromMap)?void 0:r.ready)&&this._initialDefaultSpatialReference||null}async validate(){let e=et(this.type);if(d("safari")&&d("safari")<9&&(e=new o("sceneview:browser-not-supported","This browser is not supported by SceneView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:d("safari")})),f(e))throw at.warn("#validate()",e.message),e}get _predeterminedViewingMode(){var e,t;const i=this._isOverridden("viewingMode")?this._get("viewingMode"):null!=(e=this.map&&"initialViewProperties"in this.map?null==(t=this.map.initialViewProperties)?void 0:t.viewingMode:null)?e:null;return f(i)?oe(i):null}getSpatialReferenceSupport({spatialReference:e,layer:t}){const i=this._predeterminedViewingMode;if(f(i))return this._validateSpatialReferenceForViewingMode(e,t,i)?{constraints:this._makeSpatialReferenceConstraints(e,t,i)}:null;const r=this._validateSpatialReferenceForViewingMode(e,t,ne.Local),s=this._validateSpatialReferenceForViewingMode(e,t,ne.Global);return r||s?r&&s?{constraints:this._makeSpatialReferenceConstraints(e,t,null)}:r?{constraints:this._makeSpatialReferenceConstraints(e,t,ne.Local)}:{constraints:this._makeSpatialReferenceConstraints(e,t,ne.Global)}:null}_validateSpatialReferenceForViewingMode(e,t,i){return!!Ye(e,i)&&(!!m(t)||(!!X(t)||(!Z(t)||!m(He(t,e,i)))&&(!J(t)||i!==ne.Global)))}_makeSpatialReferenceConstraints(e,t,i){if(m(t))return[{spatialReference:e,viewingMode:i}];const r=e.isWebMercator,s=e.isWGS84;if(X(t)&&(r||s)){return!s||i===ne.Local||null===Ue(t.tileInfo,t.fullExtent,e,ne.Global)?[{spatialReference:e,viewingMode:i},{spatialReference:st.WebMercator,viewingMode:i}]:[{spatialReference:r?st.WGS84:st.WebMercator,viewingMode:i}]}return Z(t)||J(t)||!r&&!s?Z(t)&&r&&i!==ne.Global?[{spatialReference:e,viewingMode:i},{spatialReference:st.WGS84,viewingMode:ne.Local}]:[{spatialReference:e,viewingMode:i}]:[{spatialReference:e,viewingMode:i},{spatialReference:r?st.WGS84:st.WebMercator,viewingMode:i}]}_validateSpatialReference(e){const t=f(this.getSpatialReferenceSupport({spatialReference:e})),i=this._predeterminedViewingMode;return t||(f(i)?at.warnOnce(`Spatial reference defined on view not supported in ${ae(i)} viewing mode.`):e.isGeographic&&at.warnOnce("Spatial reference is geographic but not supported.")),t}whenReady(){return new Promise((e=>{this.ready?e(this):this._resolveWhenReady.push(e)}))}computeMapPointFromVec3d(e,t){let i=this.spatialReference||st.WGS84;return F(e,this.renderSpatialReference,e,i)||(i=st.WGS84,F(e,this.renderSpatialReference,e,i)),t?(t.x=e[0],t.y=e[1],t.z=e[2],t.spatialReference=i):t=new nt(e,i),t}trackGraphicState(e){if(!e.graphic)return at.error("trackGraphicState","GraphicState.graphic must not be null or undefined to start tracking"),null;const t=this.getViewForGraphic(e.graphic);let i=null,r=!1;const s=t=>{var s;!r&&f(t)&&"processor"in t&&"graphics-3d"===(null==(s=t.processor)?void 0:s.type)&&t.processor.graphicsCore&&(i=t.processor.graphicsCore.trackGraphicState(e))};return f(t)?s(t):this.whenViewForGraphic(e.graphic,{waitForLayer:!0}).then((e=>s(e)),(()=>{})).catch((()=>{})),{remove:()=>{r=!0,f(i)&&(i.remove(),i=null)}}}highlight(e){if(Array.isArray(e))return p(e.map((e=>this.highlight(e))));if(n.isCollection(e))return p(e.toArray().map((e=>this.highlight(e))));const t=this.getViewForGraphic(e);return t&&"highlight"in t?t.highlight(e):h()}maskOccludee(e){if(!e)return at.error("maskOccludee","GraphicState.graphic must not be null or undefined to mask an occludee"),null;const t=this.getViewForGraphic(e);let i=null,r=!1;const s=t=>{!r&&f(t)&&$e(t)&&(i=t.maskOccludee(e))};return f(t)?s(t):this.whenViewForGraphic(e,{waitForLayer:!0}).then((e=>s(e)),(()=>{})).catch((()=>{})),{remove:()=>{r=!0,f(i)&&(i.remove(),i=null)}}}getViewForGraphic(e){return e.layer===this.graphics?this.graphicsView:e.layer?this.allLayerViews.find((t=>t.layer===e.layer)):null}graphicChanged(e){f(this.graphicsView)&&this.graphicsView.graphicChanged(e)}async whenViewForGraphic(e,t){if(e.layer===this)return await S((()=>this.graphicsView)),this.graphicsView;if(!e.layer||!this.map)throw new o("no-view-for-graphic");return t&&t.waitForLayer&&!this.map.allLayers.includes(e.layer)?new Promise(((t,i)=>{const r=this.map.allLayers.on("change",(s=>{s.added.includes(e.layer)&&(r.remove(),this.whenLayerView(e.layer).then(t,i))}))})):this.whenLayerView(e.layer)}externalToInternalIntersectOptions(e){const t=this._externalToInternalRenderItems(e.include,dt.INCLUDE),i=this._externalToInternalRenderItems(e.exclude,dt.EXCLUDE);return{include:t.layerUids,exclude:i.layerUids,graphics:{include:t.graphicUids,exclude:i.graphicUids}}}_intersectResultToMapPoint(e,t){return e.getIntersectionPoint(ct)?(t=this.computeMapPointFromVec3d(ct,t),e.intersector===qe.TERRAIN&&this.basemapTerrain&&(t.z=y(Re(this.basemapTerrain,t),0)),t):null}_intersectResultsToHits(e,t){const i=new Array;let r=null;for(let s=0;s<e.length;s++){const n=e[s],a=Ne(n,this);if(f(a)&&(a===this.map.ground||"type"in a&&"integrated-mesh"===a.type))break;const o=ke(n,this);if(m(o))continue;if(m(r)&&s!==e.length-1&&(r=new Set),f(r)){const e=this._getGraphicFilterUid(o);if(r.has(e))continue;r.add(e)}if(!this._testGraphicUidFilter(t,o))continue;const l=this._intersectResultToMapPoint(n),p=n.distanceInRenderSpace;i.push({graphic:o,mapPoint:l,distance:p})}return i}_getGraphicFilterUid(e){if(e.layer&&"objectIdField"in e.layer){const t=e.attributes[e.layer.objectIdField];if(t)return`o-${e.layer.id}-${t}`}return`u-${e.uid}`}_testGraphicUidFilter(e,t){const i=this._getGraphicFilterUid(t);return m(e)||(m(e.include)||e.include.has(i))&&(m(e.exclude)||!e.exclude.has(i))}_externalToInternalRenderItems(e,t,s={layerUids:null,graphicUids:null}){if(!e)return s;if(e instanceof i)pt(s,this._getGraphicFilterUid(e)),t===dt.INCLUDE&&(f(this.graphicsView)&&e.layer===this?lt(s,this.graphicsView.processor.layer.id):e.layer&<(s,e.layer.uid));else if(c(e))for(const i of e)i===this.graphics&&f(this.graphicsView)?lt(s,this.graphicsView.processor.layer.id):i instanceof r?i===this.map.ground&<(s,Be):this._externalToInternalRenderItems(i,t,s);else lt(s,e.uid);return s}_initBasemapTerrain(){this._set("basemapTerrain",new Ge({view:this})),this._set("elevationProvider",new be({view:this})),this.elevationProvider.register("ground",this.basemapTerrain)}_exitBasemapTerrain(){this.basemapTerrain&&(this.elevationProvider.unregister(this.basemapTerrain),this.elevationProvider.destroy(),this._set("elevationProvider",null),this.basemapTerrain.destroy(),this._set("basemapTerrain",null))}_initGlobe(){this._initCoordinateSystem(),this.state.createInitialCamera(),this._initBasemapTerrain(),this._set("pointsOfInterest",new Ie({view:this})),this._set("featureTiles",new ye({renderCoordsHelper:this.renderCoordsHelper,cameraOnSurface:this.pointsOfInterest.contentCameraOnSurface,focus:this.pointsOfInterest.focus,tilingSchemeOwner:this.basemapTerrain,viewState:this.state,scheduler:this._resourceController.scheduler,terrain:this.basemapTerrain}));const e=()=>{const e=this.basemapTerrain&&this.basemapTerrain.extent;if(this.clippingArea||e)if(e&&this.basemapTerrain.spatialReference){const e=f(this.basemapTerrain.extent)?A(z(this.basemapTerrain.extent,this.basemapTerrain.spatialReference),this.spatialReference):null;f(this.clippingArea)?this.featureTiles.filterExtent=this.clippingArea.intersection(e):this.featureTiles.filterExtent=e}else this.featureTiles.filterExtent=this.clippingArea;else this.featureTiles.filterExtent=null};this.handles.add([this.updatingHandles.add((()=>Me.FEATURE_TILE_TREE_SHOW_TILES),(e=>{e&&this.featureTiles&&!this.featureTreeDebugger?this.updatingHandles.addPromise(import("./3d/layers/support/FeatureTileTree3DDebugger.js")).then((({FeatureTileTree3DDebugger:e})=>{!this.featureTreeDebugger&&Me.FEATURE_TILE_TREE_SHOW_TILES&&(this.featureTreeDebugger=new e({view:this}))})):e||!this.featureTreeDebugger||Me.FEATURE_TILE_TREE_SHOW_TILES||(this.featureTreeDebugger.destroy(),this.featureTreeDebugger=null)}),M),this.updatingHandles.add((()=>this.clippingArea),e,M),this.updatingHandles.add((()=>this.basemapTerrain.extent),e,M)],"feature-tiles"),this.stateManager.init()}_exitGlobe(){this.state&&(this.stateManager.deinit(),this.handles.remove("render-coords-helper"),this.handles.remove("feature-tiles"),this.featureTiles.destroy(),this._set("featureTiles",null),this.pointsOfInterest.destroy(),this._set("pointsOfInterest",null),this._exitBasemapTerrain(),this.state.exit(),this._exitCoordinateSystem())}_initCoordinateSystem(){if(this.spatialReference){const e=this.spatialReference;this.mapCoordsHelper&&this.mapCoordsHelper.spatialReference.equals(e)||this._set("mapCoordsHelper",new Te(this.map,e));const t=this.state.isGlobal,i=B(t,e);i!==this.renderSpatialReference&&(this._set("renderCoordsHelper",xe.create(this.state.viewingMode,i)),t||this.handles.add(this.watch("basemapTerrain.extent",(e=>{const t=this.renderCoordsHelper.spatialReference;0===e[0]&&0===e[1]&&0===e[2]&&0===e[3]||!W(e,this.basemapTerrain.spatialReference,gt,t)||(this.renderCoordsHelper.extent=gt)}),!0),"render-coords-helper"),this.sceneIntersectionHelper&&this.sceneIntersectionHelper.setTolerance(Fe/this.renderCoordsHelper.unitInMeters))}else this._set("mapCoordsHelper",null),this._set("renderCoordsHelper",null)}_exitCoordinateSystem(){this.mapCoordsHelper&&(this.handles.remove("render-coords-helper"),this._set("renderCoordsHelper",null),this._set("mapCoordsHelper",null))}_updatingChanged(){this.notifyChange("updating")}_updateUpdatingMonitors(e=null){f(e)&&e.type===w.MOVE||(this.handles.remove("updatingMonitors"),this.allLayerViews.forEach((e=>{e.destroyed||(this.handles.add([e.watch(["updating","updatingProgress"],(()=>this._updatingChanged()),!0)],"updatingMonitors"),e.when((()=>this._updatingChanged()),(()=>this._updatingChanged())))})),this._updatingChanged())}_renderScreenshotOverlay(e,t){if(!this.overlay||!this.overlay.hasVisibleItems)return t;const i=e.getContext("2d");return i.putImageData(t,0,0),this.overlay.renderCanvas(e),i.getImageData(0,0,t.width,t.height)}_initStage(){const e={deactivatedWebGLExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions,alpha:this.alphaCompositingEnabled,canvas:this.renderCanvas,screenshot:{renderOverlay:(e,t)=>this._renderScreenshotOverlay(e,t)}},t=new _e(this.state.viewingMode,(e=>this._stage.layers.forAll(e)),this);this._set("sceneIntersectionHelper",t);const i=a(this.surface),{resourceController:r,state:s,renderSpatialReference:n}=this;this._stage=new Ae({options:e,container:i,resourceController:r,state:s,sceneIntersectionHelper:t,renderSR:n}),this._stage.renderView.setRenderParameters({slicePlane:this.slicePlane}),this._lostWebGLContextHandle=l(this._stage.renderView.canvas,"webglcontextlost",(()=>this.fatalError=new o("webgl-context-lost"))),this.handles.add([this.updatingHandles.add((()=>this.qualitySettings.antialiasingEnabled),(()=>this._stage.renderView.setRenderParameters({antialiasingEnabled:this.qualitySettings.antialiasingEnabled})),b),this.updatingHandles.add((()=>this.qualitySettings.highQualityTransparency),(()=>this._stage.renderView.setRenderParameters({highQualityTransparency:this.qualitySettings.highQualityTransparency})),b),R((()=>this.magnifier),(e=>this._stage.renderView.magnifier=e),M)],"stage");const p=()=>{this._stage.renderView.setRenderParameters({defaultHighlightOptions:Ve.toEngineOptions(this.highlightOptions)})};this.handles.add(this.updatingHandles.add((()=>[this.highlightOptions.color,this.highlightOptions.haloColor,this.highlightOptions.haloOpacity,this.highlightOptions.fillOpacity,this.highlightOptions.shadowOpacity,this.highlightOptions.shadowColor,this.highlightOptions.shadowDifference]),p),"stage"),p(),this.renderCoordsHelper&&this.sceneIntersectionHelper.setTolerance(Fe/this.renderCoordsHelper.unitInMeters),this._set("canvas",this._stage.renderView.canvas)}_exitStage(){this._set("sceneIntersectionHelper",null),this._stage.destroy(),this._stage=null,this._lostWebGLContextHandle.remove(),this._lostWebGLContextHandle=null,this.handles.remove("stage"),this._set("canvas",null)}_initSurface(e){this._exitSurface(),this.state.init(e,this.spatialReference),this._initStage(),this._initGlobe(),this.sharedSymbolResources=new Pe({view:this,viewingMode:e,resourceController:this._resourceController,pointsOfInterest:this.pointsOfInterest,viewState:this.state,objectResourceCache:new fe})}_exitSurface(){this.sharedSymbolResources&&(this.sharedSymbolResources.objectResourceCache.destroy(),this.sharedSymbolResources.destroy(),this.sharedSymbolResources=null,this._exitGlobe(),this._exitStage())}_createGraphicsViewIfNeeded(){if(this.graphicsView||this._createGraphicsViewController)return;if(0===this.graphics.length)return;this.handles.remove("graphics-view"),this._createGraphicsViewController=new AbortController;const e=()=>{this._createGraphicsViewController=null,this._updatingChanged()};this._createGraphicsViewAsync(this._createGraphicsViewController.signal).then(e,e),this._updatingChanged()}async _createGraphicsViewAsync(e){const t=(await import("./3d/layers/GraphicsView3D.js")).default;v(e),await S((()=>{var e;return!0===(null==(e=this.basemapTerrain)?void 0:e.ready)}),e),this._set("graphicsView",new t({view:this}))}_disposeGraphicsView(){this._createGraphicsViewController&&(this._createGraphicsViewController.abort(),this._createGraphicsViewController=null),this.handles.remove("graphics-view"),f(this.graphicsView)&&(this.handles.remove(this.graphicsView.processor.layer.id),this.graphicsView.destroy(),this._set("graphicsView",null))}_startup(){const e=oe(this.viewingMode);if(e===ne.Global&&(this._clippingArea=null),this._initSurface(e),this._set("ready",!0),this.handles.add(_((()=>this.graphics),"after-changes",(()=>this._createGraphicsViewIfNeeded())),"graphics-view"),this._createGraphicsViewIfNeeded(),!this._externallySet.environment){const e=this.get("map.initialViewProperties.environment");e&&(this.environment=e)}this.labeler.setup(),this.environmentManager.connectView(this),this.inputManager.connect();const t=this._resolveWhenReady;this._resolveWhenReady=[],t.forEach((e=>e(this)))}_teardown(){this._initialDefaultSpatialReference=null,this.inputManager.disconnect(),this.environmentManager.disconnectView(),this.labeler.dispose(),this._disposeGraphicsView(),this.handles.remove("graphics-view"),this._exitSurface(),this._set("ready",!1)}_updateDefaultToMapOptions(){if(this._defaultToMapOptions.include.clear(),this.map){this.map.ground&&this._defaultToMapOptions.include.add(Be);for(const e of this.map.allLayers.items)"integrated-mesh"===e.type&&this._defaultToMapOptions.include.add(e.uid)}}_updateDefaultHitTestOptions(){if(this._defaultHitTestOptions.exclude.clear(),this.map){this.map.ground&&this.map.ground.opacity<1&&this._defaultHitTestOptions.exclude.add(Be);for(const e of this.map.allLayers.items)"integrated-mesh"===e.type&&e.opacity<1&&this._defaultToMapOptions.exclude.add(e.uid)}}getVoxelWasmPerSceneView(){return $.getInstance().getVoxelWasmPerSceneView(this)}};function lt(e,t){e.layerUids||(e.layerUids=new Set),e.layerUids.add(t)}function pt(e,t){e.graphicUids||(e.graphicUids=new Set),e.graphicUids.add(t)}function ht(e,t){return f(e)&&U(e.spatialReference,t)?A(e,t):null}var dt;e([E()],ot.prototype,"_userClippingArea",void 0),e([E()],ot.prototype,"_resourceController",void 0),e([E()],ot.prototype,"_stage",void 0),e([E({readOnly:!0})],ot.prototype,"deconflictor",void 0),e([E({readOnly:!0})],ot.prototype,"labeler",void 0),e([E(L(K,"analyses"))],ot.prototype,"analyses",void 0),e([E({type:se,readOnly:!0,aliasOf:"state.animation"})],ot.prototype,"animation",void 0),e([E({readOnly:!0})],ot.prototype,"basemapTerrain",void 0),e([E({readOnly:!0})],ot.prototype,"elevationProvider",void 0),e([E({type:t,aliasOf:"stateManager.camera"})],ot.prototype,"camera",void 0),e([E({type:t,aliasOf:"stateManager.contentCamera"})],ot.prototype,"contentCamera",void 0),e([E({readOnly:!0})],ot.prototype,"canvas",void 0),e([E({type:nt,aliasOf:"stateManager.center"})],ot.prototype,"center",void 0),e([E({type:rt})],ot.prototype,"clippingArea",null),e([E({type:he})],ot.prototype,"constraints",void 0),e([E({type:rt,readOnly:!0})],ot.prototype,"renderDataExtent",null),e([E({type:rt,readOnly:!0})],ot.prototype,"dataExtent",null),e([E({type:rt,readOnly:!0})],ot.prototype,"groundAndLayersExtent",null),e([E({value:null,type:de})],ot.prototype,"environment",null),e([j("environment")],ot.prototype,"castEnvironment",null),e([E({readOnly:!0})],ot.prototype,"environmentManager",void 0),e([E({type:rt,aliasOf:"stateManager.extent"})],ot.prototype,"extent",void 0),e([E()],ot.prototype,"floors",void 0),e([E({readOnly:!0,aliasOf:"stateManager.screenCenter"})],ot.prototype,"screenCenter",void 0),e([E({aliasOf:"stateManager.frustum"})],ot.prototype,"frustum",void 0),e([E({type:Number,readOnly:!0})],ot.prototype,"fullOpacity",void 0),e([E({readOnly:!0})],ot.prototype,"graphicsView",void 0),e([E({readOnly:!0})],ot.prototype,"analysisViewManager",void 0),e([E()],ot.prototype,"groundView",void 0),e([E({type:Boolean})],ot.prototype,"initialExtentRequired",null),e([E()],ot.prototype,"_defaultsFromMapSettings",null),e([E({type:Boolean,readOnly:!0})],ot.prototype,"interacting",null),e([E()],ot.prototype,"stationary",null),e([E({aliasOf:"state.navigating"})],ot.prototype,"navigating",void 0),e([E()],ot.prototype,"map",void 0),e([E({readOnly:!0})],ot.prototype,"mapCoordsHelper",void 0),e([E({aliasOf:"stateManager.padding"})],ot.prototype,"padding",void 0),e([E({type:Ie,readOnly:!0})],ot.prototype,"pointsOfInterest",void 0),e([E({type:ye,readOnly:!0})],ot.prototype,"featureTiles",void 0),e([E()],ot.prototype,"featureTreeDebugger",void 0),e([E({type:Boolean})],ot.prototype,"screenSizePerspectiveEnabled",void 0),e([E({constructOnly:!0})],ot.prototype,"deactivatedWebGLExtensions",void 0),e([E({constructOnly:!0})],ot.prototype,"debugWebGLExtensions",void 0),e([E({constructOnly:!0})],ot.prototype,"renderCanvas",void 0),e([E({constructOnly:!0})],ot.prototype,"state",void 0),e([E({readOnly:!0})],ot.prototype,"inputManager",void 0),e([E({readOnly:!0})],ot.prototype,"stateManager",void 0),e([E({type:["low","medium","high"]})],ot.prototype,"qualityProfile",null),e([E({type:Oe,get(){let e=this._get("qualitySettings");return e||(e=new Oe,Se.apply(this.qualityProfile,e)),e}})],ot.prototype,"qualitySettings",void 0),e([E()],ot.prototype,"slicePlane",null),e([E({readOnly:!0})],ot.prototype,"typeSpecificPreconditionsReady",null),e([E({readOnly:!0})],ot.prototype,"renderCoordsHelper",void 0),e([E({readOnly:!0})],ot.prototype,"sceneIntersectionHelper",void 0),e([E({type:Number,dependsOn:["scale","spatialReference"],readOnly:!0})],ot.prototype,"resolution",null),e([E({type:Number,aliasOf:"stateManager.scale"})],ot.prototype,"scale",void 0),e([E()],ot.prototype,"heightModelInfo",null),e([E()],ot.prototype,"spatialReference",void 0),e([E({type:Boolean,constructOnly:!0})],ot.prototype,"alphaCompositingEnabled",void 0),e([E({type:Boolean})],ot.prototype,"supersampleScreenshotsEnabled",void 0),e([E({readOnly:!0})],ot.prototype,"type",void 0),e([E({type:tt})],ot.prototype,"ui",void 0),e([E({type:Boolean,readOnly:!0,dependsOn:["graphicsView.updating","basemapView.updating","basemapTerrain.updating","layerViewManager.updating","layerViewManager.updatingRemaining","_resourceController.updating","_stage.updating","featureTiles.updating","pointsOfInterest.updating","environmentManager.updating","overlay.updating","updatingHandles.updating","featureTreeDebugger.updating","labeler.updating","deconflictor.updating","ready","stationary","inputManager.hasPendingInputs","toolViewManager.updating","analysisViewManager.updating"]})],ot.prototype,"updating",null),e([E({type:Number,readOnly:!0,dependsOn:["updating"]})],ot.prototype,"updatingProgress",void 0),e([E({type:["global","local"]})],ot.prototype,"viewingMode",null),e([E({type:s,aliasOf:"stateManager.viewpoint"})],ot.prototype,"viewpoint",void 0),e([E({type:Number,aliasOf:"stateManager.zoom"})],ot.prototype,"zoom",void 0),e([E({type:Ve})],ot.prototype,"highlightOptions",void 0),ot=e([P("esri.views.SceneView")],ot),function(e){e[e.INCLUDE=0]="INCLUDE",e[e.EXCLUDE=1]="EXCLUDE"}(dt||(dt={}));const ct=G(),ut=O(),gt=q(),mt=ot;export{mt as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../Camera.js";import"../geometry.js";import i from"../Graphic.js";import r from"../Ground.js";import s from"../Viewpoint.js";import n from"../core/Collection.js";import{byId as a}from"../core/domUtils.js";import o from"../core/Error.js";import{on as l}from"../core/events.js";import{handlesGroup as p,makeHandle as h}from"../core/handleUtils.js";import d from"../core/has.js";import{isIterable as c}from"../core/iteratorUtils.js";import u from"../core/Logger.js";import{destroyMaybe as g,isNone as m,isSome as f,unwrapOr as y}from"../core/maybe.js";import{ObservableChangesType as w}from"../core/ObservableChangesType.js";import{throwIfAborted as v}from"../core/promiseUtils.js";import{on as _,initial as b,syncAndInitial as S,whenOnce as M,watch as R}from"../core/reactiveUtils.js";import{setFrameDuration as V}from"../core/scheduling.js";import{screenPointObjectToArray as T,createScreenPoint as C,createScreenPointArray as O}from"../core/screenUtils.js";import{initialize as x}from"../core/workers/workers.js";import{property as E}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import{cast as j}from"../core/accessorSupport/decorators/cast.js";import{subclass as P}from"../core/accessorSupport/decorators/subclass.js";import{ensureType as I}from"../core/accessorSupport/ensureType.js";import{c as G}from"../chunks/vec3f64.js";import{owningCollectionProperty as L}from"../core/support/OwningCollection.js";import H from"../geometry/HeightModelInfo.js";import{canProjectWithoutEngine as U,project as A,projectPointToVector as D,projectVectorToVector as F,projectBoundingRect as W}from"../geometry/projection.js";import{create as k,toExtent as q}from"../geometry/support/aaBoundingRect.js";import{B as z,a as N}from"../chunks/boundedPlane.js";import{renderSRFromViewSR as B}from"../geometry/support/coordinateSystem.js";import{getResolutionForScale as Q}from"../geometry/support/scaleUtils.js";import $ from"../layers/VoxelWasmManager.js";import{isImageryTileLayer as X,isTiledLayer as Y,isVoxelLayer as Z}from"../layers/support/layerUtils.js";import{AnalysesCollection as J}from"../support/AnalysesCollection.js";import{BreakpointsOwner as K}from"./BreakpointsOwner.js";import{DOMContainer as ee}from"./DOMContainer.js";import te from"./GroundView.js";import{PopupView as ie}from"./PopupView.js";import re from"./View.js";import se from"./ViewAnimation.js";import{ViewingMode as ne,stringFromViewingMode as ae,viewingModeFromString as oe}from"./ViewingMode.js";import{layerView3DImporter as le}from"./3d/layerViewModuleImportUtils.js";import pe from"./3d/analysis/AnalysisViewManager3D.js";import{Constraints as he}from"./3d/constraints/Constraints.js";import de from"./3d/environment/SceneViewEnvironment.js";import{SceneViewEnvironmentManager as ce}from"./3d/environment/SceneViewEnvironmentManager.js";import ue from"./3d/input/SceneInputManager.js";import{GraphicsDeconflictor as ge}from"./3d/layers/graphics/GraphicsDeconflictor.js";import{Labeler as me}from"./3d/layers/graphics/Labeler.js";import{ObjectResourceCache as fe}from"./3d/layers/graphics/ObjectResourceCache.js";import{FeatureTileTree3D as ye}from"./3d/layers/support/FeatureTileTree3D.js";import we from"./3d/state/ViewState.js";import ve from"./3d/state/ViewStateManager.js";import{SceneIntersectionHelper as _e}from"./3d/state/helpers/SceneIntersectionHelper.js";import{CombinedElevationProvider as be}from"./3d/support/CombinedElevationProvider.js";import Se from"./3d/support/debugFlags.js";import Me from"./3d/support/DisplayQualityProfile.js";import{getElevationAtPoint as Re}from"./3d/support/ElevationProvider.js";import Ve from"./3d/support/HighlightOptions.js";import{MapCoordsHelper as Te}from"./3d/support/MapCoordsHelper.js";import{PropertiesPool as Ce}from"./3d/support/PropertiesPool.js";import Oe from"./3d/support/QualitySettings.js";import{RenderCoordsHelper as xe}from"./3d/support/RenderCoordsHelper.js";import{newResourceController as Ee}from"./3d/support/ResourceController.js";import je from"./3d/support/SceneViewPerformanceInfo.js";import{SharedSymbolResources as Pe}from"./3d/support/SharedSymbolResources.js";import{PointsOfInterest as Ie}from"./3d/support/pointsOfInterest/PointsOfInterest.js";import Ge from"./3d/terrain/TerrainSurface.js";import{isSurfaceLayerView as Le,getTiledLayerInfo as He,checkIfTileInfoSupportedForView as Ue}from"./3d/terrain/terrainUtils.js";import{Stage as Ae}from"./3d/webgl-engine/Stage.js";import{newIntersector as De,DEFAULT_TOLERANCE as Fe}from"./3d/webgl-engine/lib/Intersector.js";import{StoreResults as We,IntersectorType as ke}from"./3d/webgl-engine/lib/IntersectorInterfaces.js";import{isValidIntersectorResult as qe}from"./3d/webgl-engine/lib/intersectorUtils.js";import{toGraphic as ze,toOwner as Ne}from"./3d/webgl-engine/lib/intersectorUtilsConversions.js";import{TERRAIN_ID as Be}from"./3d/webgl-engine/lib/verticalOffsetUtils.js";import{hitTestSelectSimilarDistance as Qe}from"./support/hitTestSelectUtils.js";import{occludeesSupported as $e}from"./support/layerViewUtils.js";import{encode as Xe,encodeData as Ye,toRenderSettings as Ze,screenshotSuperSampleSettings as Je}from"./support/screenshotUtils.js";import{isSupportedScreenPointEvent as Ke,createScreenPointFromSupportedEvent as et}from"./support/screenUtils.js";import{isSpatialReferenceSupported as tt}from"./support/spatialReferenceSupport.js";import{check as it}from"./support/WebGLRequirements.js";import rt from"./ui/3d/DefaultUI3D.js";import st from"../webscene/Environment.js";import nt from"../geometry/Extent.js";import at from"../geometry/SpatialReference.js";import ot from"../geometry/Point.js";const lt=u.getLogger("esri.views.SceneView");let pt=class extends(K(ee(ie(re)))){constructor(e){super(e),this._userClippingArea=null,this._clippingArea=null,this._initialDefaultSpatialReference=null,this._defaults={},this._externallySet={environment:!1},this._createGraphicsViewController=null,this._resolveWhenReady=[],this.propertiesPool=new Ce({slicePlane:z},this),this._resourceController=Ee(this),this._defaultToMapOptions={include:new Set},this._defaultHitTestOptions={exclude:new Set},this.deconflictor=new ge({view:this}),this.labeler=new me({view:this,deconflictor:this.deconflictor.labels}),this.sharedSymbolResources=null,this.analyses=new J,this.basemapTerrain=null,this.elevationProvider=null,this.camera=null,this.canvas=null,this.center=null,this.constraints=new he,this.environmentManager=new ce,this.extent=null,this.floors=new n,this.fullOpacity=1,this.graphicsView=null,this.analysisViewManager=new pe({view:this}),this.groundView=null,this.navigating=!1,this.map=null,this.screenSizePerspectiveEnabled=!0,this.state=new we,this.scale=null,this.spatialReference=null,this.alphaCompositingEnabled=!1,this.supersampleScreenshotsEnabled=!0,this.type="3d",this.ui=new rt,this._numUpdating=0,this._lastUpdateTime=0,this.updatingProgress=.5,this.viewpoint=null,this.zoom=null,this.highlightOptions=new Ve,x(),e&&e.environment||(this._defaults.environment=new de,this.environment=this._defaults.environment);const t=(e=null)=>{f(e)&&e.type===w.MOVE||(this._updatingChanged(),this.map&&this.map.allLayers.forEach((async e=>{try{await e.when()}catch{}this._updatingChanged()})))};this.handles.add([_((()=>{var e;return null==(e=this.map)?void 0:e.allLayers}),"after-changes",(e=>t(e)),{onListenerAdd:()=>t(),onListenerRemove:()=>t(),sync:!0}),this.allLayerViews.on("after-changes",(e=>this._updateUpdatingMonitors(e))),this.watch("map",(e=>{e&&e.load&&e.load().catch((()=>{}))}))]),this.inputManager=new ue({view:this}),this.stateManager=new ve({view:this})}initialize(){this.groundView=new te({view:this}),this._updateUpdatingMonitors();const e=()=>this._updateDefaultToMapOptions();this.handles.add(_((()=>{var e;return null==(e=this.map)?void 0:e.allLayers}),"after-changes",e,{onListenerAdd:e,onListenerRemove:e})),this.updatingHandles.add((()=>this.qualitySettings.memoryLimit),(e=>{this.resourceController&&(this.resourceController.memoryController.maxMemory=e)}),b),this.updatingHandles.add((()=>this.qualitySettings.additionalCacheMemory),(e=>{this.resourceController&&(this.resourceController.memoryController.additionalCacheMemory=e)}),b),this.updatingHandles.add((()=>this.qualitySettings.frameRate),(e=>V(e>0?1e3/Math.ceil(e):0)),b),this.updatingHandles.add((()=>{var e;return null==(e=this.map)?void 0:e.ground}),e,S),this.updatingHandles.add((()=>{var e,t;return null==(e=this.map)||null==(t=e.ground)?void 0:t.opacity}),(()=>this._updateDefaultHitTestOptions()),S),this.handles.add(this.watch("spatialReference",(()=>this.notifyChange("clippingArea")),!0))}destroy(){this.destroyed||(this.invalidate(),this.activeTool=null,this.layerViewManager.clear(),this._exitSurface(),this._disposeGraphicsView(),this.sharedSymbolResources=g(this.sharedSymbolResources),this.labeler.destroy(),this._set("labeler",null),this.deconflictor.destroy(),this._set("deconflictor",null),this._resourceController=g(this._resourceController),this.stateManager.destroy(),this._set("stateManager",null),this.inputManager.destroy(),this._set("inputManager",null),this.propertiesPool.destroy(),this.handles.remove("updatingMonitors"),this.environmentManager.destroy(),this._set("environmentManager",null),this.groundView=g(this.groundView))}get renderSpatialReference(){return this.renderCoordsHelper&&this.renderCoordsHelper.spatialReference}get basemapSpatialReference(){return this.basemapTerrain&&this.basemapTerrain.spatialReference}installContentCameraReset(e={sticky:!1}){return this.stateManager.installContentCameraReset(e)}get clippingArea(){if("global"===this.viewingMode)return null;let e=this._userClippingArea||this.get("map.clippingArea");return!(!!this._userClippingArea||this.get("map.clippingEnabled"))||m(e)?(this._clippingArea=null,null):e instanceof nt?this.spatialReference&&(e=ct(e,this.spatialReference),m(e))?(lt.error("#clippingArea","setting clippingArea with incompatible SpatialReference"),this._clippingArea):(e=e.clone(),m(e.intersection(this.groundAndLayersExtent))&&(e.xmin=e.xmax,e.ymin=e.ymax),e.zmin=void 0,e.zmax=void 0,e.equals(this._clippingArea)||(this._clippingArea=e),this._clippingArea):(lt.error("#clippingArea","only clippingArea geometries of type Extent are supported"),this._clippingArea)}set clippingArea(e){this.ready&&"global"===this.viewingMode&&f(e)?lt.error("#clippingArea=","Clipping area is only supported in local viewingMode"):this._userClippingArea=e}get renderDataExtent(){if(this.state.viewingMode===ne.Global)return null;const e=this.renderSpatialReference,t=this.dataExtent;return m(t)||m(e)||t.spatialReference.equals(e)?t:ct(t,e)}get dataExtent(){let e=this.groundAndLayersExtent;const t=this.spatialReference||at.WGS84,i=ct(this.clippingArea,t);f(i)&&(e=f(e)?e.intersection(i):i);const r=this._get("dataExtent");return f(e)&&e.equals(r)?r:e}get groundAndLayersExtent(){const e=this.spatialReference||at.WGS84;let t;const i=i=>{const r=ct(i,e);m(r)||(f(t)?t.union(r):t=r.clone())},r=this.basemapTerrain;if(null!=r&&r.spatialReference){const e=r.groundExtent;i(new nt({xmin:e[0],ymin:e[1],zmin:0,xmax:e[2],ymax:e[3],zmax:0,spatialReference:r.spatialReference}))}if(this.map){const e=e=>{!f(e.fullExtent)||"graphics"===e.type&&e.internal||i(e.fullExtent)};this.map.allLayers.forEach((t=>e(t)))}if(m(t))return null;t.hasZ?(t.zmin=Math.min(0,t.zmin),t.zmax=Math.max(0,t.zmax)):(t.zmin=0,t.zmax=0);const s=this._get("groundAndLayersExtent");return t.equals(s)?s:t}set environment(e){e!==this._defaults.environment&&(this._externallySet.environment=!0),this._set("environment",e)}castEnvironment(e){return e?e instanceof de?e:e instanceof st?null!=this.environment?this.environment.cloneWithWebsceneEnvironment(e):de.fromWebsceneEnvironment(e):I(de,e):new de}get initialExtentRequired(){return this.stateManager&&!this.stateManager.hasInitialView}get _defaultsFromMapSettings(){return{required:{tileInfo:!1,heightModelInfo:!0,extent:!1}}}get interacting(){return this.navigating||f(this.activeTool)}get stationary(){return!this.animation&&!this.resizing&&(m(this.state)||this.state.stationary)}set qualityProfile(e){Me.isValidProfile(e)&&(Me.apply(e,this.qualitySettings),this._set("qualityProfile",e))}get qualityProfile(){return this._get("qualityProfile")||Me.getDefaultProfile()}set slicePlane(e){if(f(this._stage)&&this._stage.renderView.setRenderParameters({slicePlane:e}),m(e))return void this._set("slicePlane",null);const t=this.propertiesPool.get("slicePlane");N(e,t),this._set("slicePlane",t)}get typeSpecificPreconditionsReady(){return!!this.viewingMode}get resolution(){return null!=this.spatialReference?Q(this.scale,this.spatialReference):0}get heightModelInfo(){const e=this.getDefaultHeightModelInfo();return null!=e?H.deriveUnitFromSR(e,this.spatialReference):null}get updating(){var e,t,i;if(this.destroyed)return!1;let r=0,s=this.layerViewManager.updating,n=s?this.layerViewManager.updatingRemaining:0;this.allLayerViews.forEach((e=>{if(e.isFulfilled()){if(e.updating){if(s=!0,e.suspended||Le(e))return;++n,r+=e.updatingProgress}}else++n}));for(const a of[this.graphicsView,this.basemapView,this._resourceController,this._stage,this.featureTiles,this.pointsOfInterest,this.environmentManager,this.overlay,this.featureTreeDebugger,this.toolViewManager,this.analysisViewManager])if(f(a)&&a.updating){const e=.1;n+=e,r+=.5*e}for(const a of[this.deconflictor,this.labeler,this.basemapTerrain])f(a)&&a.updating&&(++n,r+=a.updatingProgress);if(s=!!(s||n>0||this.updatingHandles.updating||!this.ready||!this.stationary||this._createGraphicsViewController||null!=(e=this.inputManager)&&e.hasPendingInputs||null!=(t=this.map)&&null!=(i=t.allLayers)&&i.some((e=>!e.isFulfilled()))),s?(this._numUpdating=Math.max(n,this._numUpdating),r+=this._numUpdating-n):this._numUpdating=0,this._numUpdating>0?r/=this._numUpdating:r=s?0:1,this._get("updatingProgress")!==r){const e=this._resourceController.scheduler.now;if(r<1){const t=Math.min((e-this._lastUpdateTime)/2e3,1);r=this.updatingProgress*(1-t)+r*t}this._set("updatingProgress",r),this._lastUpdateTime=s&&r<1?e:0}return s}get viewingMode(){var e;const t=this._predeterminedViewingMode;if(f(t))return ae(t);const i=this.spatialReference;return i?f(null==(e=this.defaultsFromMap)?void 0:e.viewingMode)&&i.equals(this.defaultsFromMap.spatialReference)?ae(this.defaultsFromMap.viewingMode):tt(i,ne.Global)?"global":"local":"global"}set viewingMode(e){this.ready?lt.error("#viewingMode","viewingMode cannot be set once view is ready"):e?this._override("viewingMode",e):void 0===e&&this._clearOverride("viewingMode")}get resourceController(){return this._resourceController}get performanceInfo(){return new je(this)}forceAnimationTime(e){this._stage.renderView.forcedAnimationTime=this.basemapTerrain.overlayManager.forcedAnimationTime=e}on(e,t,i,r){const s=this.viewEvents.on(e,t,i,r);return s||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}toMap(e,t){if(!this.ready)return lt.error("#toMap()","Scene view cannot be used before it is ready"),null;const i=t?this.externalToInternalIntersectOptions(t):this._defaultToMapOptions,r=f(i.graphics)&&(f(i.graphics.include)||f(i.graphics.exclude)),s=Ke(e)?et(this,e):e,n=T(s);i.enableDraped=i.include&&!i.include.has(Be)||i.exclude&&i.exclude.has(Be);const a=this.sceneIntersectionHelper,o=De(this.state.viewingMode);if(o.options.selectionMode=!0,o.options.store=r?We.ALL:We.MIN,a.intersectIntersectorScreen(n,o,i),r){for(const e of o.results.all){const t=ze(e,this);if(m(t))return this._intersectResultToMapPoint(e);if(this._testGraphicUidFilter(i.graphics,t))return this._intersectResultToMapPoint(e)}return null}return this._intersectResultToMapPoint(o.results.min)}toScreen(e){if(!this.ready)return lt.error("#toScreen()","Scene view cannot be used before it is ready"),null;const t=y(null==e.z&&Re(this.elevationProvider,e),0);return D(e,gt,this.renderSpatialReference,t),this.state.camera.projectToScreen(gt,mt),C(mt[0],mt[1])}pixelSizeAt(e){return this.ready?e?(D(e,gt,this.renderSpatialReference),this.state.camera.computeScreenPixelSizeAt(gt)):0:(lt.error("#pixelSizeAt()","Scene view cannot be used before it is ready"),null)}overlayPixelSizeInMapUnits(e){const t=this.basemapTerrain.overlayManager;return t?t.overlayPixelSizeInMapUnits(e):1}hitTest(e,t){if(!this.ready)return lt.error("#hitTest()","Scene view cannot be used before it is ready"),null;const i=Ke(e)?et(this,e):e,r=O(i.x,i.y),s=t?this.externalToInternalIntersectOptions(t):this._defaultHitTestOptions;s.requiresGroundFeedback=!0,s.enableDraped=!0;const n=De(this.state.viewingMode);n.options.selectionMode=!0,n.options.store=We.ALL,this.sceneIntersectionHelper.intersectIntersectorScreen(r,n,s);const a=this._intersectResultsToHits(n.results.all,s.graphics),o=n.results.ground,l=Ne(o,this),p=f(l)&&"type"in l&&"integrated-mesh"===l.type?l:null,h={screenPoint:i,results:a,ground:{mapPoint:this._intersectResultToMapPoint(o),distance:qe(o)?o.distanceInRenderSpace:0,layer:p}};return Se.SCENEVIEW_HITTEST_RETURN_INTERSECTOR&&(h.intersector=n),Promise.resolve(h)}popupHitTest(e){return Qe(this,e).then((({results:t,ground:i})=>{let r=null;return!(0===t.length||Math.abs(y(t[0].distance,0)-i.distance)<1e-5)||i.layer&&"integrated-mesh"===i.layer.type||(r=i.mapPoint),{results:t,screenPoint:e,mapPoint:r}}))}goTo(e,t){return this.updatingHandles.addPromise(this.stateManager.goTo(e,t))}async whenAnalysisView(e){if(await this.whenReady(),m(e.parent))throw new o("view:no-analysisview-for-analysis","The analysis has not been added to view.analyses",{analysis:e});if("analysis"===e.parent.type){return(await this.whenLayerView(e.parent)).whenAnalysisView(e)}return this.analysisViewManager.whenAnalysisView(e)}whenLayerView(e){return super.whenLayerView(e)}async takeScreenshot(e){const t=this._completeSettings(e);await this.whenReady();const i=await this._stage.renderView.takeScreenshot(t);return Xe(i,t,this._pixelFormat())}async _takeScreenshot(e){const t=this._completeSettings(e);await this.whenReady();const i=await this._stage.renderView.takeScreenshot(t);return Ye(i,this._pixelFormat())}_completeSettings(e){const t=Ze(e,this);return t.pixelRatio/=this.state.pixelRatio,Je(t,this.supersampleScreenshotsEnabled,this.padding)}_pixelFormat(){return{flipY:!0,premultipliedAlpha:this._stage.renderView.getAlpha()}}get test(){return{takeScreenshot:e=>this._takeScreenshot(e)}}addUpdatingPromise(e){return this.updatingHandles.addPromise(e)}importLayerView(e){return le.importLayerView(e)}hasLayerViewModule(e){return le.hasLayerViewModule(e)}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){var e,t,i,r;return this.map&&"initialViewProperties"in this.map&&(null==(e=this.map)||null==(t=e.initialViewProperties)?void 0:t.spatialReference)||(null==(i=this.defaultsFromMap)?void 0:i.spatialReference)||(null==(r=this.defaultsFromMap)?void 0:r.ready)&&this._initialDefaultSpatialReference||null}async validate(){let e=it(this.type);if(d("safari")&&d("safari")<9&&(e=new o("sceneview:browser-not-supported","This browser is not supported by SceneView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:d("safari")})),f(e))throw lt.warn("#validate()",e.message),e}get _predeterminedViewingMode(){var e,t;const i=this._isOverridden("viewingMode")?this._get("viewingMode"):null!=(e=this.map&&"initialViewProperties"in this.map?null==(t=this.map.initialViewProperties)?void 0:t.viewingMode:null)?e:null;return f(i)?oe(i):null}getSpatialReferenceSupport({spatialReference:e,layer:t}){const i=this._predeterminedViewingMode;if(f(i))return this._validateSpatialReferenceForViewingMode(e,t,i)?{constraints:this._makeSpatialReferenceConstraints(e,t,i)}:null;const r=this._validateSpatialReferenceForViewingMode(e,t,ne.Local),s=this._validateSpatialReferenceForViewingMode(e,t,ne.Global);return r||s?r&&s?{constraints:this._makeSpatialReferenceConstraints(e,t,null)}:r?{constraints:this._makeSpatialReferenceConstraints(e,t,ne.Local)}:{constraints:this._makeSpatialReferenceConstraints(e,t,ne.Global)}:null}_validateSpatialReferenceForViewingMode(e,t,i){return!!tt(e,i)&&(!!m(t)||(!!X(t)||(!Y(t)||!m(He(t,e,i)))&&(!Z(t)||i!==ne.Global)))}_makeSpatialReferenceConstraints(e,t,i){if(m(t))return[{spatialReference:e,viewingMode:i}];const r=e.isWebMercator,s=e.isWGS84;if(X(t)&&(r||s)){return!s||i===ne.Local||null===Ue(t.tileInfo,t.fullExtent,e,ne.Global)?[{spatialReference:e,viewingMode:i},{spatialReference:at.WebMercator,viewingMode:i}]:[{spatialReference:r?at.WGS84:at.WebMercator,viewingMode:i}]}return Y(t)||Z(t)||!r&&!s?Y(t)&&r&&i!==ne.Global?[{spatialReference:e,viewingMode:i},{spatialReference:at.WGS84,viewingMode:ne.Local}]:[{spatialReference:e,viewingMode:i}]:[{spatialReference:e,viewingMode:i},{spatialReference:r?at.WGS84:at.WebMercator,viewingMode:i}]}_validateSpatialReference(e){const t=f(this.getSpatialReferenceSupport({spatialReference:e})),i=this._predeterminedViewingMode;return t||(f(i)?lt.warnOnce(`Spatial reference defined on view not supported in ${ae(i)} viewing mode.`):e.isGeographic&<.warnOnce("Spatial reference is geographic but not supported.")),t}whenReady(){return new Promise((e=>{this.ready?e(this):this._resolveWhenReady.push(e)}))}computeMapPointFromVec3d(e,t){let i=this.spatialReference||at.WGS84;return F(e,this.renderSpatialReference,e,i)||(i=at.WGS84,F(e,this.renderSpatialReference,e,i)),t?(t.x=e[0],t.y=e[1],t.z=e[2],t.spatialReference=i):t=new ot(e,i),t}trackGraphicState(e){if(!e.graphic)return lt.error("trackGraphicState","GraphicState.graphic must not be null or undefined to start tracking"),null;const t=this.getViewForGraphic(e.graphic);let i=null,r=!1;const s=t=>{var s;!r&&f(t)&&"processor"in t&&"graphics-3d"===(null==(s=t.processor)?void 0:s.type)&&t.processor.graphicsCore&&(i=t.processor.graphicsCore.trackGraphicState(e))};return f(t)?s(t):this.whenViewForGraphic(e.graphic,{waitForLayer:!0}).then((e=>s(e)),(()=>{})).catch((()=>{})),{remove:()=>{r=!0,f(i)&&(i.remove(),i=null)}}}highlight(e){if(Array.isArray(e))return p(e.map((e=>this.highlight(e))));if(n.isCollection(e))return p(e.toArray().map((e=>this.highlight(e))));const t=this.getViewForGraphic(e);return t&&"highlight"in t?t.highlight(e):h()}maskOccludee(e){if(!e)return lt.error("maskOccludee","GraphicState.graphic must not be null or undefined to mask an occludee"),null;const t=this.getViewForGraphic(e);let i=null,r=!1;const s=t=>{!r&&f(t)&&$e(t)&&(i=t.maskOccludee(e))};return f(t)?s(t):this.whenViewForGraphic(e,{waitForLayer:!0}).then((e=>s(e)),(()=>{})).catch((()=>{})),{remove:()=>{r=!0,f(i)&&(i.remove(),i=null)}}}getViewForGraphic(e){return e.layer===this.graphics?this.graphicsView:e.layer?this.allLayerViews.find((t=>t.layer===e.layer)):null}graphicChanged(e){f(this.graphicsView)&&this.graphicsView.graphicChanged(e)}async whenViewForGraphic(e,t){if(e.layer===this)return await M((()=>this.graphicsView)),this.graphicsView;if(!e.layer||!this.map)throw new o("no-view-for-graphic");return t&&t.waitForLayer&&!this.map.allLayers.includes(e.layer)?new Promise(((t,i)=>{const r=this.map.allLayers.on("change",(s=>{s.added.includes(e.layer)&&(r.remove(),this.whenLayerView(e.layer).then(t,i))}))})):this.whenLayerView(e.layer)}externalToInternalIntersectOptions(e){const t=this._externalToInternalRenderItems(e.include,ut.INCLUDE),i=this._externalToInternalRenderItems(e.exclude,ut.EXCLUDE);return{include:t.layerUids,exclude:i.layerUids,graphics:{include:t.graphicUids,exclude:i.graphicUids}}}_intersectResultToMapPoint(e,t){return e.getIntersectionPoint(gt)?(t=this.computeMapPointFromVec3d(gt,t),e.intersector===ke.TERRAIN&&this.basemapTerrain&&(t.z=y(Re(this.basemapTerrain,t),0)),t):null}_intersectResultsToHits(e,t){const i=new Array;let r=null;for(let s=0;s<e.length;s++){const n=e[s],a=Ne(n,this);if(f(a)&&(a===this.map.ground||"type"in a&&"integrated-mesh"===a.type))break;const o=ze(n,this);if(m(o))continue;if(m(r)&&s!==e.length-1&&(r=new Set),f(r)){const e=this._getGraphicFilterUid(o);if(r.has(e))continue;r.add(e)}if(!this._testGraphicUidFilter(t,o))continue;const l=this._intersectResultToMapPoint(n),p=n.distanceInRenderSpace;i.push({graphic:o,mapPoint:l,distance:p})}return i}_getGraphicFilterUid(e){if(e.layer&&"objectIdField"in e.layer){const t=e.attributes[e.layer.objectIdField];if(t)return`o-${e.layer.id}-${t}`}return`u-${e.uid}`}_testGraphicUidFilter(e,t){const i=this._getGraphicFilterUid(t);return m(e)||(m(e.include)||e.include.has(i))&&(m(e.exclude)||!e.exclude.has(i))}_externalToInternalRenderItems(e,t,s={layerUids:null,graphicUids:null}){if(!e)return s;if(e instanceof i)dt(s,this._getGraphicFilterUid(e)),t===ut.INCLUDE&&(f(this.graphicsView)&&e.layer===this?ht(s,this.graphicsView.processor.layer.id):e.layer&&ht(s,e.layer.uid));else if(c(e))for(const i of e)i===this.graphics&&f(this.graphicsView)?ht(s,this.graphicsView.processor.layer.id):i instanceof r?i===this.map.ground&&ht(s,Be):this._externalToInternalRenderItems(i,t,s);else ht(s,e.uid);return s}_initBasemapTerrain(){this._set("basemapTerrain",new Ge({view:this})),this._set("elevationProvider",new be({view:this})),this.elevationProvider.register("ground",this.basemapTerrain)}_exitBasemapTerrain(){this.basemapTerrain&&(this.elevationProvider.unregister(this.basemapTerrain),this.elevationProvider.destroy(),this._set("elevationProvider",null),this.basemapTerrain.destroy(),this._set("basemapTerrain",null))}_initGlobe(){this._initCoordinateSystem(),this.state.createInitialCamera(),this._initBasemapTerrain(),this._set("pointsOfInterest",new Ie({view:this})),this._set("featureTiles",new ye({renderCoordsHelper:this.renderCoordsHelper,cameraOnSurface:this.pointsOfInterest.contentCameraOnSurface,focus:this.pointsOfInterest.focus,tilingSchemeOwner:this.basemapTerrain,viewState:this.state,scheduler:this._resourceController.scheduler,terrain:this.basemapTerrain}));const e=()=>{const e=this.basemapTerrain&&this.basemapTerrain.extent;if(this.clippingArea||e)if(e&&this.basemapTerrain.spatialReference){const e=f(this.basemapTerrain.extent)?A(q(this.basemapTerrain.extent,this.basemapTerrain.spatialReference),this.spatialReference):null;f(this.clippingArea)?this.featureTiles.filterExtent=this.clippingArea.intersection(e):this.featureTiles.filterExtent=e}else this.featureTiles.filterExtent=this.clippingArea;else this.featureTiles.filterExtent=null};this.handles.add([this.updatingHandles.add((()=>Se.FEATURE_TILE_TREE_SHOW_TILES),(e=>{e&&this.featureTiles&&!this.featureTreeDebugger?this.updatingHandles.addPromise(import("./3d/layers/support/FeatureTileTree3DDebugger.js")).then((({FeatureTileTree3DDebugger:e})=>{!this.featureTreeDebugger&&Se.FEATURE_TILE_TREE_SHOW_TILES&&(this.featureTreeDebugger=new e({view:this}))})):e||!this.featureTreeDebugger||Se.FEATURE_TILE_TREE_SHOW_TILES||(this.featureTreeDebugger.destroy(),this.featureTreeDebugger=null)}),S),this.updatingHandles.add((()=>this.clippingArea),e,S),this.updatingHandles.add((()=>this.basemapTerrain.extent),e,S)],"feature-tiles"),this.stateManager.init()}_exitGlobe(){this.state&&(this.stateManager.deinit(),this.handles.remove("render-coords-helper"),this.handles.remove("feature-tiles"),this.featureTiles.destroy(),this._set("featureTiles",null),this.pointsOfInterest.destroy(),this._set("pointsOfInterest",null),this._exitBasemapTerrain(),this.state.exit(),this._exitCoordinateSystem())}_initCoordinateSystem(){if(this.spatialReference){const e=this.spatialReference;this.mapCoordsHelper&&this.mapCoordsHelper.spatialReference.equals(e)||this._set("mapCoordsHelper",new Te(this.map,e));const t=this.state.isGlobal,i=B(t,e);i!==this.renderSpatialReference&&(this._set("renderCoordsHelper",xe.create(this.state.viewingMode,i)),t||this.handles.add(this.watch("basemapTerrain.extent",(e=>{const t=this.renderCoordsHelper.spatialReference;0===e[0]&&0===e[1]&&0===e[2]&&0===e[3]||!W(e,this.basemapTerrain.spatialReference,ft,t)||(this.renderCoordsHelper.extent=ft)}),!0),"render-coords-helper"),this.sceneIntersectionHelper&&this.sceneIntersectionHelper.setTolerance(Fe/this.renderCoordsHelper.unitInMeters))}else this._set("mapCoordsHelper",null),this._set("renderCoordsHelper",null)}_exitCoordinateSystem(){this.mapCoordsHelper&&(this.handles.remove("render-coords-helper"),this._set("renderCoordsHelper",null),this._set("mapCoordsHelper",null))}_updatingChanged(){this.notifyChange("updating")}_updateUpdatingMonitors(e=null){f(e)&&e.type===w.MOVE||(this.handles.remove("updatingMonitors"),this.allLayerViews.forEach((e=>{e.destroyed||(this.handles.add([e.watch(["updating","updatingProgress"],(()=>this._updatingChanged()),!0)],"updatingMonitors"),e.when((()=>this._updatingChanged()),(()=>this._updatingChanged())))})),this._updatingChanged())}_renderScreenshotOverlay(e,t){if(!this.overlay||!this.overlay.hasVisibleItems)return t;const i=e.getContext("2d");return i.putImageData(t,0,0),this.overlay.renderCanvas(e),i.getImageData(0,0,t.width,t.height)}_initStage(){const e={deactivatedWebGLExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions,alpha:this.alphaCompositingEnabled,canvas:this.renderCanvas,screenshot:{renderOverlay:(e,t)=>this._renderScreenshotOverlay(e,t)}},t=new _e(this.state.viewingMode,(e=>this._stage.layers.forAll(e)),this);this._set("sceneIntersectionHelper",t);const i=a(this.surface),{resourceController:r,state:s,renderSpatialReference:n}=this;this._stage=new Ae({options:e,container:i,resourceController:r,state:s,sceneIntersectionHelper:t,renderSR:n}),this._stage.renderView.setRenderParameters({slicePlane:this.slicePlane}),this._lostWebGLContextHandle=l(this._stage.renderView.canvas,"webglcontextlost",(()=>this.fatalError=new o("webgl-context-lost"))),this.handles.add([this.updatingHandles.add((()=>this.qualitySettings.antialiasingEnabled),(()=>this._stage.renderView.setRenderParameters({antialiasingEnabled:this.qualitySettings.antialiasingEnabled})),b),this.updatingHandles.add((()=>this.qualitySettings.highQualityTransparency),(()=>this._stage.renderView.setRenderParameters({highQualityTransparency:this.qualitySettings.highQualityTransparency})),b),R((()=>this.magnifier),(e=>this._stage.renderView.magnifier=e),S)],"stage");const p=()=>{this._stage.renderView.setRenderParameters({defaultHighlightOptions:Ve.toEngineOptions(this.highlightOptions)})};this.handles.add(this.updatingHandles.add((()=>[this.highlightOptions.color,this.highlightOptions.haloColor,this.highlightOptions.haloOpacity,this.highlightOptions.fillOpacity,this.highlightOptions.shadowOpacity,this.highlightOptions.shadowColor,this.highlightOptions.shadowDifference]),p),"stage"),p(),this.renderCoordsHelper&&this.sceneIntersectionHelper.setTolerance(Fe/this.renderCoordsHelper.unitInMeters),this._set("canvas",this._stage.renderView.canvas)}_exitStage(){this._set("sceneIntersectionHelper",null),this._stage.destroy(),this._stage=null,this._lostWebGLContextHandle.remove(),this._lostWebGLContextHandle=null,this.handles.remove("stage"),this._set("canvas",null)}_initSurface(e){this._exitSurface(),this.state.init(e,this.spatialReference),this._initStage(),this._initGlobe(),this.sharedSymbolResources=new Pe({view:this,viewingMode:e,resourceController:this._resourceController,pointsOfInterest:this.pointsOfInterest,viewState:this.state,objectResourceCache:new fe})}_exitSurface(){this.sharedSymbolResources&&(this.sharedSymbolResources.objectResourceCache.destroy(),this.sharedSymbolResources.destroy(),this.sharedSymbolResources=null,this._exitGlobe(),this._exitStage())}_createGraphicsViewIfNeeded(){if(this.graphicsView||this._createGraphicsViewController)return;if(0===this.graphics.length)return;this.handles.remove("graphics-view"),this._createGraphicsViewController=new AbortController;const e=()=>{this._createGraphicsViewController=null,this._updatingChanged()};this._createGraphicsViewAsync(this._createGraphicsViewController.signal).then(e,e),this._updatingChanged()}async _createGraphicsViewAsync(e){const t=(await import("./3d/layers/GraphicsView3D.js")).default;v(e),await M((()=>{var e;return!0===(null==(e=this.basemapTerrain)?void 0:e.ready)}),e),this._set("graphicsView",new t({view:this}))}_disposeGraphicsView(){this._createGraphicsViewController&&(this._createGraphicsViewController.abort(),this._createGraphicsViewController=null),this.handles.remove("graphics-view"),f(this.graphicsView)&&(this.handles.remove(this.graphicsView.processor.layer.id),this.graphicsView.destroy(),this._set("graphicsView",null))}_startup(){const e=oe(this.viewingMode);if(e===ne.Global&&(this._clippingArea=null),this._initSurface(e),this._set("ready",!0),this.handles.add(_((()=>this.graphics),"after-changes",(()=>this._createGraphicsViewIfNeeded())),"graphics-view"),this._createGraphicsViewIfNeeded(),!this._externallySet.environment){const e=this.get("map.initialViewProperties.environment");e&&(this.environment=e)}this.labeler.setup(),this.environmentManager.connectView(this),this.inputManager.connect();const t=this._resolveWhenReady;this._resolveWhenReady=[],t.forEach((e=>e(this)))}_teardown(){this._initialDefaultSpatialReference=null,this.inputManager.disconnect(),this.environmentManager.disconnectView(),this.labeler.dispose(),this._disposeGraphicsView(),this.handles.remove("graphics-view"),this._exitSurface(),this._set("ready",!1)}_updateDefaultToMapOptions(){if(this._defaultToMapOptions.include.clear(),this.map){this.map.ground&&this._defaultToMapOptions.include.add(Be);for(const e of this.map.allLayers.items)"integrated-mesh"===e.type&&this._defaultToMapOptions.include.add(e.uid)}}_updateDefaultHitTestOptions(){if(this._defaultHitTestOptions.exclude.clear(),this.map){this.map.ground&&this.map.ground.opacity<1&&this._defaultHitTestOptions.exclude.add(Be);for(const e of this.map.allLayers.items)"integrated-mesh"===e.type&&e.opacity<1&&this._defaultToMapOptions.exclude.add(e.uid)}}getVoxelWasmPerSceneView(){return $.getInstance().getVoxelWasmPerSceneView(this)}};function ht(e,t){e.layerUids||(e.layerUids=new Set),e.layerUids.add(t)}function dt(e,t){e.graphicUids||(e.graphicUids=new Set),e.graphicUids.add(t)}function ct(e,t){return f(e)&&U(e.spatialReference,t)?A(e,t):null}var ut;e([E()],pt.prototype,"_userClippingArea",void 0),e([E()],pt.prototype,"_resourceController",void 0),e([E()],pt.prototype,"_stage",void 0),e([E({readOnly:!0})],pt.prototype,"deconflictor",void 0),e([E({readOnly:!0})],pt.prototype,"labeler",void 0),e([E(L(J,"analyses"))],pt.prototype,"analyses",void 0),e([E({type:se,readOnly:!0,aliasOf:"state.animation"})],pt.prototype,"animation",void 0),e([E({readOnly:!0})],pt.prototype,"basemapTerrain",void 0),e([E({readOnly:!0})],pt.prototype,"elevationProvider",void 0),e([E({type:t,aliasOf:"stateManager.camera"})],pt.prototype,"camera",void 0),e([E({type:t,aliasOf:"stateManager.contentCamera"})],pt.prototype,"contentCamera",void 0),e([E({readOnly:!0})],pt.prototype,"canvas",void 0),e([E({type:ot,aliasOf:"stateManager.center"})],pt.prototype,"center",void 0),e([E({type:nt})],pt.prototype,"clippingArea",null),e([E({type:he})],pt.prototype,"constraints",void 0),e([E({type:nt,readOnly:!0})],pt.prototype,"renderDataExtent",null),e([E({type:nt,readOnly:!0})],pt.prototype,"dataExtent",null),e([E({type:nt,readOnly:!0})],pt.prototype,"groundAndLayersExtent",null),e([E({value:null,type:de})],pt.prototype,"environment",null),e([j("environment")],pt.prototype,"castEnvironment",null),e([E({readOnly:!0})],pt.prototype,"environmentManager",void 0),e([E({type:nt,aliasOf:"stateManager.extent"})],pt.prototype,"extent",void 0),e([E()],pt.prototype,"floors",void 0),e([E({readOnly:!0,aliasOf:"stateManager.screenCenter"})],pt.prototype,"screenCenter",void 0),e([E({aliasOf:"stateManager.frustum"})],pt.prototype,"frustum",void 0),e([E({type:Number,readOnly:!0})],pt.prototype,"fullOpacity",void 0),e([E({readOnly:!0})],pt.prototype,"graphicsView",void 0),e([E({readOnly:!0})],pt.prototype,"analysisViewManager",void 0),e([E()],pt.prototype,"groundView",void 0),e([E({type:Boolean})],pt.prototype,"initialExtentRequired",null),e([E()],pt.prototype,"_defaultsFromMapSettings",null),e([E({type:Boolean,readOnly:!0})],pt.prototype,"interacting",null),e([E()],pt.prototype,"stationary",null),e([E({aliasOf:"state.navigating"})],pt.prototype,"navigating",void 0),e([E()],pt.prototype,"map",void 0),e([E({readOnly:!0})],pt.prototype,"mapCoordsHelper",void 0),e([E({aliasOf:"stateManager.padding"})],pt.prototype,"padding",void 0),e([E({type:Ie,readOnly:!0})],pt.prototype,"pointsOfInterest",void 0),e([E({type:ye,readOnly:!0})],pt.prototype,"featureTiles",void 0),e([E()],pt.prototype,"featureTreeDebugger",void 0),e([E({type:Boolean})],pt.prototype,"screenSizePerspectiveEnabled",void 0),e([E({constructOnly:!0})],pt.prototype,"deactivatedWebGLExtensions",void 0),e([E({constructOnly:!0})],pt.prototype,"debugWebGLExtensions",void 0),e([E({constructOnly:!0})],pt.prototype,"renderCanvas",void 0),e([E({constructOnly:!0})],pt.prototype,"state",void 0),e([E({readOnly:!0})],pt.prototype,"inputManager",void 0),e([E({readOnly:!0})],pt.prototype,"stateManager",void 0),e([E({type:["low","medium","high"]})],pt.prototype,"qualityProfile",null),e([E({type:Oe,get(){let e=this._get("qualitySettings");return e||(e=new Oe,Me.apply(this.qualityProfile,e)),e}})],pt.prototype,"qualitySettings",void 0),e([E()],pt.prototype,"slicePlane",null),e([E({readOnly:!0})],pt.prototype,"typeSpecificPreconditionsReady",null),e([E({readOnly:!0})],pt.prototype,"renderCoordsHelper",void 0),e([E({readOnly:!0})],pt.prototype,"sceneIntersectionHelper",void 0),e([E({type:Number,dependsOn:["scale","spatialReference"],readOnly:!0})],pt.prototype,"resolution",null),e([E({type:Number,aliasOf:"stateManager.scale"})],pt.prototype,"scale",void 0),e([E()],pt.prototype,"heightModelInfo",null),e([E()],pt.prototype,"spatialReference",void 0),e([E({type:Boolean,constructOnly:!0})],pt.prototype,"alphaCompositingEnabled",void 0),e([E({type:Boolean})],pt.prototype,"supersampleScreenshotsEnabled",void 0),e([E({readOnly:!0})],pt.prototype,"type",void 0),e([E({type:rt})],pt.prototype,"ui",void 0),e([E({type:Boolean,readOnly:!0,dependsOn:["graphicsView.updating","basemapView.updating","basemapTerrain.updating","layerViewManager.updating","layerViewManager.updatingRemaining","_resourceController.updating","_stage.updating","featureTiles.updating","pointsOfInterest.updating","environmentManager.updating","overlay.updating","updatingHandles.updating","featureTreeDebugger.updating","labeler.updating","deconflictor.updating","ready","stationary","inputManager.hasPendingInputs","toolViewManager.updating","analysisViewManager.updating"]})],pt.prototype,"updating",null),e([E({type:Number,readOnly:!0,dependsOn:["updating"]})],pt.prototype,"updatingProgress",void 0),e([E({type:["global","local"]})],pt.prototype,"viewingMode",null),e([E({type:s,aliasOf:"stateManager.viewpoint"})],pt.prototype,"viewpoint",void 0),e([E({type:Number,aliasOf:"stateManager.zoom"})],pt.prototype,"zoom",void 0),e([E({type:Ve})],pt.prototype,"highlightOptions",void 0),pt=e([P("esri.views.SceneView")],pt),function(e){e[e.INCLUDE=0]="INCLUDE",e[e.EXCLUDE=1]="EXCLUDE"}(ut||(ut={}));const gt=G(),mt=O(),ft=k(),yt=pt;export{yt 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.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import{abortMaybe as a,isSome as n,unwrap as i,isNone as s}from"../../core/maybe.js";import{createTask as
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import{abortMaybe as a,isSome as n,unwrap as i,isNone as s}from"../../core/maybe.js";import{createTask as r,isAborted as l}from"../../core/promiseUtils.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 p}from"../../core/accessorSupport/decorators/subclass.js";import{supportsHeightModelInfo as u,deriveHeightModelInfoFromLayer as c}from"../../geometry/support/heightModelInfoUtils.js";import{ViewingMode as d}from"../ViewingMode.js";import{projectWithEngineOrService as f}from"./projectionUtils.js";let h=class extends t{constructor(e){super(e),this.required={tileInfo:!1,heightModelInfo:!1,extent:!1},this.defaultSpatialReference=null,this.userSpatialReference=null,this.sourcePreloadCount=10,this.priorityCollection=null,this.requiresExtentInSpatialReference=!0,this.suspended=!1,this._projectExtentTask={task:null,input:null,output:null,spatialReference:null}}destroy(){this._projectExtentTask.task&&(this._projectExtentTask.task=a(this._projectExtentTask.task)),this._set("map",null)}get ready(){return!this._spatialReferenceTask.updating&&!this._tileInfoTask.updating&&!this._extentTask.updating}get heightModelInfoReady(){return!this._heightModelInfoTask.updating}get spatialReference(){return n(this.userSpatialReference)?this.userSpatialReference:i(this._spatialReferenceTask.spatialReference)}get extent(){return i(this._extentTask.extent)}get heightModelInfo(){return i(this._heightModelInfoTask.heightModelInfo)}get vcsWkid(){return i(this._heightModelInfoTask.vcsWkid)}get latestVcsWkid(){return i(this._heightModelInfoTask.latestVcsWkid)}get viewingMode(){return s(this.userSpatialReference)||this.userSpatialReference.equals(i(this._spatialReferenceTask.spatialReference))?i(this._spatialReferenceTask.viewingMode):null}get tileInfo(){return i(this._tileInfoTask.tileInfo)}get mapCollections(){var e,t,a,i;const s=null==(e=this.map)?void 0:e.call(this),r=[];return n(this.priorityCollection)&&r.push(this.priorityCollection),r.push({parent:null==s?void 0:s.basemap,layers:null==s||null==(t=s.basemap)?void 0:t.baseLayers},{layers:null==s?void 0:s.layers},{parent:null==s?void 0:s.ground,layers:null==s||null==(a=s.ground)?void 0:a.layers},{parent:null==s?void 0:s.basemap,layers:null==s||null==(i=s.basemap)?void 0:i.referenceLayers}),r}get _allLayers(){return this._collectLayers(this.mapCollections)}get _spatialReferenceTask(){var e;if(this.suspended)return null!=(e=this._get("_spatialReferenceTask"))?e:{updating:!1};const{layers:t,updating:a}=this._allLayers;let i=null;for(const s of t){const e=this._getSupportedSpatialReferences(s);if(e.length>0){const t=this._narrowDownSpatialReferenceCandidates(i,e);n(t)&&(i=t)}if(n(i)&&1===i.length)break}if(a&&(s(i)||1!==i.length))return{updating:!0};const r=this._pickSpatialReferenceCandidate(i);return{spatialReference:n(r)?r.spatialReference:null,viewingMode:n(r)?r.viewingMode:null,updating:!1}}get _tileInfoTask(){var e,t,a,n,i,s,r,l;if(!this.required.tileInfo)return null!=(l=this._get("_tileInfoTask"))?l:{updating:!1};if(!this.spatialReference)return{updating:this._spatialReferenceTask.updating};const{layers:o,updating:p}=this._collectLayers([{parent:null==(e=this.map)||null==(t=e.call(this))?void 0:t.basemap,layers:null==(a=this.map)||null==(n=a.call(this))||null==(i=n.basemap)?void 0:i.baseLayers},{layers:null==(s=this.map)||null==(r=s.call(this))?void 0:r.layers}]);if(o&&o.length>0&&"tileInfo"in o[0]){const e=o[0].tileInfo;return{tileInfo:e&&e.spatialReference.equals(this.spatialReference)?e:null,updating:!1}}return{updating:p}}get _heightModelInfoTask(){var e,t;if(!this.required.heightModelInfo||this.suspended&&null!=(e=this._get("_heightModelInfoTask"))&&e.heightModelInfo)return null!=(t=this._get("_heightModelInfoTask"))?t:{updating:!1};const{layers:a,updating:n}=this._allLayers;for(const r of a)if(u(r)){const e=c(r);var i,s;if(e)return{heightModelInfo:e,vcsWkid:null==(i=r.spatialReference)?void 0:i.vcsWkid,latestVcsWkid:null==(s=r.spatialReference)?void 0:s.latestVcsWkid,updating:!1}}return{updating:n}}get _extentCandidatesTask(){var e;if(this.suspended||!this.required.extent)return null!=(e=this._get("_extentCandidatesTask"))?e:{updating:!1};if(!this.spatialReference)return{updating:this._spatialReferenceTask.updating};const t=this._allLayers,a=t.updating,i=[];for(const r of t.layers){var s;const e="fullExtents"in r&&r.fullExtents||(n(r.fullExtent)?[r.fullExtent]:[]),t=this.requiresExtentInSpatialReference?null:e[0],a=null!=(s=e.find((e=>e.spatialReference.equals(this.spatialReference))))?s:t;if(a)return{candidates:[{extent:a,layer:r}],updating:!1};if(this._getSupportedSpatialReferences(r).length>0)for(const n of e)i.push({extent:n,layer:r})}return{candidates:i,updating:a}}get _extentTask(){const{candidates:e,updating:t}=this._extentCandidatesTask;if(t)return{updating:t};if(s(e)||0===e.length)return{updating:!1};if(!this.spatialReference)return{updating:this._spatialReferenceTask.updating};const i=this._pickExtentCandidate(e),o=this.spatialReference;return i.extent.equals(this._projectExtentTask.input)&&o.equals(this._projectExtentTask.spatialReference)?{extent:this._projectExtentTask.output,updating:n(this._projectExtentTask.task)&&!this._projectExtentTask.task.finished}:(n(this._projectExtentTask.task)&&(this._projectExtentTask.task=a(this._projectExtentTask.task)),this._projectExtentTask={input:i.extent.clone(),output:null,spatialReference:o.clone(),task:r((async e=>{try{const t=await f(i.extent,o,i.layer.portalItem,e);this._projectExtentTask={...this._projectExtentTask,task:null,output:t}}catch(t){if(l(e))return;this._projectExtentTask={...this._projectExtentTask,task:null}}}))},{updating:!0})}_narrowDownSpatialReferenceCandidates(e,t){if(s(e))return t;const a=[],i=(e,t)=>n(e)?n(t)?e===t&&e:e:t;for(const n of e)for(const e of t){if(!n.spatialReference.equals(e.spatialReference))continue;const t=i(n.viewingMode,e.viewingMode);if(!1!==t){a.push({spatialReference:n.spatialReference,viewingMode:t});break}}return a.length>0?a:null}_pickSpatialReferenceCandidate(e){const t=this.defaultSpatialReference;return s(e)||e.length<1?n(t)?{spatialReference:t,viewingMode:null}:null:(n(t)&&e.length>1&&e.some((({spatialReference:e})=>e.equals(t)))&&(e=e.filter((({spatialReference:e})=>e.equals(t)))),e.length>1&&e.some((({viewingMode:e})=>e!==d.Local))&&(e=e.filter((({viewingMode:e})=>e!==d.Local))),e[0])}_getSupportedSpatialReferences(e){const t="supportedSpatialReferences"in e&&e.supportedSpatialReferences||(e.spatialReference?[e.spatialReference]:[]);if(0===t.length)return[];const a=[];for(const i of t){const t=this.getSpatialReferenceSupport({spatialReference:i,layer:e});if(n(t)){const e=n(t.constraints)?t.constraints:[{spatialReference:i,viewingMode:null}];for(const{spatialReference:t,viewingMode:n}of e)(!this.requiresExtentInSpatialReference||s(this.userSpatialReference)||t.equals(this.userSpatialReference))&&a.push({spatialReference:t,viewingMode:n})}}return a}_pickExtentCandidate(e){const t=this.spatialReference;return e.find((({extent:e})=>t.equals(e.spatialReference)))||e[0]}_collectLayers(e){var t;if("loaded"!==this._loadMaybe(null==(t=this.map)?void 0:t.call(this)))return{layers:[],updating:!0};const a={layers:[],preloading:-1,updating:!1};for(const n of e)if(this._collectCollection(n,a),a.preloading===this.sourcePreloadCount)break;return{layers:a.layers,updating:a.updating}}_collectCollection(e,t){if(e.layers){switch(this._loadMaybe(e.parent)){case"loading":return t.updating=!0,void++t.preloading;case"failed":return}for(const a of e.layers){switch(this._loadMaybe(a)){case"failed":continue;case"loading":t.updating=!0,++t.preloading;break;case"loaded":t.updating||t.layers.push(a),"layers"in a&&this._collectCollection({layers:a.layers},t)}if(t.preloading===this.sourcePreloadCount)break}}}_loadMaybe(e){return e&&"loadStatus"in e?"not-loaded"===e.loadStatus?(e.load(),"loading"):e.loadStatus:"loaded"}};e([o()],h.prototype,"required",void 0),e([o({constructOnly:!0})],h.prototype,"map",void 0),e([o({constructOnly:!0})],h.prototype,"getSpatialReferenceSupport",void 0),e([o()],h.prototype,"defaultSpatialReference",void 0),e([o()],h.prototype,"userSpatialReference",void 0),e([o()],h.prototype,"sourcePreloadCount",void 0),e([o()],h.prototype,"priorityCollection",void 0),e([o()],h.prototype,"requiresExtentInSpatialReference",void 0),e([o()],h.prototype,"suspended",void 0),e([o({readOnly:!0})],h.prototype,"ready",null),e([o({readOnly:!0})],h.prototype,"heightModelInfoReady",null),e([o({readOnly:!0})],h.prototype,"spatialReference",null),e([o({readOnly:!0})],h.prototype,"extent",null),e([o({readOnly:!0})],h.prototype,"heightModelInfo",null),e([o({readOnly:!0})],h.prototype,"vcsWkid",null),e([o({readOnly:!0})],h.prototype,"latestVcsWkid",null),e([o({readOnly:!0})],h.prototype,"viewingMode",null),e([o({readOnly:!0})],h.prototype,"tileInfo",null),e([o({readOnly:!0})],h.prototype,"mapCollections",null),e([o({readOnly:!0})],h.prototype,"_allLayers",null),e([o({readOnly:!0})],h.prototype,"_spatialReferenceTask",null),e([o({readOnly:!0})],h.prototype,"_tileInfoTask",null),e([o({readOnly:!0})],h.prototype,"_heightModelInfoTask",null),e([o({readOnly:!0})],h.prototype,"_extentCandidatesTask",null),e([o()],h.prototype,"_extentTask",null),e([o()],h.prototype,"_projectExtentTask",void 0),h=e([p("esri.views.support.DefaultsFromMap")],h);export{h as DefaultsFromMap};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../core/has.js";import{clamp as t}from"../../core/mathUtils.js";const
|
|
5
|
+
import"../../core/has.js";import{clamp as t}from"../../core/mathUtils.js";import{isNone as i}from"../../core/maybe.js";const h=2048,e=1.5,n=8;function o(i,h){const{format:e,quality:n,rotation:o,disableDecorations:a}=i||{},r=P(i,h.padding),l=q(i,{width:h.width-r.left-r.right,height:h.height-r.top-r.bottom}),{width:g,height:u}=v(i,l),f=k(e),d=W[f];return{format:f,quality:t(null!=n?n:d,0,100),area:l,width:g,height:u,rotation:o,disableDecorations:!!a,ignoreBackground:!(!i||!i.ignoreBackground),ignorePadding:!(!i||!i.ignorePadding)}}function a(t,i){const h=o(t,i),e=h.area,n=h.width/e.width,a=P(h,i.padding),r=a.left+a.right,l=a.top+a.bottom,g=i.width-r,u=i.height-l,f=Math.floor(g*n+r),d=Math.floor(u*n+l),c=t&&t.layers?t.layers:[],s=h.ignoreBackground,w=h.ignorePadding;return{framebufferWidth:f,framebufferHeight:d,region:{x:Math.floor(e.x*n)+a.left,y:Math.floor(e.y*n)+a.top,width:h.width,height:h.height},format:h.format,quality:h.quality,rotation:h.rotation,pixelRatio:n,layers:c,disableDecorations:h.disableDecorations,ignoreBackground:s,ignorePadding:w}}function r(t,i,h){const{ctx:e,canvas:n}=g(t,h),o=e.getImageData(0,0,t.width,t.height),a=c(n,i);return u(n),{dataUrl:a,data:o}}function l(t,i){const{ctx:h,canvas:e}=g(t,i),n=h.getImageData(0,0,t.width,t.height);return u(e),n}function g(t,i){const h=f();i.premultipliedAlpha&&E(t),h.width=t.width,h.height=t.height;const e=h.getContext("2d");return e.putImageData(t,0,0),i.flipY&&B(e),{ctx:e,canvas:h}}function u(t){t.width=0,t.height=0}function f(){return i(d)&&(d=document.createElement("canvas")),d}let d=null;function c(t,i){const h=R[i.format],e=i.quality/100;return t.toDataURL(h,e)}function s(i,h){const e=k(i),n=W[e];return{format:e,quality:t(null!=h?h:n,0,100)}}function w(t,i){return i/Math.max(t[0],t[1])}function m(t,i,h){if(!t||!i)throw new Error("Cannot construct image data without dimensions");if(j)try{return new ImageData(t,i)}catch(e){j=!1}return x(t,i,h)}function M(t,i,h,e){if(!i||!h)throw new Error("Cannot construct image data without dimensions");if(j)try{return new ImageData(t,i,h)}catch(o){j=!1}const n=x(i,h,e);return n.data.set(t,0),n}function p(t,i,h,e=0,n=0,o=t.width-e,a=t.height-n,r=!1){const{data:l}=t,{width:g,height:u,data:f}=i,d=o/g,c=a/u,s=Math.ceil(d/2),w=Math.ceil(c/2),m=t.width;for(let M=0;M<u;M++)for(let t=0;t<g;t++){const i=4*(t+(r?u-M-1:M)*g);let o=0,a=0,p=0,y=0,x=0,b=0;const j=(M+.5)*c;for(let r=Math.floor(M*c);r<(M+1)*c;r++){const i=Math.abs(j-(r+.5))/w,g=(t+.5)*d,u=i*i;for(let f=Math.floor(t*d);f<(t+1)*d;f++){const t=Math.abs(g-(f+.5))/s,i=Math.sqrt(u+t*t);if(i>=1)continue;let d=2*i*i*i-3*i*i+1;const c=4*(e+f+(n+r)*m);b+=d*l[c+3],a+=d,!h&&l[c+3]<255&&(d=d*l[c+3]/255),p+=d*l[c],y+=d*l[c+1],x+=d*l[c+2],o+=d}}f[i]=p/o,f[i+1]=y/o,f[i+2]=x/o,f[i+3]=b/a}return i}function y(t,i,o){if(!i)return t;const{framebufferWidth:a,framebufferHeight:r,pixelRatio:l,region:g}=t,u=P(t,o),f=u.left+u.right,d=u.top+u.bottom,c=a-f,s=r-d,w=Math.min(n,Math.min((h-f)/c,(h-d)/s));return w<e?t:{...t,framebufferWidth:Math.round(c*w)+f,framebufferHeight:Math.round(s*w)+d,pixelRatio:l*w,resample:{region:{x:Math.round((g.x-u.left)*w)+u.left,y:Math.round((g.y-u.top)*w)+u.top,width:Math.round(g.width*w),height:Math.round(g.height*w)},width:a,height:r}}}function x(t,i,h){return h||(h=D()),h.getContext("2d").createImageData(t,i)}let b=null,j=!0;function D(){return b||(b=document.createElement("canvas"),b.width=1,b.height=1),b}function v(t,i){if(!t)return i;const h=t.width,e=t.height;if(null!=h&&null!=e)return{width:Math.floor(h),height:Math.floor(e)};if(null==h&&null==e)return i;const n=i.width/i.height;return null==e?{width:Math.floor(h),height:Math.floor(h/n)}:{width:Math.floor(e*n),height:Math.floor(e)}}function q(t,i){const h={x:0,y:0,width:i.width,height:i.height};if(t&&t.area){null!=t.area.x&&(h.x=Math.floor(t.area.x)),null!=t.area.y&&(h.y=Math.floor(t.area.y));const e=null!=t.area.width?Math.floor(t.area.width):null,n=null!=t.area.height?Math.floor(t.area.height):null;if(h.width=i.width-h.x,h.height=i.height-h.y,null!=e&&null!=n)h.width=Math.min(h.width,e),h.height=Math.min(h.height,n);else if(null==e&&null!=n){const t=Math.min(h.width,e);h.height=t/h.width*h.height,h.width=t}else if(null!=e&&null==n){const t=Math.min(h.height,n);h.width=t/h.height*h.width,h.height=t}}return I(C(h,t),i)}function I(t,i){const h=Math.floor(Math.max(t.x,0)),e=Math.floor(Math.max(t.y,0)),n={x:h,y:e,width:Math.floor(Math.min(t.width,i.width-h)),height:Math.floor(Math.min(t.height,i.height-e))},o=n.width/n.height,a=t.width/t.height;if(a===o)return n;if(a>o){const t=Math.floor(n.width/a),i=n.height-t;return{x:n.x,y:Math.floor(n.y+i/2),width:n.width,height:t}}const r=Math.floor(n.height*a),l=n.width-r;return{x:Math.floor(n.x+l/2),y:n.y,width:r,height:n.height}}function C(t,i){if(!i||null==i.width||null==i.height)return t;const h=i.width/i.height,e=t.width/t.height;if(e===h)return t;if(e<h){const i=Math.floor(t.height*h);return t.x-=(i-t.width)/2,t.width=i,t}const n=Math.floor(t.width/h);return t.y-=(n-t.height)/2,t.height=n,t}function P(t,i){return!i||t&&t.ignorePadding?A:i}function k(t){switch(t){case"png":case"jpg":case"jpeg":return t;default:return U}}function B(t){t.save(),t.globalCompositeOperation="copy",t.scale(1,-1),t.translate(0,-t.canvas.height),t.drawImage(t.canvas,0,0),t.restore()}function E(t){const i=t.data,h=i.length;for(let e=0;e<h;e+=4){const t=i[e+3];if(255!==t&&t>0){const h=255/t;i[e+0]=i[e+0]*h,i[e+1]=i[e+1]*h,i[e+2]=i[e+2]*h}}}const R={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg"},H=98,U="png",W={png:100,jpg:H,jpeg:H},A={top:0,right:0,bottom:0,left:0};export{o as completeUserSettings,m as createEmptyImageData,r as encode,l as encodeData,s as getFormatAndQuality,w as getMaximumResolutionScale,p as resampleHermite,y as screenshotSuperSampleSettings,c as toDataUrl,a as toRenderSettings,M as wrapImageData};
|
package/widgets/Editor.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.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{HandleOwnerMixin as t}from"../core/HandleOwner.js";import s from"../core/Logger.js";import{isSome as i}from"../core/maybe.js";import{watch as a}from"../core/reactiveUtils.js";import{init as r,on as o,watch as n,whenNot as l}from"../core/watchUtils.js";import{aliasOf as d}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import{cast as c}from"../core/accessorSupport/decorators/cast.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import{subclass as h}from"../core/accessorSupport/decorators/subclass.js";import{getDisplayFieldName as m}from"../layers/support/fieldUtils.js";import u from"../views/interactive/snapping/SnappingOptions.js";import g from"./Attachments.js";import v from"./FeatureForm.js";import _ from"./FeatureTemplates.js";import w from"./Spinner.js";import f from"./Widget.js";import{workflowDeprecation as k}from"./Editor/deprecationUtils.js";import y from"./Editor/EditorViewModel.js";import{ItemList as b}from"./FeatureTemplates/ItemList.js";import{Heading as C,incrementHeadingLevel as M}from"./support/Heading.js";import A from"./support/SnappingControls.js";import{accessibleHandler as F}from"./support/decorators/accessibleHandler.js";import{messageBundle as W}from"./support/decorators/messageBundle.js";import{vmEvent as T}from"./support/decorators/vmEvent.js";import{tsx as S}from"./support/jsxFactory.js";import{classes as E}from"./support/widgetUtils.js";import{substitute as B}from"../intl/substitute.js";const P={base:"esri-editor esri-widget esri-widget--panel",scroller:"esri-editor__scroller",content:"esri-editor__content",contentGroup:"esri-editor__content-group",message:"esri-editor__message",controls:"esri-editor__controls",progressBar:"esri-editor__progress-bar",promptContainer:"esri-editor__prompt",promptHeader:"esri-editor__prompt__header",promptHeading:"esri-editor__prompt__header__heading",promptMessage:"esri-editor__prompt__message",promptDivider:"esri-editor__prompt__divider",promptActions:"esri-editor__prompt__actions",promptOption:"esri-editor__prompt__option",promptOptionPrimary:"esri-editor__prompt__option--primary",promptOptionNegative:"esri-editor__prompt__option--negative",promptOptionPositive:"esri-editor__prompt__option--positive",controlButton:"esri-editor__control-button",overlay:"esri-editor__overlay",warningIcon:"esri-icon-notice-triangle",widgetIcon:"esri-icon-edit",button:"esri-button",buttonDisabled:"esri-button--disabled",buttonSecondary:"esri-button--secondary",buttonTertiary:"esri-button--tertiary",input:"esri-input",interactive:"esri-interactive",select:"esri-select",panelToolbar:"esri-editor__panel-toolbar",panelToolbarSnappingButton:"esri-editor__panel-toolbar__snapping-button",panelContent:"esri-editor__panel-content",panelContentSection:"esri-editor__panel-content--section",updateFeaturesActionButtons:"esri-editor__update-features-action-buttons",updateFeaturesActionButtonsButton:"esri-editor__update-features-action-buttons--button",featureTemplatesContainer:"esri-editor__feature-templates-container",snappingControlsPopover:"esri-editor__snapping-controls-popover",scrimOverlay:"esri-editor__scrim-overlay"},j={undoRedoButtons:!1};function L(e){e.focus()}const U="esri.widgets.Editor",V=s.getLogger(U);let x=class extends(t(f)){constructor(e,t){super(e,t),this._candidateCommitted=!1,this._featureForm=new v,this._stateStack=[],this._attachments=new g({visibleElements:{addSubmitButton:!1,cancelAddButton:!1,cancelUpdateButton:!1,deleteButton:!1,errorMessage:!1,progressBar:!1,updateButton:!1}}),this._featureTemplates=new _({enableListScroll:!1}),this._filterText="",this._prompt=null,this._spinner=new w,this._snappingPopover=null,this.activeWorkflow=null,this.allowedWorkflows=null,this.useDeprecatedCreateWorkflow=!1,this.headingLevel=4,this.iconClass=P.widgetIcon,this.label=void 0,this.layerInfos=null,this.messages=null,this.messagesCommon=null,this.messagesTemplates=null,this.snappingOptions=new u,this.supportingWidgetDefaults=null,this.view=null,this.viewModel=new y,this.visibleElements={...j},this._setCandidateFeature=(e,t=!1)=>{if(this._candidateCommitted)return;const s=this._assertActiveUpdateWorkflow();s.data.edits.feature=e,t&&(s.next(),this._candidateCommitted=!0)},this._handleSave=this._handleSave.bind(this),this._handleBack=this._handleBack.bind(this),this._handleDone=this._handleDone.bind(this),this._handleDelete=this._handleDelete.bind(this),this._handleAdd=this._handleAdd.bind(this),this._handleEdit=this._handleEdit.bind(this),this._handleAttachmentAdd=this._handleAttachmentAdd.bind(this),this._handleAttachmentUpdate=this._handleAttachmentUpdate.bind(this),this._handleAttachmentDelete=this._handleAttachmentDelete.bind(this),this.EditorPanel=this.EditorPanel.bind(this)}initialize(){const{view:e,snappingOptions:t}=this;this._snappingControls=new A({snappingOptions:t,view:e,visibleElements:{header:!1}}),this.own([r(this,"headingLevel",(e=>{this._featureForm.headingLevel=M(e),this._featureTemplates.headingLevel=M(e)})),this.viewModel.featureTemplatesViewModel.on("select",(({item:e})=>this.useDeprecatedCreateWorkflow?this.startCreateWorkflowAtFeatureCreation(e):this.startCreateFeaturesWorkflowAtFeatureCreation(e))),a((()=>this.viewModel.state),((e,t)=>{const s=this._stateStack.indexOf(e);-1===s?this._stateStack.push(t):this._stateStack.splice(s)})),r(this,"viewModel",(e=>{this._featureForm.viewModel=e?e.featureFormViewModel:null,this._attachments.viewModel=e?e.attachmentsViewModel:null,this._featureTemplates.viewModel=e?e.featureTemplatesViewModel:null,this._spinner.viewModel=e?e.spinnerViewModel:null})),r(this,"view",((e,t)=>{const s=`editor-${this.id}-spinner`;t&&t.ui.remove(this._spinner,s),e&&e.ui.add(this._spinner,{key:s,position:"manual"})})),o(this,"viewModel.sketchViewModel","create",(()=>{this.scheduleRender()})),o(this,"viewModel.activeWorkflow","cancel-request",(({controller:e})=>{const{messages:t,messagesCommon:s}=this;this._prompt={title:t.cancelRequestTitle,message:t.cancelRequestWarningMessage,context:"danger",actions:{primary:{label:s.form.yes,action:()=>{e.allow(),this._prompt=null}},secondary:{label:s.form.no,action:()=>(e.deny(),this._prompt=null)}}},this.scheduleRender()})),r(this,"supportingWidgetDefaults",(e=>{e&&(this._featureForm.set(e.featureForm),this._attachments.set(e.attachments),this._featureTemplates.set(e.featureTemplates),this.viewModel.sketchViewModel.set(e.sketch))})),n(this,"_attachments.error",(e=>{if(!e)return;const{messages:t,messagesCommon:s}=this;this._prompt={title:t.errorWarningTitle,message:e.message,context:"warning",actions:{primary:{label:s.form.ok,action:()=>{this._prompt=null}}}}})),n(this,"viewModel.failures",(e=>{if(!e)return;const{messages:t}=this,[{error:s,retry:i,cancel:a}]=e;this._prompt={title:t.errorWarningTitle,message:B(t.errorWarningMessageTemplate,{errorMessage:s.message}),context:"warning",actions:{primary:{label:t.retry,action:()=>{i(),this._prompt=null}},secondary:{label:t.ignore,action:()=>(a(),this._prompt=null)}}}})),n(this,"viewModel.state",(e=>{"awaiting-feature-to-update"===e&&(this._filterText=""),"awaiting-update-feature-candidate"===e&&(this._candidateCommitted=!1)})),n(this,["_attachments.selectedFile","_attachments.submitting"],(()=>this.scheduleRender())),l(this,"viewModel.activeWorkflow",(()=>this._featureTemplates.filterText=""))])}destroy(){this._attachments.destroy(),this._featureForm.destroy(),this._featureTemplates.destroy(),this._snappingControls.destroy()}loadDependencies(){return Promise.all([import("@esri/calcite-components/dist/components/calcite-action.js"),import("@esri/calcite-components/dist/components/calcite-action-menu.js"),import("@esri/calcite-components/dist/components/calcite-button.js"),import("@esri/calcite-components/dist/components/calcite-flow.js"),import("@esri/calcite-components/dist/components/calcite-icon.js"),import("@esri/calcite-components/dist/components/calcite-loader.js"),import("@esri/calcite-components/dist/components/calcite-panel.js"),import("@esri/calcite-components/dist/components/calcite-popover.js"),import("@esri/calcite-components/dist/components/calcite-popover-manager.js"),import("@esri/calcite-components/dist/components/calcite-scrim.js"),import("@esri/calcite-components/dist/components/calcite-tooltip-manager.js")])}castVisibleElements(e){return{...j,...e}}startCreateWorkflowAtFeatureTypeSelection(){return k(V,"startCreateWorkflowAtFeatureTypeSelection","startCreateFeaturesWorkflowAtFeatureTypeSelection"),this.viewModel.startCreateWorkflowAtFeatureTypeSelection()}startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.viewModel.startCreateFeaturesWorkflowAtFeatureTypeSelection()}startCreateWorkflowAtFeatureCreation(e){return k(V,"startCreateWorkflowAtFeatureCreation","startCreateFeaturesWorkflowAtFeatureCreation"),this.viewModel.startCreateWorkflowAtFeatureCreation(e)}startCreateFeaturesWorkflowAtFeatureCreation(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureCreation(e)}startCreateWorkflowAtFeatureEdit(e){return k(V,"startCreateWorkflowAtFeatureEdit"),this.viewModel.startCreateWorkflowAtFeatureEdit(e)}startUpdateWorkflowAtFeatureSelection(){return this.viewModel.startUpdateWorkflowAtFeatureSelection()}startUpdateWorkflowAtMultipleFeatureSelection(e){return this.viewModel.startUpdateWorkflowAtMultipleFeatureSelection(e)}startUpdateWorkflowAtFeatureEdit(e){return this.viewModel.startUpdateWorkflowAtFeatureEdit(e)}deleteFeatureFromWorkflow(){return this.viewModel.deleteFeatureFromWorkflow()}cancelWorkflow(e){return this.viewModel.cancelWorkflow(e)}render(){const{_attachments:e,_prompt:t,viewModel:s}=this;if(!s)return S("div",{class:P.base});const{state:a}=s,r=i(t)?S("calcite-scrim",null,this.renderPrompt(t)):null;return S("div",{class:P.base},s.syncing||e.submitting?this.renderProgressBar():null,S("calcite-flow",null,this._stateStack.map((e=>this.renderState(e))),this.renderState(a)),r)}renderState(e){switch(e){case"disabled":break;case"ready":return this.renderLanding(e);case"awaiting-feature-creation-info":return this.renderTemplates(e);case"creating-features":case"editing-new-feature":case"editing-existing-feature":return this.renderAttributeEditing(e);case"awaiting-feature-to-update":return this.renderFeatureUpdating(e);case"awaiting-update-feature-candidate":return this.renderFeatureList(e);case"awaiting-feature-to-create":return this.renderFeatureCreation(e);case"adding-attachment":return this.renderAttachmentAdding(e);case"editing-attachment":return this.renderAttachmentEditing(e)}return S("div",null)}isPanelActive(e){return this.viewModel.state===e}renderTemplates(e){const{EditorPanel:t,headingLevel:s,messages:i,messagesCommon:a,_handleBack:r,_snappingControls:o,viewModel:{sketchViewModel:n}}=this;return S(t,{active:this.isPanelActive(e),key:"templates-panel",handleBack:r,heading:i.selectTemplate,headingLevel:s,messages:i,messagesCommon:a,sketchViewModel:n,snappingControls:o},this._featureTemplates.render())}renderAttributeEditing(e){const{activeWorkflow:t,EditorPanel:s,messages:i,messagesCommon:a,headingLevel:r,_handleBack:o,_snappingControls:n,viewModel:l}=this,{sketchViewModel:d}=l,c=l.featureFormViewModel;if("create-features"===t.type&&t.pendingFeatures.length<1)return this.renderFeatureCreation(e);const p="update"===t.type&&!t.data.edits.modified||l.syncing,h="update"===t.type?i.editFeature:i.createFeatures,m="update"===t.type?a.update:a.create,u="create-features"===t.type&&"create-new"===t.createFeatureState,g=[{label:"create-features"===t.type&&t.numPendingFeatures>1?B(i.createFeaturesTemplate,{numFeatures:t.numPendingFeatures}):m,type:"primary",disabled:p,clickHandler:this._handleSave}];let v=!1;return"update"===t.type&&(t.data.editableItem.hasAttachments&&(v=!0),t.data.editableItem.supports.includes("delete")&&g.push({label:a.delete,type:"tertiary",clickHandler:this._handleDelete})),S(s,{active:this.isPanelActive(e),key:"attribute-editing-panel",heading:h,headingLevel:r,showContentScrim:u,handleBack:o,messages:i,messagesCommon:a,sketchViewModel:d,snappingControls:n},S("div",{class:P.panelContentSection},S("div",{class:P.contentGroup},c.inputFields.length>0?this._featureForm.render():this.renderMessage(B(i.clickToFinishTemplate,{button:m})),v?S("div",{key:"attachments"},S("div",null,i.attachments),this._attachments.render()):null)),S("div",{class:this._prompt?"":P.scrimOverlay},this.renderControls(g)))}renderAttachmentAdding(e){const{_attachments:t,EditorPanel:s,_handleBack:i,headingLevel:a,messages:r,messagesCommon:o,_snappingControls:n,viewModel:{sketchViewModel:l}}=this,d=[{label:t.submitting?o.cancel:o.add,disabled:t.submitting||!t.selectedFile,type:"primary",clickHandler:this._handleAttachmentAdd}];return S(s,{active:this.isPanelActive(e),key:"attachment-adding-panel",heading:r.addAttachment,headingLevel:a,handleBack:i,messages:r,messagesCommon:o,sketchViewModel:l,snappingControls:n},S("div",{class:this.classes(P.content,P.scroller)},t.render()),this.renderControls(d))}renderAttachmentEditing(e){const{_attachments:t,EditorPanel:s,_handleBack:i,headingLevel:a,messages:r,messagesCommon:o,_snappingControls:n,viewModel:{sketchViewModel:l}}=this,d=[{label:o.update,disabled:t.submitting||!t.selectedFile,type:"primary",clickHandler:this._handleAttachmentUpdate},{label:o.delete,disabled:t.submitting,type:"tertiary",clickHandler:this._handleAttachmentDelete}];return S(s,{active:this.isPanelActive(e),key:"attachment-editing-panel",heading:r.editAttachment,headingLevel:a,handleBack:i,messages:r,messagesCommon:o,sketchViewModel:l,snappingControls:n},S("div",{class:this.classes(P.content,P.scroller)},t.render()),this.renderControls(d))}renderFeatureUpdating(e){const{EditorPanel:t,_handleBack:s,headingLevel:i,messages:a,messagesCommon:r,_snappingControls:o,viewModel:{sketchViewModel:n}}=this;return S(t,{active:this.isPanelActive(e),key:"feature-updating-panel",heading:a.selectFeature,headingLevel:i,handleBack:s,messages:a,messagesCommon:r,sketchViewModel:n,snappingControls:o},S("div",{class:this.classes(P.content,P.scroller)},this.renderMessage(a.selectFeatureToEdit)))}renderMessage(e){return S("div",{class:P.message},e)}renderFeatureCreation(e){const{EditorPanel:t,_handleBack:s,headingLevel:i,messages:a,messagesCommon:r,_snappingControls:o,viewModel:n}=this,{sketchViewModel:l}=n,d=n.sketchViewModel,c=this._assertActiveCreateWorkflow().data.creationInfo.layer,p=d.canUndo()&&d.createGraphic?d.createGraphic:null,h=this._getSketchingTip(c.geometryType,p);return S(t,{active:this.isPanelActive(e),key:"feature-creation-panel",heading:a.placeFeature,headingLevel:i,handleBack:s,messages:a,messagesCommon:r,sketchViewModel:l,snappingControls:o},S("div",{class:this.classes(P.content,P.scroller)},this.renderMessage(h)))}renderControls(e){return S("div",{class:P.controls,key:"controls"},e.map((({disabled:e=!1,label:t,type:s,clickHandler:i},a)=>this.renderButton({label:t,class:this.classes(P.controlButton,P.button,"secondary"===s?P.buttonSecondary:"tertiary"===s?P.buttonTertiary:null,e?P.buttonDisabled:null),disabled:e,clickHandler:i,key:a}))))}renderPrompt({title:e,message:t,context:s,actions:i}){const a=!!i.secondary,r=S("calcite-button",{appearance:"solid",color:"danger"===s?"red":"blue",width:a?"half":"full",onclick:i.primary.action,key:"prompt-primary-button",afterCreate:L},i.primary.label),o=a?S("calcite-button",{appearance:"clear",color:"danger"===s?"red":"blue",width:"half",onclick:i.secondary.action,key:"prompt-secondary-button"},i.secondary.label):null;return S("div",{class:`${P.promptContainer}--${s}`},S("div",{class:P.promptHeader},S("calcite-icon",{icon:"exclamation-mark-triangle"}),S(C,{class:P.promptHeading,level:this.headingLevel},e)),S("div",{class:P.promptMessage},t),S("div",{class:P.promptDivider}),S("div",{class:P.promptActions},o,r))}renderProgressBar(){return S("div",{class:this.classes(P.progressBar),key:"progress-bar"})}renderButton(e){return S("button",{class:e.class,disabled:e.disabled,key:e.key,onclick:e.clickHandler,type:"button"},e.label)}renderLanding(e){const{EditorPanel:t,headingLevel:s,messages:i,messagesCommon:a,_snappingControls:r,viewModel:{sketchViewModel:o}}=this;return S(t,{active:this.isPanelActive(e),key:"landing-panel",heading:i.widgetLabel,headingLevel:s,showBackButton:!1,messages:i,messagesCommon:a,sketchViewModel:o,snappingControls:r},S("div",{key:"edit-actions",class:P.panelContentSection},this.renderUpdateActions()),S("div",{key:"create-actions",class:P.panelContentSection},this.renderCreateActions()))}renderUpdateActions(){const{messages:e,messagesCommon:t}=this;return S("div",null,S(C,{level:M(this.headingLevel)},e.editFeatures),S("div",{class:P.updateFeaturesActionButtons},S("calcite-action",{text:t.select,textEnabled:!0,icon:"cursor",alignment:"start",class:P.updateFeaturesActionButtonsButton,onclick:this._handleEdit})))}renderCreateActions(){const{messages:e}=this;return S("div",null,S(C,{level:M(this.headingLevel)},e.createFeatures),S("div",{key:"templates",class:P.featureTemplatesContainer},this._featureTemplates.render()))}renderFeatureList(e){const{EditorPanel:t,_handleBack:s,headingLevel:i,messages:a,messagesCommon:r,messagesTemplates:o,_snappingControls:n,viewModel:{editableItems:l,sketchViewModel:d}}=this,c=this._assertActiveUpdateWorkflow().data.candidates,p=B(a.multipleFeaturesTemplate,{total:c.length}),h=new Map;let m=0;c.map((e=>({label:this._getLabel(e),id:e.attributes[e.layer.objectIdField],data:e}))).filter((e=>{const{label:t,data:s}=e,i=this._filterText.toLowerCase(),{title:a}=s.layer,r=this.viewModel.editableItems.find((e=>e.layer===s.layer));return r.supports.includes("update")&&(!i||t.toLowerCase().includes(i)||a.toLowerCase().includes(i))})).forEach((e=>{m++;const t=e.data.layer;h.has(t)?h.get(t).items.push(e):h.set(t,{id:`${t.id}`,label:t.title,items:[e]})}));const u=l.filter((({layer:e})=>h.has(e))).map((({layer:e})=>h.get(e))).toArray(),g=m>10||this._filterText.length>0;return S(t,{active:this.isPanelActive(e),key:"feature-list",heading:p,headingLevel:i,handleBack:s,messages:a,messagesCommon:r,sketchViewModel:d,snappingControls:n},b({id:this.id,enableListScroll:!1,filterEnabled:g,filterText:this._filterText,items:u,messages:{filterPlaceholder:o.filterPlaceholder,noItems:o.noItems,noMatches:o.noMatches},onItemMouseEnter:({data:e})=>this._setCandidateFeature(e),onItemMouseLeave:()=>this._setCandidateFeature(null),onItemSelect:({data:e})=>this._setCandidateFeature(e,!0),onFilterChange:e=>this._filterText=e}))}EditorPanel(e,...t){const{active:s,handleBack:i,heading:a,headingLevel:r,key:o,messages:n,messagesCommon:l,showBackButton:d,showContentScrim:c,sketchViewModel:p,snappingControls:h}=e;return S("calcite-panel",{bind:this,key:o,heading:a,headingLevel:r,showBackButton:null==d||d,beforeBack:null!=i?i:null,onCalcitePanelScroll:this._onSnappingPopoverPanelScroll},S("calcite-popover-manager",{autoClose:s,class:P.panelToolbar},S("calcite-popover",{afterCreate:this._afterSnappingPopoverCreated,afterUpdate:this._afterSnappingPopoverUpdated,bind:this,label:n.snappingSettings,heading:n.snappingSettings,"reference-element":`${o}__snappingButton`,"overlay-positioning":"fixed"},S("div",{class:P.snappingControlsPopover},h.render())),S("calcite-button",{id:`${o}__snappingButton`,text:n.snapping,appearance:"transparent",color:"neutral",alignment:"icon-end-space-between","icon-start":"vertex-gps","icon-end":"caret-down",width:"full",class:P.panelToolbarSnappingButton},n.snapping),this.visibleElements.undoRedoButtons?[S("calcite-button",{key:"undo-button",text:l.undo,appearance:"transparent",color:"neutral",alignment:"center","icon-start":"undo",scale:"l",disabled:!p.canUndo(),onclick:p.undo.bind(p)}),S("calcite-button",{key:"redo-button",text:l.redo,appearance:"transparent",color:"neutral",alignment:"center","icon-start":"redo",scale:"l",disabled:!p.canRedo(),onclick:p.redo.bind(p)})]:null),S("div",{class:E(P.panelContent,P.scroller)},t,c?S("calcite-scrim",null):null))}_onSnappingPopoverPanelScroll(){var e;null!=(e=this._snappingPopover)&&e.open&&this._snappingPopover.toggle()}_afterSnappingPopoverCreated(e){this._snappingPopover=e}_afterSnappingPopoverUpdated(e){this._snappingPopover=e}_getSketchingTip(e,t){const{messages:s}=this;if("point"===e)return s.tips.clickToAddPoint;if("polygon"===e||"polyline"===e){if(!t)return s.tips.clickToStart;const i=t.geometry,a="polygon"===e?"rings":"paths",[r]=i[a];return"polygon"===e&&r<4?s.tips.clickToContinue:s.tips.clickToContinueThenDoubleClickToEnd}return s.tips.clickToAddFeature}_getLabel(e){const t=e.layer;if(!t)return null;const{objectIdField:s}=t,{attributes:i}=e,a=m(t);return a&&i[a]&&`${i[a]}`||B(this.messages.untitledFeatureTemplate,{id:i[s]})}_handleDelete(){const{messages:e,messagesCommon:t}=this;this._prompt={title:e.deleteWarningTitle,message:e.deleteWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:()=>{this.viewModel.deleteFeatureFromWorkflow(),this._prompt=null}},secondary:{label:e.keepFeature,action:()=>this._prompt=null}}}}_handleSave(){const{featureFormViewModel:e}=this.viewModel;e.submit(),!e.submittable||e.validateContingencyConstraints(e.getValues(),{includeIncompleteViolations:!0}).length>0||this.viewModel.activeWorkflow.commit()}_handleAttachmentAdd(){const{_attachments:e}=this,{activeWorkflow:t}=this.viewModel;e.addAttachment().then((()=>t.previous()))}_handleAttachmentUpdate(){const{_attachments:e}=this,{activeWorkflow:t}=this.viewModel;e.updateAttachment().then((()=>t.previous()))}_handleAttachmentDelete(){const{messages:e,messagesCommon:t}=this;this._prompt={title:e.deleteAttachmentWarningTitle,message:e.deleteAttachmentWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:()=>{const{_attachments:e}=this,{activeWorkflow:t}=this.viewModel;e.deleteAttachment(e.viewModel.activeAttachmentInfo).then((()=>{t.previous(),this._prompt=null}))}},secondary:{label:e.keepAttachment,action:()=>this._prompt=null}}}}_handleAdd(){this.viewModel.canCreate}_handleEdit(){this.viewModel.canUpdate&&this.viewModel.startUpdateWorkflowAtFeatureSelection()}_handleDone(){this.viewModel.cancelWorkflow({force:!0})}async _handleBack(){const{messages:e}=this,t=this.activeWorkflow,s=()=>{t.hasPreviousStep?t.previous({cancelCurrentStep:!0}):this.viewModel.cancelWorkflow({force:!0})};if("create"===t.type||"create-features"===t.type&&t.numPendingFeatures>0||"update"===t.type&&t.data.edits.modified){const{type:i}=t,a="create"===i?e.cancelAddWarningMessage:e.cancelEditWarningMessage,r="create"===i?e.cancelAddTitle:e.cancelEditTitle,o="create"===i?e.continueAdding:e.continueEditing,n="create"===i?e.discardFeature:e.discardEdits;throw this._prompt={title:r,message:a,context:"danger",actions:{primary:{label:n,action:()=>{s(),this._prompt=null}},secondary:{label:o,action:()=>this._prompt=null}}},this.scheduleRender(),new Error}s()}_assertActiveCreateWorkflow(){const{type:e}=this.viewModel.activeWorkflow;if("create"===e||"create-features"===e)return this.viewModel.activeWorkflow;throw Error("Expected activeWorkflow to be instance of CreateWorkflow or CreateFeaturesWorkflow")}_assertActiveUpdateWorkflow(){if("update"===this.viewModel.activeWorkflow.type)return this.viewModel.activeWorkflow;throw Error("Expected activeWorkflow to be an UpdateWorkflow")}};e([p()],x.prototype,"_attachments",void 0),e([d("viewModel.activeWorkflow")],x.prototype,"activeWorkflow",void 0),e([d("viewModel.allowedWorkflows")],x.prototype,"allowedWorkflows",void 0),e([p()],x.prototype,"useDeprecatedCreateWorkflow",void 0),e([p()],x.prototype,"headingLevel",void 0),e([p()],x.prototype,"iconClass",void 0),e([p({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],x.prototype,"label",void 0),e([d("viewModel.layerInfos")],x.prototype,"layerInfos",void 0),e([p(),W("esri/widgets/Editor/t9n/Editor")],x.prototype,"messages",void 0),e([p(),W("esri/t9n/common")],x.prototype,"messagesCommon",void 0),e([p(),W("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],x.prototype,"messagesTemplates",void 0),e([d("viewModel.snappingOptions")],x.prototype,"snappingOptions",void 0),e([p()],x.prototype,"supportingWidgetDefaults",void 0),e([d("viewModel.view")],x.prototype,"view",void 0),e([p(),T(["workflow-cancel","workflow-commit"])],x.prototype,"viewModel",void 0),e([p()],x.prototype,"visibleElements",void 0),e([c("visibleElements")],x.prototype,"castVisibleElements",null),e([F()],x.prototype,"_handleDelete",null),e([F()],x.prototype,"_handleAttachmentAdd",null),e([F()],x.prototype,"_handleAttachmentUpdate",null),e([F()],x.prototype,"_handleAttachmentDelete",null),e([F()],x.prototype,"_handleAdd",null),e([F()],x.prototype,"_handleEdit",null),e([F()],x.prototype,"_handleDone",null),x=e([h(U)],x);const D=x;export{D as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{HandleOwnerMixin as t}from"../core/HandleOwner.js";import s from"../core/Logger.js";import{isSome as i}from"../core/maybe.js";import{watch as a}from"../core/reactiveUtils.js";import{init as r,on as o,watch as n,whenNot as l}from"../core/watchUtils.js";import{aliasOf as d}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import{cast as c}from"../core/accessorSupport/decorators/cast.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import{subclass as h}from"../core/accessorSupport/decorators/subclass.js";import{getDisplayFieldName as m}from"../layers/support/fieldUtils.js";import u from"../views/interactive/snapping/SnappingOptions.js";import g from"./Attachments.js";import v from"./FeatureForm.js";import _ from"./FeatureTemplates.js";import w from"./Spinner.js";import f from"./Widget.js";import{workflowDeprecation as k}from"./Editor/deprecationUtils.js";import y from"./Editor/EditorViewModel.js";import{ItemList as b}from"./FeatureTemplates/ItemList.js";import{Heading as C,incrementHeadingLevel as M}from"./support/Heading.js";import A from"./support/SnappingControls.js";import{accessibleHandler as F}from"./support/decorators/accessibleHandler.js";import{messageBundle as W}from"./support/decorators/messageBundle.js";import{vmEvent as T}from"./support/decorators/vmEvent.js";import{tsx as S}from"./support/jsxFactory.js";import{classes as E}from"./support/widgetUtils.js";import{substitute as B}from"../intl/substitute.js";const P={base:"esri-editor esri-widget esri-widget--panel",scroller:"esri-editor__scroller",content:"esri-editor__content",contentGroup:"esri-editor__content-group",message:"esri-editor__message",controls:"esri-editor__controls",progressBar:"esri-editor__progress-bar",promptContainer:"esri-editor__prompt",promptHeader:"esri-editor__prompt__header",promptHeading:"esri-editor__prompt__header__heading",promptMessage:"esri-editor__prompt__message",promptDivider:"esri-editor__prompt__divider",promptActions:"esri-editor__prompt__actions",promptOption:"esri-editor__prompt__option",promptOptionPrimary:"esri-editor__prompt__option--primary",promptOptionNegative:"esri-editor__prompt__option--negative",promptOptionPositive:"esri-editor__prompt__option--positive",controlButton:"esri-editor__control-button",overlay:"esri-editor__overlay",warningIcon:"esri-icon-notice-triangle",widgetIcon:"esri-icon-edit",button:"esri-button",buttonDisabled:"esri-button--disabled",buttonSecondary:"esri-button--secondary",buttonTertiary:"esri-button--tertiary",input:"esri-input",interactive:"esri-interactive",select:"esri-select",panelToolbar:"esri-editor__panel-toolbar",panelToolbarSnappingButton:"esri-editor__panel-toolbar__snapping-button",panelContent:"esri-editor__panel-content",panelContentSection:"esri-editor__panel-content--section",updateFeaturesActionButtons:"esri-editor__update-features-action-buttons",updateFeaturesActionButtonsButton:"esri-editor__update-features-action-buttons--button",featureTemplatesContainer:"esri-editor__feature-templates-container",snappingControlsPopover:"esri-editor__snapping-controls-popover",scrimOverlay:"esri-editor__scrim-overlay"},j={undoRedoButtons:!1};function L(e){e.focus()}const U="esri.widgets.Editor",V=s.getLogger(U);let x=class extends(t(f)){constructor(e,t){super(e,t),this._candidateCommitted=!1,this._featureForm=new v,this._stateStack=[],this._attachments=new g({visibleElements:{addSubmitButton:!1,cancelAddButton:!1,cancelUpdateButton:!1,deleteButton:!1,errorMessage:!1,progressBar:!1,updateButton:!1}}),this._featureTemplates=new _({enableListScroll:!1}),this._filterText="",this._prompt=null,this._spinner=new w,this._snappingPopover=null,this.activeWorkflow=null,this.allowedWorkflows=null,this.useDeprecatedCreateWorkflow=!1,this.headingLevel=4,this.iconClass=P.widgetIcon,this.label=void 0,this.layerInfos=null,this.messages=null,this.messagesCommon=null,this.messagesTemplates=null,this.snappingOptions=new u,this.supportingWidgetDefaults=null,this.view=null,this.viewModel=new y,this.visibleElements={...j},this._setCandidateFeature=(e,t=!1)=>{if(this._candidateCommitted)return;const s=this._assertActiveUpdateWorkflow();s.data.edits.feature=e,t&&(s.next(),this._candidateCommitted=!0)},this._handleSave=this._handleSave.bind(this),this._handleBack=this._handleBack.bind(this),this._handleDone=this._handleDone.bind(this),this._handleDelete=this._handleDelete.bind(this),this._handleAdd=this._handleAdd.bind(this),this._handleEdit=this._handleEdit.bind(this),this._handleAttachmentAdd=this._handleAttachmentAdd.bind(this),this._handleAttachmentUpdate=this._handleAttachmentUpdate.bind(this),this._handleAttachmentDelete=this._handleAttachmentDelete.bind(this),this.EditorPanel=this.EditorPanel.bind(this)}initialize(){const{view:e,snappingOptions:t}=this;this._snappingControls=new A({snappingOptions:t,view:e,visibleElements:{header:!1}}),this.own([r(this,"headingLevel",(e=>{this._featureForm.headingLevel=M(e),this._featureTemplates.headingLevel=M(e)})),this.viewModel.featureTemplatesViewModel.on("select",(({item:e})=>this.useDeprecatedCreateWorkflow?this.startCreateWorkflowAtFeatureCreation(e):this.startCreateFeaturesWorkflowAtFeatureCreation(e))),a((()=>this.viewModel.state),((e,t)=>{const s=this._stateStack.indexOf(e);-1===s?this._stateStack.push(t):this._stateStack.splice(s)})),r(this,"viewModel",(e=>{this._featureForm.viewModel=e?e.featureFormViewModel:null,this._attachments.viewModel=e?e.attachmentsViewModel:null,this._featureTemplates.viewModel=e?e.featureTemplatesViewModel:null,this._spinner.viewModel=e?e.spinnerViewModel:null})),r(this,"view",((e,t)=>{const s=`editor-${this.id}-spinner`;t&&t.ui.remove(this._spinner,s),e&&e.ui.add(this._spinner,{key:s,position:"manual"})})),o(this,"viewModel.sketchViewModel","create",(()=>{this.scheduleRender()})),o(this,"viewModel.activeWorkflow","cancel-request",(({controller:e})=>{const{messages:t,messagesCommon:s}=this;this._prompt={title:t.cancelRequestTitle,message:t.cancelRequestWarningMessage,context:"danger",actions:{primary:{label:s.form.yes,action:()=>{e.allow(),this._prompt=null}},secondary:{label:s.form.no,action:()=>(e.deny(),this._prompt=null)}}},this.scheduleRender()})),r(this,"supportingWidgetDefaults",(e=>{e&&(this._featureForm.set(e.featureForm),this._attachments.set(e.attachments),this._featureTemplates.set(e.featureTemplates),this.viewModel.sketchViewModel.set(e.sketch))})),n(this,"_attachments.error",(e=>{if(!e)return;const{messages:t,messagesCommon:s}=this;this._prompt={title:t.errorWarningTitle,message:e.message,context:"warning",actions:{primary:{label:s.form.ok,action:()=>{this._prompt=null}}}}})),n(this,"viewModel.failures",(e=>{if(!e)return;const{messages:t}=this,[{error:s,retry:i,cancel:a}]=e;this._prompt={title:t.errorWarningTitle,message:B(t.errorWarningMessageTemplate,{errorMessage:s.message}),context:"warning",actions:{primary:{label:t.retry,action:()=>{i(),this._prompt=null}},secondary:{label:t.ignore,action:()=>(a(),this._prompt=null)}}}})),n(this,"viewModel.state",(e=>{"awaiting-feature-to-update"===e&&(this._filterText=""),"awaiting-update-feature-candidate"===e&&(this._candidateCommitted=!1)})),n(this,["_attachments.selectedFile","_attachments.submitting"],(()=>this.scheduleRender())),l(this,"viewModel.activeWorkflow",(()=>this._featureTemplates.filterText=""))])}destroy(){this._attachments.destroy(),this._featureForm.destroy(),this._featureTemplates.destroy(),this._snappingControls.destroy()}loadDependencies(){return Promise.all([import("@esri/calcite-components/dist/components/calcite-action.js"),import("@esri/calcite-components/dist/components/calcite-action-menu.js"),import("@esri/calcite-components/dist/components/calcite-button.js"),import("@esri/calcite-components/dist/components/calcite-flow.js"),import("@esri/calcite-components/dist/components/calcite-icon.js"),import("@esri/calcite-components/dist/components/calcite-loader.js"),import("@esri/calcite-components/dist/components/calcite-panel.js"),import("@esri/calcite-components/dist/components/calcite-popover.js"),import("@esri/calcite-components/dist/components/calcite-popover-manager.js"),import("@esri/calcite-components/dist/components/calcite-scrim.js"),import("@esri/calcite-components/dist/components/calcite-tooltip-manager.js")])}castVisibleElements(e){return{...j,...e}}startCreateWorkflowAtFeatureTypeSelection(){return k(V,"startCreateWorkflowAtFeatureTypeSelection","startCreateFeaturesWorkflowAtFeatureTypeSelection"),this.viewModel.startCreateWorkflowAtFeatureTypeSelection()}startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.viewModel.startCreateFeaturesWorkflowAtFeatureTypeSelection()}startCreateWorkflowAtFeatureCreation(e){return k(V,"startCreateWorkflowAtFeatureCreation","startCreateFeaturesWorkflowAtFeatureCreation"),this.viewModel.startCreateWorkflowAtFeatureCreation(e)}startCreateFeaturesWorkflowAtFeatureCreation(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureCreation(e)}startCreateWorkflowAtFeatureEdit(e){return k(V,"startCreateWorkflowAtFeatureEdit"),this.viewModel.startCreateWorkflowAtFeatureEdit(e)}startUpdateWorkflowAtFeatureSelection(){return this.viewModel.startUpdateWorkflowAtFeatureSelection()}startUpdateWorkflowAtMultipleFeatureSelection(e){return this.viewModel.startUpdateWorkflowAtMultipleFeatureSelection(e)}startUpdateWorkflowAtFeatureEdit(e){return this.viewModel.startUpdateWorkflowAtFeatureEdit(e)}deleteFeatureFromWorkflow(){return this.viewModel.deleteFeatureFromWorkflow()}cancelWorkflow(e){return this.viewModel.cancelWorkflow(e)}render(){const{_attachments:e,_prompt:t,viewModel:s}=this;if(!s)return S("div",{class:P.base});const{state:a}=s,r=i(t)?S("calcite-scrim",null,this.renderPrompt(t)):null;return S("div",{class:P.base},s.syncing||e.submitting?this.renderProgressBar():null,S("calcite-flow",null,this._stateStack.map((e=>this.renderState(e))),this.renderState(a)),r)}renderState(e){switch(e){case"disabled":break;case"ready":return this.renderLanding(e);case"awaiting-feature-creation-info":return this.renderTemplates(e);case"creating-features":case"editing-new-feature":case"editing-existing-feature":return this.renderAttributeEditing(e);case"awaiting-feature-to-update":return this.renderFeatureUpdating(e);case"awaiting-update-feature-candidate":return this.renderFeatureList(e);case"awaiting-feature-to-create":return this.renderFeatureCreation(e);case"adding-attachment":return this.renderAttachmentAdding(e);case"editing-attachment":return this.renderAttachmentEditing(e)}return S("div",null)}isPanelActive(e){return this.viewModel.state===e}renderTemplates(e){const{EditorPanel:t,headingLevel:s,messages:i,messagesCommon:a,_handleBack:r,_snappingControls:o,viewModel:{sketchViewModel:n}}=this;return S(t,{active:this.isPanelActive(e),key:"templates-panel",handleBack:r,heading:i.selectTemplate,headingLevel:s,messages:i,messagesCommon:a,sketchViewModel:n,snappingControls:o},this._featureTemplates.render())}renderAttributeEditing(e){const{activeWorkflow:t,EditorPanel:s,messages:i,messagesCommon:a,headingLevel:r,_handleBack:o,_snappingControls:n,viewModel:l}=this,{sketchViewModel:d}=l,c=l.featureFormViewModel;if("create-features"===t.type&&t.pendingFeatures.length<1)return this.renderFeatureCreation(e);const p="update"===t.type&&!t.data.edits.modified||l.syncing,h="update"===t.type?i.editFeature:i.createFeatures,m="update"===t.type?a.update:a.create,u="create-features"===t.type&&"create-new"===t.createFeatureState,g=[{label:"create-features"===t.type&&t.numPendingFeatures>1?B(i.createFeaturesTemplate,{numFeatures:t.numPendingFeatures}):m,type:"primary",disabled:p,clickHandler:this._handleSave}];let v=!1;return"update"===t.type&&(t.data.editableItem.hasAttachments&&(v=!0),t.data.editableItem.supports.includes("delete")&&g.push({label:a.delete,type:"tertiary",clickHandler:this._handleDelete})),S(s,{active:this.isPanelActive(e),key:"attribute-editing-panel",heading:h,headingLevel:r,showContentScrim:u,handleBack:o,messages:i,messagesCommon:a,sketchViewModel:d,snappingControls:n},S("div",{class:P.panelContentSection},S("div",{class:P.contentGroup},c.inputFields.length>0?this._featureForm.render():this.renderMessage(B(i.clickToFinishTemplate,{button:m})),v?S("div",{key:"attachments"},S("div",null,i.attachments),this._attachments.render()):null)),S("div",{class:this._prompt?"":P.scrimOverlay},this.renderControls(g)))}renderAttachmentAdding(e){const{_attachments:t,EditorPanel:s,_handleBack:i,headingLevel:a,messages:r,messagesCommon:o,_snappingControls:n,viewModel:{sketchViewModel:l}}=this,d=[{label:t.submitting?o.cancel:o.add,disabled:t.submitting||!t.selectedFile,type:"primary",clickHandler:this._handleAttachmentAdd}];return S(s,{active:this.isPanelActive(e),key:"attachment-adding-panel",heading:r.addAttachment,headingLevel:a,handleBack:i,messages:r,messagesCommon:o,sketchViewModel:l,snappingControls:n},S("div",{class:this.classes(P.content,P.scroller)},t.render()),this.renderControls(d))}renderAttachmentEditing(e){const{_attachments:t,EditorPanel:s,_handleBack:i,headingLevel:a,messages:r,messagesCommon:o,_snappingControls:n,viewModel:{sketchViewModel:l}}=this,d=[{label:o.update,disabled:t.submitting||!t.selectedFile,type:"primary",clickHandler:this._handleAttachmentUpdate},{label:o.delete,disabled:t.submitting,type:"tertiary",clickHandler:this._handleAttachmentDelete}];return S(s,{active:this.isPanelActive(e),key:"attachment-editing-panel",heading:r.editAttachment,headingLevel:a,handleBack:i,messages:r,messagesCommon:o,sketchViewModel:l,snappingControls:n},S("div",{class:this.classes(P.content,P.scroller)},t.render()),this.renderControls(d))}renderFeatureUpdating(e){const{EditorPanel:t,_handleBack:s,headingLevel:i,messages:a,messagesCommon:r,_snappingControls:o,viewModel:{sketchViewModel:n}}=this;return S(t,{active:this.isPanelActive(e),key:"feature-updating-panel",heading:a.selectFeature,headingLevel:i,handleBack:s,messages:a,messagesCommon:r,sketchViewModel:n,snappingControls:o},S("div",{class:this.classes(P.content,P.scroller)},this.renderMessage(a.selectFeatureToEdit)))}renderMessage(e){return S("div",{class:P.message},e)}renderFeatureCreation(e){const{EditorPanel:t,_handleBack:s,headingLevel:i,messages:a,messagesCommon:r,_snappingControls:o,viewModel:n}=this,{sketchViewModel:l}=n,d=n.sketchViewModel,c=this._assertActiveCreateWorkflow().data.creationInfo.layer,p=d.canUndo()&&d.createGraphic?d.createGraphic:null,h=this._getSketchingTip(c.geometryType,p);return S(t,{active:this.isPanelActive(e),key:"feature-creation-panel",heading:a.placeFeature,headingLevel:i,handleBack:s,messages:a,messagesCommon:r,sketchViewModel:l,snappingControls:o},S("div",{class:this.classes(P.content,P.scroller)},this.renderMessage(h)))}renderControls(e){return S("div",{class:P.controls,key:"controls"},e.map((({disabled:e=!1,label:t,type:s,clickHandler:i},a)=>this.renderButton({label:t,class:this.classes(P.controlButton,P.button,"secondary"===s?P.buttonSecondary:"tertiary"===s?P.buttonTertiary:null,e?P.buttonDisabled:null),disabled:e,clickHandler:i,key:a}))))}renderPrompt({title:e,message:t,context:s,actions:i}){const a=!!i.secondary,r=S("calcite-button",{appearance:"solid",color:"danger"===s?"red":"blue",width:a?"half":"full",onclick:i.primary.action,key:"prompt-primary-button",afterCreate:L},i.primary.label),o=a?S("calcite-button",{appearance:"clear",color:"danger"===s?"red":"blue",width:"half",onclick:i.secondary.action,key:"prompt-secondary-button"},i.secondary.label):null;return S("div",{class:`${P.promptContainer}--${s}`},S("div",{class:P.promptHeader},S("calcite-icon",{icon:"exclamation-mark-triangle"}),S(C,{class:P.promptHeading,level:this.headingLevel},e)),S("div",{class:P.promptMessage},t),S("div",{class:P.promptDivider}),S("div",{class:P.promptActions},o,r))}renderProgressBar(){return S("div",{class:this.classes(P.progressBar),key:"progress-bar"})}renderButton(e){return S("button",{class:e.class,disabled:e.disabled,key:e.key,onclick:e.clickHandler,type:"button"},e.label)}renderLanding(e){const{EditorPanel:t,headingLevel:s,messages:i,messagesCommon:a,_snappingControls:r,viewModel:{sketchViewModel:o}}=this;return S(t,{active:this.isPanelActive(e),key:"landing-panel",heading:i.widgetLabel,headingLevel:s,showBackButton:!1,messages:i,messagesCommon:a,sketchViewModel:o,snappingControls:r},S("div",{key:"edit-actions",class:P.panelContentSection},this.renderUpdateActions()),S("div",{key:"create-actions",class:P.panelContentSection},this.renderCreateActions()))}renderUpdateActions(){const{messages:e,messagesCommon:t}=this;return S("div",null,S(C,{level:M(this.headingLevel)},e.editFeatures),S("div",{class:P.updateFeaturesActionButtons},S("calcite-action",{text:t.select,textEnabled:!0,icon:"cursor",alignment:"start",class:P.updateFeaturesActionButtonsButton,onclick:this._handleEdit})))}renderCreateActions(){const{messages:e}=this;return S("div",null,S(C,{level:M(this.headingLevel)},e.createFeatures),S("div",{key:"templates",class:P.featureTemplatesContainer},this._featureTemplates.render()))}renderFeatureList(e){const{EditorPanel:t,_handleBack:s,headingLevel:i,messages:a,messagesCommon:r,messagesTemplates:o,_snappingControls:n,viewModel:{editableItems:l,sketchViewModel:d}}=this,c=this._assertActiveUpdateWorkflow().data.candidates,p=B(a.multipleFeaturesTemplate,{total:c.length}),h=new Map;let m=0;c.map((e=>({label:this._getLabel(e),id:e.attributes[e.layer.objectIdField],data:e}))).filter((e=>{const{label:t,data:s}=e,i=this._filterText.toLowerCase(),{title:a}=s.layer,r=this.viewModel.editableItems.find((e=>e.layer===s.layer));return r.supports.includes("update")&&(!i||t.toLowerCase().includes(i)||a.toLowerCase().includes(i))})).forEach((e=>{m++;const t=e.data.layer;h.has(t)?h.get(t).items.push(e):h.set(t,{id:`${t.id}`,label:t.title,items:[e]})}));const u=l.filter((({layer:e})=>h.has(e))).map((({layer:e})=>h.get(e))).toArray(),g=m>10||this._filterText.length>0;return S(t,{active:this.isPanelActive(e),key:"feature-list",heading:p,headingLevel:i,handleBack:s,messages:a,messagesCommon:r,sketchViewModel:d,snappingControls:n},b({id:this.id,enableListScroll:!1,filterEnabled:g,filterText:this._filterText,items:u,messages:{filterPlaceholder:o.filterPlaceholder,noItems:o.noItems,noMatches:o.noMatches},onItemMouseEnter:({data:e})=>this._setCandidateFeature(e),onItemMouseLeave:()=>this._setCandidateFeature(null),onItemSelect:({data:e})=>this._setCandidateFeature(e,!0),onFilterChange:e=>this._filterText=e}))}EditorPanel(e,...t){const{active:s,handleBack:i,heading:a,headingLevel:r,key:o,messages:n,messagesCommon:l,showBackButton:d,showContentScrim:c,sketchViewModel:p,snappingControls:h}=e;return S("calcite-panel",{bind:this,key:o,heading:a,headingLevel:r,showBackButton:null==d||d,beforeBack:null!=i?i:null,onCalcitePanelScroll:this._onSnappingPopoverPanelScroll},S("calcite-popover-manager",{autoClose:s,class:P.panelToolbar},S("calcite-popover",{afterCreate:this._afterSnappingPopoverCreated,afterUpdate:this._afterSnappingPopoverUpdated,bind:this,label:n.snappingSettings,heading:n.snappingSettings,"reference-element":`${o}__snappingButton`,"overlay-positioning":"fixed",placement:"bottom"},S("div",{class:P.snappingControlsPopover},h.render())),S("calcite-button",{id:`${o}__snappingButton`,text:n.snapping,appearance:"transparent",color:"neutral",alignment:"icon-end-space-between","icon-start":"vertex-gps","icon-end":"caret-down",width:"full",class:P.panelToolbarSnappingButton},n.snapping),this.visibleElements.undoRedoButtons?[S("calcite-button",{key:"undo-button",text:l.undo,appearance:"transparent",color:"neutral",alignment:"center","icon-start":"undo",scale:"l",disabled:!p.canUndo(),onclick:p.undo.bind(p)}),S("calcite-button",{key:"redo-button",text:l.redo,appearance:"transparent",color:"neutral",alignment:"center","icon-start":"redo",scale:"l",disabled:!p.canRedo(),onclick:p.redo.bind(p)})]:null),S("div",{class:E(P.panelContent,P.scroller)},t,c?S("calcite-scrim",null):null))}_onSnappingPopoverPanelScroll(){var e;null!=(e=this._snappingPopover)&&e.open&&this._snappingPopover.toggle()}_afterSnappingPopoverCreated(e){this._snappingPopover=e}_afterSnappingPopoverUpdated(e){this._snappingPopover=e}_getSketchingTip(e,t){const{messages:s}=this;if("point"===e)return s.tips.clickToAddPoint;if("polygon"===e||"polyline"===e){if(!t)return s.tips.clickToStart;const i=t.geometry,a="polygon"===e?"rings":"paths",[r]=i[a];return"polygon"===e&&r<4?s.tips.clickToContinue:s.tips.clickToContinueThenDoubleClickToEnd}return s.tips.clickToAddFeature}_getLabel(e){const t=e.layer;if(!t)return null;const{objectIdField:s}=t,{attributes:i}=e,a=m(t);return a&&i[a]&&`${i[a]}`||B(this.messages.untitledFeatureTemplate,{id:i[s]})}_handleDelete(){const{messages:e,messagesCommon:t}=this;this._prompt={title:e.deleteWarningTitle,message:e.deleteWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:()=>{this.viewModel.deleteFeatureFromWorkflow(),this._prompt=null}},secondary:{label:e.keepFeature,action:()=>this._prompt=null}}}}_handleSave(){const{featureFormViewModel:e}=this.viewModel;e.submit(),!e.submittable||e.validateContingencyConstraints(e.getValues(),{includeIncompleteViolations:!0}).length>0||this.viewModel.activeWorkflow.commit()}_handleAttachmentAdd(){const{_attachments:e}=this,{activeWorkflow:t}=this.viewModel;e.addAttachment().then((()=>t.previous()))}_handleAttachmentUpdate(){const{_attachments:e}=this,{activeWorkflow:t}=this.viewModel;e.updateAttachment().then((()=>t.previous()))}_handleAttachmentDelete(){const{messages:e,messagesCommon:t}=this;this._prompt={title:e.deleteAttachmentWarningTitle,message:e.deleteAttachmentWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:()=>{const{_attachments:e}=this,{activeWorkflow:t}=this.viewModel;e.deleteAttachment(e.viewModel.activeAttachmentInfo).then((()=>{t.previous(),this._prompt=null}))}},secondary:{label:e.keepAttachment,action:()=>this._prompt=null}}}}_handleAdd(){this.viewModel.canCreate}_handleEdit(){this.viewModel.canUpdate&&this.viewModel.startUpdateWorkflowAtFeatureSelection()}_handleDone(){this.viewModel.cancelWorkflow({force:!0})}async _handleBack(){const{messages:e}=this,t=this.activeWorkflow,s=()=>{t.hasPreviousStep?t.previous({cancelCurrentStep:!0}):this.viewModel.cancelWorkflow({force:!0})};if("create"===t.type||"create-features"===t.type&&t.numPendingFeatures>0||"update"===t.type&&t.data.edits.modified){const{type:i}=t,a="create"===i?e.cancelAddWarningMessage:e.cancelEditWarningMessage,r="create"===i?e.cancelAddTitle:e.cancelEditTitle,o="create"===i?e.continueAdding:e.continueEditing,n="create"===i?e.discardFeature:e.discardEdits;throw this._prompt={title:r,message:a,context:"danger",actions:{primary:{label:n,action:()=>{s(),this._prompt=null}},secondary:{label:o,action:()=>this._prompt=null}}},this.scheduleRender(),new Error}s()}_assertActiveCreateWorkflow(){const{type:e}=this.viewModel.activeWorkflow;if("create"===e||"create-features"===e)return this.viewModel.activeWorkflow;throw Error("Expected activeWorkflow to be instance of CreateWorkflow or CreateFeaturesWorkflow")}_assertActiveUpdateWorkflow(){if("update"===this.viewModel.activeWorkflow.type)return this.viewModel.activeWorkflow;throw Error("Expected activeWorkflow to be an UpdateWorkflow")}};e([p()],x.prototype,"_attachments",void 0),e([d("viewModel.activeWorkflow")],x.prototype,"activeWorkflow",void 0),e([d("viewModel.allowedWorkflows")],x.prototype,"allowedWorkflows",void 0),e([p()],x.prototype,"useDeprecatedCreateWorkflow",void 0),e([p()],x.prototype,"headingLevel",void 0),e([p()],x.prototype,"iconClass",void 0),e([p({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],x.prototype,"label",void 0),e([d("viewModel.layerInfos")],x.prototype,"layerInfos",void 0),e([p(),W("esri/widgets/Editor/t9n/Editor")],x.prototype,"messages",void 0),e([p(),W("esri/t9n/common")],x.prototype,"messagesCommon",void 0),e([p(),W("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],x.prototype,"messagesTemplates",void 0),e([d("viewModel.snappingOptions")],x.prototype,"snappingOptions",void 0),e([p()],x.prototype,"supportingWidgetDefaults",void 0),e([d("viewModel.view")],x.prototype,"view",void 0),e([p(),T(["workflow-cancel","workflow-commit"])],x.prototype,"viewModel",void 0),e([p()],x.prototype,"visibleElements",void 0),e([c("visibleElements")],x.prototype,"castVisibleElements",null),e([F()],x.prototype,"_handleDelete",null),e([F()],x.prototype,"_handleAttachmentAdd",null),e([F()],x.prototype,"_handleAttachmentUpdate",null),e([F()],x.prototype,"_handleAttachmentDelete",null),e([F()],x.prototype,"_handleAdd",null),e([F()],x.prototype,"_handleEdit",null),e([F()],x.prototype,"_handleDone",null),x=e([h(U)],x);const D=x;export{D as default};
|