UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

6 lines (5 loc) 2.16 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. */ import{createTask as e}from"../../../core/asyncUtils.js";import{destroyHandle as i,handlesGroup as t}from"../../../core/handleUtils.js";import{abortMaybe as s,removeMaybe as l}from"../../../core/maybe.js";import{throwIfAborted as r}from"../../../core/promiseUtils.js";import{watch as a}from"../../../core/reactiveUtils.js";import{getGraphicEffectiveElevationInfo as h}from"../../../support/elevationInfoUtils.js";import{Settings as n}from"../../../views/3d/interactive/editingTools/settings.js";import{OutlineVisualElement as o}from"../../../views/3d/interactive/visualElements/OutlineVisualElement.js";import{GraphicState as m}from"../../../views/3d/layers/graphics/GraphicState.js";import{RenderOccludedFlag as g}from"../../../views/3d/webgl-engine/lib/Material.js";import{highlightsSupported as c}from"../../../views/support/layerViewUtils.js";class p{constructor(e){this._params=e,this._highlightTask=null,this._highlightHandle=null,this._visualElementHandle=null,this._settings=new n({getTheme:()=>this._params.view.effectiveTheme})}destroy(){this.remove()}remove(){this._highlightTask=s(this._highlightTask),this._highlightHandle=l(this._highlightHandle),this._visualElementHandle=l(this._visualElementHandle)}showHighlight(i){if(this.remove(),null==i||!u(i))return;const t=i.layer;this._highlightTask=e((async e=>{const s=await this._params.view.whenLayerView(t);r(e),c(s)&&(this._highlightHandle=s.highlight(i))}))}showReshaping(e){if(this.remove(),null==e)return;const s=this._params.view,l=new o({view:s,geometry:u(e)?e.geometry:null,attached:!1,elevationInfo:h(e),renderOccluded:g.OccludeAndTransparentStencil,isDecoration:!0}),r=new m({graphic:e}),n=[a((()=>r.isDraped),(e=>{l.isDraped=e})),r.on("changed",(()=>{l.geometry=u(e)?e.geometry:null})),s.trackGraphicState(r),s.maskOccludee(e),i(l)];this._settings.visualElements.lineObjects.outline.apply(l),l.attached=!0,this._visualElementHandle=t(n)}}function u(e){return null!=e.geometry&&"polyline"===e.geometry.type}export{p as InputRepresentation3D};