UNPKG

@arcgis/core

Version:

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

3 lines (2 loc) 1.96 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */ 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 h}from"../../../core/reactiveUtils.js";import{getGraphicEffectiveElevationInfo as a}from"../../../support/elevationInfoUtils.js";import{Settings as o}from"../../../views/3d/interactive/editingTools/settings.js";import{OutlineVisualElement as n}from"../../../views/3d/interactive/visualElements/OutlineVisualElement.js";import{GraphicState as m}from"../../../views/3d/layers/graphics/GraphicState.js";import{highlightsSupported as g}from"../../../views/support/layerViewUtils.js";class c{constructor(e){this._params=e,this._highlightTask=null,this._highlightHandle=null,this._visualElementHandle=null,this._settings=new o({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||!p(i))return;const t=i.layer;this._highlightTask=e(async e=>{const s=await this._params.view.whenLayerView(t);r(e),g(s)&&(this._highlightHandle=s.highlight(i))})}showReshaping(e){if(this.remove(),null==e)return;const s=this._params.view,l=new n({view:s,geometry:p(e)?e.geometry:null,attached:!1,elevationInfo:a(e),renderOccluded:8,isDecoration:!0}),r=new m({graphic:e}),o=[h(()=>r.isDraped,e=>{l.isDraped=e}),r.on("changed",()=>{l.geometry=p(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(o)}}function p(e){return null!=e.geometry&&"polyline"===e.geometry.type}export{c as InputRepresentation3D};