@arcgis/core 4.34.0-next.51 → 4.34.0-next.53
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/{beb77cdae0b1b6ad73da.js → 0445de3a8968c0734c91.js} +1 -1
- package/assets/esri/core/workers/chunks/{35fc8a64674005b1d1d7.js → 0a4357af5b8c0532b439.js} +1 -1
- package/assets/esri/core/workers/chunks/{b87ed14fde381f79bc9f.js → 17776d9d3558d45ea7b5.js} +1 -1
- package/assets/esri/core/workers/chunks/2efa4d8fe5454f8b2a05.js +1 -0
- package/assets/esri/core/workers/chunks/{a69e885336eb5d2729fd.js → 3505988ce3839cdbbc98.js} +1 -1
- package/assets/esri/core/workers/chunks/{46ab551bd19e52e73649.js → 3800764932a1c32cb29f.js} +1 -1
- package/assets/esri/core/workers/chunks/3c57b2e13628b5c1f6de.js +1 -0
- package/assets/esri/core/workers/chunks/{77493aa2118d462612a0.js → 43bd338bb0de375b9bb7.js} +1 -1
- package/assets/esri/core/workers/chunks/{5a016dcd3192d42d363e.js → 5fc414fc2cfc68828c5b.js} +1 -1
- package/assets/esri/core/workers/chunks/{ecd673eccf89643df07a.js → 659f7e99b2d524ef53fb.js} +2 -2
- package/assets/esri/core/workers/chunks/{037bc400257bc13b3ec8.js → 772e81e9162e2240a7a6.js} +1 -1
- package/assets/esri/core/workers/chunks/81e518dd62bd95611d00.js +1 -0
- package/assets/esri/core/workers/chunks/{f1de768b0a6d345f7e39.js → 8f6ff09e7d2f01b79faf.js} +1 -1
- package/assets/esri/core/workers/chunks/{cfa8b17cf1349f6ed355.js → 9e9be7f6ea32957f1088.js} +1 -1
- package/assets/esri/core/workers/chunks/9fef330b241f958b55df.js +1 -0
- package/assets/esri/core/workers/chunks/aab349d4624b78ef429f.js +1 -0
- package/assets/esri/core/workers/chunks/b9f5672093727c6f92c9.js +1 -0
- package/assets/esri/core/workers/chunks/bcc233a86e01ff1eac16.js +1 -0
- package/assets/esri/core/workers/chunks/cac060a187f3a27a19ba.js +1 -0
- package/assets/esri/core/workers/chunks/cda27c0fafd687dfa72e.js +1 -0
- package/assets/esri/core/workers/chunks/{82a390be9500b629f6bc.js → d0bf1fc6e3c198bc565d.js} +1 -1
- package/assets/esri/core/workers/chunks/dd2b5f115d156b5b212e.js +1 -0
- package/assets/esri/core/workers/chunks/e28d3ed65c3a76a044c8.js +1 -0
- package/assets/esri/core/workers/chunks/f75ddd79be506423be09.js +1 -0
- package/assets/esri/core/workers/chunks/{c5b2a261d8c216ca4a10.js → f8505bf69795f5293a79.js} +1 -1
- package/assets/esri/core/workers/chunks/fae6030a81cb91a91b69.js +1 -0
- package/assets/esri/core/workers/chunks/ff7962063d132c1ec814.js +1 -0
- package/assets/esri/themes/base/widgets/_FloorFilter.scss +23 -19
- package/assets/esri/themes/base/widgets/_Search.scss +12 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/config.js +1 -1
- package/identity/OAuthCredential.js +1 -1
- package/interfaces.d.ts +3 -2
- package/kernel.js +1 -1
- package/layers/KMLLayer.js +1 -1
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/graphics/data/QueryEngine.js +1 -1
- package/layers/graphics/sources/WFSSourceWorker.js +1 -1
- package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
- package/layers/graphics/sources/support/CSVSourceWorker.js +1 -1
- package/layers/graphics/sources/support/MemorySourceWorker.js +1 -1
- package/layers/support/ElevationQuery.js +1 -1
- package/layers/support/ExportImageParameters.js +1 -1
- package/networks/UtilityNetwork.js +1 -1
- package/package.json +3 -3
- package/portal/Portal.js +1 -1
- package/renderers/support/rasterRendererHelper.js +1 -1
- package/renderers/support/utils.js +1 -1
- package/request.js +1 -1
- package/rest/featureService/FeatureService.js +1 -1
- package/rest/print.js +1 -1
- package/support/revision.js +1 -1
- package/views/3d/analysis/ElevationProfile/HoveredPointsVisualization.js +1 -1
- package/views/3d/layers/PointCloudLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/webgl-engine/lib/Octree.js +1 -1
- package/views/draw/Draw.js +1 -1
- package/views/draw/support/Box.js +1 -1
- package/views/draw/support/GraphicMover.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/views/interactive/snapping/featureSources/GraphicsSnappingSource.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorker.js +1 -1
- package/views/layers/support/popupUtils.js +1 -1
- package/views/support/PromiseQueue.js +5 -0
- package/views/support/Scheduler.js +1 -1
- package/widgets/FeatureTable/Grid/support/ButtonMenu.js +1 -1
- package/widgets/FloorFilter/css.js +1 -1
- package/widgets/FloorFilter.js +1 -1
- package/widgets/HistogramRangeSlider.js +1 -1
- package/widgets/Search/css.js +1 -1
- package/widgets/Search.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/support/ItemList.js +1 -1
- package/assets/esri/core/workers/chunks/0874b88d5ae7c2b78b3b.js +0 -1
- package/assets/esri/core/workers/chunks/0c129b78e5cfe96795e1.js +0 -1
- package/assets/esri/core/workers/chunks/1a3a4c2c642899be37a0.js +0 -1
- package/assets/esri/core/workers/chunks/30169cf969d36ea8654e.js +0 -1
- package/assets/esri/core/workers/chunks/37a97e690786814bf0b3.js +0 -1
- package/assets/esri/core/workers/chunks/48e64f99720907017778.js +0 -1
- package/assets/esri/core/workers/chunks/4d544e3e19ce07c2c195.js +0 -1
- package/assets/esri/core/workers/chunks/8c1bd9bcfc59497de3b5.js +0 -1
- package/assets/esri/core/workers/chunks/8cc700da2ac58849a708.js +0 -1
- package/assets/esri/core/workers/chunks/9b7fee0adffeee8d45ae.js +0 -1
- package/assets/esri/core/workers/chunks/9d30fed26e0d84ef893b.js +0 -1
- package/assets/esri/core/workers/chunks/b29f0b32787edb4e75cf.js +0 -1
- package/assets/esri/core/workers/chunks/c87bb42f825c39f9cce3.js +0 -1
- package/assets/esri/core/workers/chunks/f667096ea325f690c4a6.js +0 -1
- package/assets/esri/core/workers/chunks/f9f94b5efa9a64cdb407.js +0 -1
- package/layers/graphics/data/executeQueryForSnapping.js +0 -5
- package/layers/support/PromiseQueue.js +0 -5
- /package/assets/esri/core/workers/chunks/{ecd673eccf89643df07a.js.LICENSE.txt → 659f7e99b2d524ef53fb.js.LICENSE.txt} +0 -0
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../Color.js";import{difference as i}from"../../../core/arrayUtils.js";import r from"../../../core/CollectionFlattener.js";import{toConst as s}from"../../../core/compilerUtils.js";import{EventedAccessor as a}from"../../../core/Evented.js";import"../../../core/has.js";import n from"../../../core/Logger.js";import{clamp as l}from"../../../core/mathUtils.js";import{destroyMaybe as o}from"../../../core/maybe.js";import{MemCachePool as h}from"../../../core/MemCachePool.js";import d from"../../../core/ObjectPool.js";import u from"../../../core/PooledArray.js";import{throwIfAborted as p,isAbortError as c,isAborted as g}from"../../../core/promiseUtils.js";import{watch as _,syncAndInitial as m,sync as f,initial as y}from"../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as T}from"../../../core/unitUtils.js";import{property as v}from"../../../core/accessorSupport/decorators/property.js";import{subclass as w}from"../../../core/accessorSupport/decorators/subclass.js";import{i as S,c as C}from"../../../chunks/vec32.js";import{create as b}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as x}from"../../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as E}from"../../../geometry/ellipsoidUtils.js";import L from"../../../geometry/SpatialReference.js";import{getProjector as P}from"../../../geometry/projection/projectors.js";import{projectPointToVector as U}from"../../../geometry/projection/projectPointToVector.js";import{projectVectorToVector as M}from"../../../geometry/projection/projectVectorToVector.js";import{create as D,equals as R,intersection as j,intersectsSphere as B,empty as I,expand as k}from"../../../geometry/support/aaBoundingRect.js";import{create as A,copy as V}from"../../../geometry/support/frustum.js";import{isPlateCarree as q}from"../../../geometry/support/spatialReferenceUtils.js";import{j as O,c as G,a as N,k as F,e as W}from"../../../chunks/sphere.js";import{ElevationQueryTileCache as H}from"../../../layers/support/ElevationQueryTileCache.js";import{isBaseLayer as $}from"../../../layers/support/layerUtils.js";import{debugFlags as Q}from"../support/debugFlags.js";import{ElevationRange as z}from"../support/ElevationRange.js";import{ElevationUpdateEvent as Y}from"../support/ElevationUpdateEvent.js";import{toBoundingRect as X}from"../support/extentUtils.js";import{updatingProgress as K}from"../support/updatingProperties.js";import{ElevationBounds as J}from"./ElevationBounds.js";import{ElevationData as Z,sampleElevation as ee}from"./ElevationData.js";import{create as te}from"./ExtentHelper.js";import{LayerClasses as ie}from"./LayerClass.js";import{OverlayManager as re}from"./OverlayManager.js";import{PlanarPatch as se}from"./PlanarPatch.js";import{ScaleRangeQueries as ae}from"./ScaleRangeQueries.js";import{SphericalPatch as ne}from"./SphericalPatch.js";import{SplitLimits as le}from"./SplitLimits.js";import{maxRootTiles as oe,tooManyRootTilesAfterChangeError as he,tooManyRootTilesForLayerError as de,maxTileNeighborLevelDelta as ue,maxMemoryLodBias as pe}from"./TerrainConst.js";import{TerrainRenderer as ce}from"./TerrainRenderer.js";import ge from"./TerrainSurfacePerformanceInfo.js";import{weakAssert as _e,isVectorTileLayerView as me,neighborEdgeIndices as fe,internalAssert as ye,oppositeEdge as Te,isSurfaceLayerView as ve,isGroupLayerView as we,isMapTileLayerView as Se,isBlendableLayerView as Ce,isElevationLayerView as be,releaseTerrainData as xe,enableTerrainInternalChecks as Ee,oppositeCorner as Le,enableWaterproofTests as Pe,enableInternalTerrainChecks as Ue,enableTerrainWaterproofChecks as Me,neighborCornerIndices as De}from"./terrainUtils.js";import{Tile as Re,lijEquals as je}from"./Tile.js";import{printAllocations as Be}from"./TilePerLayerInfo.js";import{IteratorPreorder as Ie,IteratorPostorder as ke,compareTilesByLij as Ae,hasLoadableSiblings as Ve,sortTilesByPOI as qe}from"./tileUtils.js";import{TilingSchemeLogic as Oe}from"./TilingSchemeLogic.js";import{UpsampleInfo as Ge}from"./UpsampleInfo.js";import{isCompositeBlendMode as Ne,blendModeFromString as Fe}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{hasLayerBasedScaleVisibility as We}from"../../support/layerViewUtils.js";import{ImmediateTask as He,TaskPriority as $e,noBudget as Qe}from"../../support/Scheduler.js";import{TextureCompressionTracker as ze}from"../../support/TextureCompressionTracker.js";import{Yield as Ye}from"../../support/Yield.js";var Xe;let Ke=class extends a{static{Xe=this}get allTiles(){return s(this._allTiles)}get demResolution(){const{_allTiles:e,tilingScheme:t}=this;if(0===e.length)return{min:1,max:1};const i=T(t.spatialReference);let r=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;for(const a of e){const e=t.resolutionAtLevel(a.level)*i;r=Math.min(r,e),s=Math.max(s,e)}return{min:r,max:s}}constructor(e){super(e),this.terrainTextureCompressionTracker=new ze,this._iteratorPool=new d(Ie,e=>e.remove=()=>this._iteratorPool.release(e)),this._postorderIterator=new ke,this._hasPendingUpdates=!1,this._pendingUpdates=0,this._asyncWorkItems=0,this._allTilesDirty=!0,this._allTilesSorted=!0,this._usedMemory=null,this._performanceInfo=new ge,this._viewChanged=!1,this.heading=0,this._inFrameTask=!1,this._viewChangeUpdateDirty=!1,this._eyePosRenderSR=b(),this._eyePosSurfaceSR=b(),this._splitLimits=new le,this._frustum=A(),this._layerViews=[new Array,new Array],this._layerIndexByUid=[new Map,new Map],this._basemapLayerViewHandles=new Map,this._watchUpdatingTracking=new x,this._frameTask=He,this._allTiles=new u,this._upsampleInfoPool=new d(Ge),this._shouldEmitChangeEvent=!1,this._rootTilesExtent=D(),this.updatingProgress=.5,this._maxNumUpdating=1,this.maxTextureScale=1.2,this._spatialReference=L.WebMercator,this._elevationProjectorCache=new Map,this.visibleElevationBounds=new J(1/0,-1/0),this.rootTileElevationBounds=new J(1/0,-1/0),this._projectorCache=new Map,this._radiusModifier=Math.cos(Math.PI/16/16),this._tilingSchemeSpatialReference=null,this._updatingRootTiles=!1,this._pendingTilesForElevationUpdateEvent=new Set,this._pendingTilesToUpdate=new Set,this.totalGeometryUpdates=0,this.totalTileUpdates=0,this._oneBatchPerFrameTask=!0,this._layerViewsDirty=!1,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._isWebMercator=!1,this._isWebMercatorOnPlateCarree=!1,this._enabled=!0;const t=e.view;this.overlayManager=new re({...e,surface:this}),this._isGlobal=!t.state?.isLocal,this._isGeographic=this._spatialReference?.isGeographic??!1,this._tileConstructor=this._isGlobal?ne:se,this._ellipsoid=E(t.spatialReference),this._renderer=new ce(this.overlayManager.renderer,t.stage,this._allTiles,this._ellipsoid.radius,this.terrainTextureCompressionTracker,t.resourceController.memoryController),We()||(this._scaleRangeQueries=new ae)}initialize(){const e=this.view,t=e.resourceController,i=t.memoryController;this._tileCache=new h((e,t)=>i.newCache(e,t),"terrain-tile"),this._upsampleMapCache=i.newCache("terrain-upsample",e=>e.unloadMapData()),this._elevationQueryCache=new H(i.newCache("elevation-query"));const s=this.overlayManager;this.addHandles([_(()=>s.renderer.isEmpty,()=>this._evaluateTransparency()),_(()=>this.renderer.visible,e=>this.suspended=!e),_(()=>this.heading,e=>{this._renderer.updateHeading(e),this._updateTileTextures(0)}),_(()=>({heading:e.camera?.heading,state:e.state?.mode}),({heading:e,state:t})=>{if(null==e)return;if(this.isGlobal&&this.isGeographic||this.isWebMercatorOnPlateCarree)return void(this.heading=90*Math.round(e/90)%360);const i=Math.round(e)%360,r=Math.abs(i-this.heading);(2===t||Math.min(r,360-r)>=30)&&(this.heading=i)})],"overlayManager"),this.addHandles([_(()=>this.baseOpacity,()=>{this._handleLayerViewChanges(),this._updateTileTextures(this._evaluateTransparency()?1:2)},m),_(()=>this.hasCompositeBlendMode,()=>this._updateTileTextures(this._evaluateTransparency()?1:2),m),_(()=>this.backgroundColor,(e,t)=>{e?.equals(t)||(this._handleLayerViewChanges(),this._renderer.updateTileBackground(e))},f),_(()=>this.snapLevel,()=>this._viewChanged=!0,f),_(()=>this.view.pointsOfInterest,e=>{this._renderer.pointsOfInterest=e,this._watchUpdatingTracking.removeAll(),e&&this._watchUpdatingTracking.add(()=>e.focus?.renderLocation,()=>this._allTilesSorted=!1)}),_(()=>Q.TERRAIN_TILE_TREE_SHOW_TILES,t=>{t&&!this._treeDebugger?import("../layers/support/TerrainTileTree3DDebugger.js").then(({TerrainTileTree3DDebugger:t})=>{!this._treeDebugger&&Q.TERRAIN_TILE_TREE_SHOW_TILES&&(this._treeDebugger=new t({view:e}))}):t||(this._treeDebugger=o(this._treeDebugger))},y)]);const{spatialReference:a}=e;this._extentHelper=te(this.viewingMode,{layers:e.map.allLayers,layerViews:e.allLayerViews,viewSpatialReference:a});const n=new r({getCollections:()=>e.defaultsFromMap?.mapCollections?.map(({layers:e})=>e),getChildrenFunction:e=>e&&"layers"in e?e.layers:null}),l=new Oe({layers:n,extentHelper:this._extentHelper,viewingMode:this.viewingMode,viewSpatialReference:a});this._set("tilingSchemeLogic",l),this._updateTilingScheme(),this._elevationDataRequester=t.createStreamDataRequester(0),this._mapDataRequester=t.createStreamDataRequester(1);const d=t.scheduler;this._frameTask=d.registerTask($e.TERRAIN_SURFACE,this),this.addHandles([_(()=>this._extentHelper.stencilEnabledExtents,e=>this._renderer.setStencilEnabledLayerExtents(e),y),_(()=>this.tilingSchemeLogic.tilingScheme,()=>this._updateTilingScheme(),f),_(()=>this.extent,()=>this._updateRootTiles(),y),e.on("resize",()=>this._viewChangeUpdate()),_(()=>{const t=e.state;return[this._lodBias,this.lodSnappingEnabled,e.quality,t.camera,t.contentCamera,t.fixedContentCamera]},()=>this._viewChangeUpdate(),m),_(()=>e.qualitySettings?.fadeDuration,e=>this._renderer.textureFadingEnabled=e>0,y),_(()=>e.qualitySettings?.physicallyBasedRenderingEnabled,e=>this._renderer.pbrMode=e?5:0,y),_(()=>e.qualitySettings?.tiledSurface.elevationLevelDelta,()=>this._updateAllTileGeometries()),_(()=>this._userClippingExtent,()=>this._updateClippingExtent(),f)]),this.addHandles(e.allLayerViews.on("after-changes",()=>this._layerViewsDirty=!0)),this._layerViewsDirty=!0,this._handleLayerViewChanges(),this._renderer.updateTileBackground(this.backgroundColor)}clearHandles(){this._watchUpdatingTracking?.removeAll(),this.removeAllHandles(),this._basemapLayerViewHandles.forEach((e,t)=>this._unregisterTiledLayerView(t)),this._basemapLayerViewHandles.clear()}destroy(){this._frameTask.remove(),this._frameTask=He,this._watchUpdatingTracking?.destroy(),this._removeAllTiles(),this._set("tilingSchemeLogic",o(this.tilingSchemeLogic)),this._basemapLayerViewHandles.forEach((e,t)=>this._unregisterTiledLayerView(t)),this._basemapLayerViewHandles.clear(),this._elevationDataRequester=null,this._mapDataRequester=null,this._set("overlayManager",o(this.overlayManager)),this._tileCache=o(this._tileCache),this._allTiles.prune(),Re.prune(),this._treeDebugger=o(this._treeDebugger),this._renderer.destroyed||this._renderer.destroy(),this._renderer=null,this._iteratorPool=o(this._iteratorPool),this._upsampleMapCache=o(this._upsampleMapCache),this._elevationQueryCache=o(this._elevationQueryCache),this._set("view",null),this._extentHelper=o(this._extentHelper),this._upsampleInfoPool=o(this._upsampleInfoPool),Be(),this._layerViews.forEach(e=>e.length=0),this._performanceInfo=null}get renderer(){return this._renderer}get frustum(){return this._frustum}get snapLevel(){if(this.lodSnappingEnabled){const{view:e,tilingScheme:t}=this,i=e.scale;if(t&&i){const r=t.levelAtScale(i)+e.qualitySettings.tiledSurface.lodBias,s=t.getMaxLod();return r<=0?null:Math.min(r,s||1/0)}}return null}get lodSnappingEnabled(){return this.view.qualitySettings.tiledSurface.reduceTileLevelDifferences}get upsampleInfoPool(){return this._upsampleInfoPool}get upsampleMapCache(){return this._upsampleMapCache}get elevationQueryCache(){return this._elevationQueryCache}get hasStencilEnabledExtents(){return this._extentHelper.stencilEnabledExtents.length>0}get _userClippingExtent(){const{spatialReference:e}=this,t=this.view?.clippingArea;if(null==t||null==e)return null;const i=D(),r=X(t,i,e)?i:null,s=this._get("extent");return R(r,s)?s:r}get rootTilesExtent(){return this._rootTilesExtent}get extent(){const e=j(this.groundExtent,this._userClippingExtent,D()),t=this._get("extent");return R(e,t)?t:e}get groundExtent(){return null!=this._tilingSchemeExtent?this._tilingSchemeExtent:this._rootTilesExtent}get _tilingSchemeExtent(){return this.tilingSchemeLogic?.extent}get updating(){return this._hasPendingUpdates||(this._maxNumUpdating=1),!!((this.readyToRun||this._watchUpdatingTracking?.updating||this._asyncWorkItems>0)&&this.ready&&!this.suspended||this.overlayManager?.updating||this.terrainTextureCompressionTracker.compressing)}get readyToRun(){return(this._hasPendingUpdates||this._viewChanged||this._allTilesDirty||!this._allTilesSorted||this._layerViewsDirty||this._scaleRangeQueries?.updating||this._frameTask.updating)&&this.ready&&!this.suspended}get updatingProgressValue(){return this._maxNumUpdating=Math.max(this._pendingUpdates,this._maxNumUpdating),1-this._pendingUpdates/this._maxNumUpdating}get baseOpacity(){return this.view?.map?.ground?.opacity??1}set baseOpacity(e){this.view.map.ground.opacity=e}get viewingMode(){return this.view.state.viewingMode}get ready(){return null!=this._rootTiles}get rootTiles(){return this._rootTiles}get spatialReference(){return this.tilingScheme?.spatialReference??null}get backgroundColor(){return this.view?.map?.ground?.surfaceColor}set backgroundColor(e){this.view.map.ground.surfaceColor=e}set slicePlaneEnabled(e){this._renderer.slicePlaneEnabled=e,this._set("slicePlaneEnabled",e),this._evaluateTransparency()}get tilingSchemeLocked(){return this.tilingSchemeLogic?.tilingSchemeLocked??!1}get wireframe(){return this._renderer?.wireframe}set wireframe(e){e!==this._renderer.wireframe&&(this._renderer.wireframe=e,this._updateAllTileGeometries())}get opaque(){return 0===this._renderer.transparency}get invisible(){return 3===this._renderer.transparency}set suspended(e){this._set("suspended",e),this._viewChangeUpdate()}get fadeDuration(){return this.view.qualitySettings.fadeDuration??0}intersect(e,t,i,r){this._renderer.intersect(e,t,i,r)}getElevationLevelDelta(e){return e<4?3:this.view.qualitySettings.tiledSurface.elevationLevelDelta}getElevation(e,t,i,r){const s=this._rootTiles;if(!s?.length||!this._enabled)return null;if(0===s[0].layerInfo[0].length)return null;let a=this._elevationProjectorCache.get(r);if(void 0===a&&(a=P(r,this._spatialReference)??null,this._elevationProjectorCache.set(r,a)),null==a)return n.getLogger(this).error("TerrainSurface.getElevation(): could not project given point to tiling scheme coordinate system"),null;const l=S(Ze,e,t,i);a(l,0,l,0);return at(s,l[0],l[1])}getElevations(e,t,i){const r=this._rootTiles,s=r?r[0].layerInfo[0].length:0;if(r?.length&&0!==s&&this._enabled)for(let a=0;a<t;++a){const t=3*a;i(a,at(r,e[t],e[t+1]))}else for(let a=0;a<t;++a)i(a,null)}getLayerIndexByUID(e,t){return this._layerIndexByUid[e].get(t)}getScale(e){if(!this.tilingScheme)return null;if(!U(e,Ze,this.spatialReference))return n.getLogger(this).error("TerrainSurface.getScale(): could not project given point to tiling scheme coordinate system"),null;const t=this._rootTiles;if(null!=t)for(const i of t)if(i?.containsPoint(Ze)){let e=i;for(;e.children[0]&&!e.rendered;){const t=e.children[0].extent;let i=0;Ze[0]>t[2]&&(i+=1),Ze[1]<t[1]&&(i+=2),e=e.children[i]}return this._getLodBiasCorrectedScale(e.level)}return 1/0}_ensureProjector(e){const t=this._projectorCache.get(e);if(t)return t;const i=P(e,this._tilingSchemeSpatialReference)??null;return this._projectorCache.set(e,i),i}getSphereElevationBounds(e,t){const i=this._ensureProjector(t);if(null==i)return n.getLogger(this).error("TerrainSurface.getSphereElevationBounds(): could not project given point to tiling scheme coordinate system"),null;O(e,et);const r=N(et);i(r,0,r,0),F(et,r);const s=new z,a=this._rootTiles;if(null!=a){const e=[];for(const i of a)e.push(i);let t=0;for(;t<e.length;){const i=e[t];if(++t,!B(i.extent,et))continue;const r=i.children;if(null==r[0]||i.rendered)s.expandElevationRangeValues(i.elevationBoundsMin,i.elevationBoundsMax);else for(const t of r)e.push(t)}}return s}getRootElevationBounds(){return new z(this.rootTileElevationBounds.min,this.rootTileElevationBounds.max)}getLowerBoundRadius(){const e=(this._ellipsoid.radius+this.visibleElevationBounds.min)*this._radiusModifier;return Math.min(e,this._ellipsoid.radius)}getSphereScale(e,t){if(!this.tilingScheme)return null;if(!U(e,pt,this.spatialReference))return n.getLogger(this).error("TerrainSurface.getSphereScale(): could not project given point to tiling scheme coordinate system"),null;W(et,pt,t);let i=null;const r=e=>{if(e&&B(e.extent,et)){const t=e.children;if(t[0]&&!e.rendered)for(const e of t)r(e);else{const t=this._getLodBiasCorrectedScale(e.level);i=null==i?t:Math.min(i,t)}}},s=this._rootTiles;if(null!=s)for(const a of s)r(a);return i}queryVisibleScaleRange(e,t,i,r){if(!this._scaleRangeQueries)return;const s=t?this.tilingScheme.levelAtScale(t):0,a=i?this.tilingScheme.levelAtScale(i):1/0,n=this._lodBias;this._scaleRangeQueries.queryVisibleLevelRange(e,s+n,a+n,r)}_evaluateTransparency(){const e=this.baseOpacity,t=this.overlayManager.renderer.isEmpty,i=this._renderer.transparency,r=this._isFullyTransparent?t?3:2:e>=1&&!this.hasCompositeBlendMode&&!this._renderer.slicePlaneEnabled?0:1;return this._renderer.transparency=r,i!==r}_updateTilingScheme(){const e=this.tilingSchemeLogic.tilingScheme;if(!(e!==this.tilingScheme))return;_e(!!e,"tiling scheme cannot be reset to undefined"),this._isGlobal=!this.view?.state?.isLocal,this.tilingScheme&&this._removeAllTiles();const t=e?.spatialReference??L.WebMercator;this._spatialReference=t,this._isWebMercator=!!t?.isWebMercator,this._isWebMercatorOnPlateCarree=this._isWebMercator&&q(this.view?.renderSpatialReference),this._isGeographic=t?.isGeographic??!1,this._set("tilingScheme",e),this._tilingSchemeSpatialReference=this.tilingScheme?.spatialReference,this._projectorCache.clear(),this._updateClippingExtent(),e&&(this._updateTiledLayers(),this._renderer.tileSize=e.pixelSize,this.overlayManager.spatialReference=e.spatialReference,this._updateRootTiles())}static{this._tileMemcacheKey="TerrainTileMemcache"}_acquireTile(e,t,i,r){const s=this._tileCache.pop(Xe._tileMemcacheKey);return s?(s.init(e,t,i,r,this),s):new this._tileConstructor(e,t,i,r,this)}get updatingRootTiles(){return this._updatingRootTiles}_updateRootTiles(){const{extent:e,tilingScheme:t}=this;if(!t)return;const r=tt;let s=t.rootTilesInExtent(e,r,5*oe);if(null!=this._rootTiles){if(s.length>oe)return void n.getLogger(this).warn(he);const e=this._rootTiles.map(e=>e.lij),t=i(e,s,je);if(this._updatingRootTiles=!0,t.removed.length>0||t.added.length>0){const e=this._rootTiles.filter(e=>!(t.removed.findIndex(t=>je(t,e.lij))>-1)||(this._purgeTile(e),!1));t.added.forEach(t=>e.push(this._newRootTile(t))),this._setRootTiles(e)}}else this._updatingRootTiles=!0,s.length>oe&&(n.getLogger(this).warn(de),s=t.rootTilesInExtent(e,r,oe)),this._setRootTiles(s.map(e=>this._newRootTile(e)));R(r,this._rootTilesExtent)||(this._rootTilesExtent=D(r)),this.renderer.visible=!0,this._viewChangeUpdate(),this.overlayManager.setPlacementDirty(),this.notifyChange("ready"),this._updateAllTileGeometries(),this._updatingRootTiles=!1,this.checkAllTilesWaterproofness()}_updateAllTileGeometries(){const e=this._allTiles.filter(e=>e.loaded&&e.intersectsClippingArea);e.sort(Ae),e.forEach(e=>this._renderer.updateTileGeometryState(e)),e.forEach(e=>e.renderData.updateNeighborData()),this._updateTilesGeometries(e),this._pendingTilesToUpdate.clear()}_updateTilesGeometries(e){if(0===e.length)return;e.sort(Ae);const t=this.renderer;e.forEach(e=>t.updateGeometryIfNeeded(e)),e.forEach(e=>this._pendingTilesForElevationUpdateEvent.add(e))}_shouldSplit(e){return 1===e.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.snapLevel)}_newRootTile(e){const t=this._acquireTile(0,e[1],e[2],null);return this._shouldSplit(t)&&t.setPendingUpdate(1),this._loadTile(t),this._markTileToUpdate(t),this._updateRootTileElevationBounds(),t}_setRootTiles(e){if(this._rootTiles=e,this._allTiles.clear(),null!=e){const t=this._iteratorPool.acquire();for(t.reset(e);!t.done;)this._allTiles.push(t.next());t.remove()}this._renderer.setRootTiles(this._rootTiles),this._updateTilesVisibility(e),this.notifyChange("demResolution"),this.emit("tiles-changed",{allTiles:this.allTiles})}_runViewChangeUpdateIfDirty(){this._viewChangeUpdateDirty&&(this._viewChangeUpdateDirty=!1,this._viewChangeUpdate())}_viewChangeUpdate(){this.view&&!this.suspended&&this.tilingScheme&&this.renderer.visible&&(this._inFrameTask?this._viewChangeUpdateDirty=!0:(this._viewChangeUpdateDirty=!1,this._updateViewDependentParameters(),this._updateTilesVisibility(this._rootTiles)))}_updateClippingStatus(e){e.updateClippingStatus(this.extent)&&e.resetPendingUpdate(8)&&this._updateTileGeometryState(e)}_updateTilesVisibility(e){if(null==e)return;const t=Ve(e),i=this.visibleElevationBounds;let r=t?i.min:1/0,s=t?i.max:-1/0;const a=this.extent,n=this.view.state.contentCamera.viewProjectionMatrix;this.setTileTreeDirty();const l=this._iteratorPool.acquire();for(l.reset(e);!l.done;){const e=l.next();e.updateClippingStatus(a)&&e.resetPendingUpdate(8)&&this._updateTileGeometryState(e),e.computeVisibility(),e.updateScreenDepth(n),e.renderData&&(r=Math.min(e.elevationBoundsMin,r),s=Math.max(e.elevationBoundsMax,s))}l.remove(),this._viewChanged=!0,this._allTilesDirty=!0,this._updatePendingTileGeometries(),isFinite(r)&&isFinite(s)&&(i.min!==r||i.max!==s)&&(this.visibleElevationBounds=new J(r,s))}_updateRootTileElevationBounds(){let e=1/0,t=-1/0;const i=this._rootTiles;null!=i&&i.forEach(({elevationBoundsMin:i,elevationBoundsMax:r})=>{e=Math.min(e,i),t=Math.max(t,r)});const r=this.rootTileElevationBounds;r.min===e&&r.max===t||(this.rootTileElevationBounds=new J(e,t))}_updateViewDependentParameters(){const{camera:e,contentCamera:t}=this.view.state,i=Math.tan(.5*t.fovX),r=Math.tan(.5*t.fovY),s=this.tilingScheme.pixelSize,a=2**-this._lodBias*e.pixelRatio;this._splitLimits.aboveGround=e.aboveGround,this._splitLimits.fovX=i,this._splitLimits.fovY=r,this._splitLimits.relativeWidthLimit=s/e.width*this.maxTextureScale*a,this._splitLimits.relativeHeightLimit=s/e.height*this.maxTextureScale*a,this._splitLimits.maxLod=this.tilingScheme.getMaxLod(),this._splitLimits.angledSplitBias=this.view.qualitySettings.tiledSurface.angledSplitBias,this.view.state.fixedContentCamera?this._splitLimits.frustum=V(this._splitLimits.frustum??A(),t.frustum):this._splitLimits.frustum=null,V(this._frustum,e.frustum),C(this._eyePosRenderSR,t.eye),M(e.eye,this.view.renderSpatialReference,this._eyePosSurfaceSR,this.spatialReference)}_updateTileGeometryState(e){e.updateVisibility();this._renderer.updateTileGeometryState(e)&&this._markTileToUpdate(e),this.setMemoryDirty()}_markAllTileNeighborsForUpdate(e){e.forEachLoadedNeighbor(e=>{this._layerViews[1].some(me)&&e.setPendingUpdate(32),this._pendingTilesToUpdate.add(e)})}_updateTileTexture(e,t){const i=e.resetPendingUpdate(32)?32:!!e.resetPendingUpdate(16)&&16;i&&(this._renderer.updateTileTexture(e,i),this._usedMemory=null,t.madeProgress())}_emitElevationUpdateEventForTiles(){if(!this._shouldEmitChangeEvent)return;const e=rt.extent;I(e),this._pendingTilesForElevationUpdateEvent.forEach(t=>k(e,t.extent,e)),this._pendingTilesForElevationUpdateEvent.clear(),rt.spatialReference=this.spatialReference,this.emit("elevation-change",rt),this._shouldEmitChangeEvent=!1}runTask(e){this._handleLayerViewChanges(e),this._frameTask.processQueue(e),this.renderer.processScaleRangeQueries(this._scaleRangeQueries,e),this._inFrameTask=!0,this._pendingUpdates=0,this._hasPendingUpdates=!1,this._updateAllTilesStatus(e),this._sortTiles(e);const t=!this.view.state.fixedContentCamera;if(this._mergeAndSplit(e,t),this._updateElevation(e),this._updateTextures(e),t||this._mergeAndSplit(e,!0),this._inFrameTask=!1,this._runViewChangeUpdateIfDirty(),this._updatePendingTileGeometries(),this._emitElevationUpdateEventForTiles(),e.done&&e.hasProgressed&&this.requestUpdate(),this.notifyChange("updatingProgressValue"),Ee&&this._checkTileInvariant(),!e.hasProgressed)return Ye}_checkTileInvariant(){const e=new Map;this._allTiles.forAll(t=>e.set(t,new Set)),this._allTiles.forAll(t=>{if(_e(t.rendered===t.leaf,` rendered ${t.rendered} != ${t.leaf} leaf`),!t.leaf){const e=e=>0===e.unmergableChildCount&&0===e.maxLevelDeltaNeighborCount,i=t.children.reduce((t,i)=>t+(e(i)?0:1),0);if(_e(t.unmergableChildCount===i,` Tile[${t.lij.toString()}] unmergeable child count mismatch: actual ${t.unmergableChildCount} vs ${i}`),t.hasPendingUpdate(4)){_e(!t.hasPendingUpdate(1),"Tile can be both split and merge at the same time");for(const e of t.children)_e(e.leaf||e.hasPendingUpdate(4),"Child of tile to merge must also merge")}}for(let i=0;i<4;++i){if(t.rendered){const e=t.renderData?.geometryState.edgePeerNeighbors[i];if(null!=e){{const r=t.level-e.level<=ue;r||(console.log(`tile level delta [${t.lij.toString()}] vs [${e.lij.toString()}] > ${ue} (edge[${i}])`),_e(r,`tile level delta [${t.level}] vs [${e.level}] > ${ue}`))}_e(t.level-e.level<=ue,`Max tile lod delta exceeded: [${t.lij.toString()}] vs [${e.lij.toString()}]`)}}const r=t.level-ue,s=e=>e.leaf||e.level===t.level,a=t.findNeighborTile(fe[i],s);if(null!=a){if(t.leaf&&t.level>=ue){let i=a;for(;t.level-i.level<ue;)i=i.parent;const s=[r,t.lij[1]>>ue,t.lij[2]>>ue];if(!je(s,i.lij)){const r=e.get(i);_e(!r.has(t),"Cannot already have neighbor"),r.add(t)}}_e(a.rendered||a.level===t.level,"Non-same-level-neighbor of rendered must be rendered"),_e(t.level-a.level<=ue,`Tile level delta [${t.level}] vs [${a.level}] > ${ue}`)}}}),this._allTiles.forAll(t=>{const i=t.maxLevelDeltaNeighborCount,r=e.get(t);_e(i===r.size,`Tile[${t.lij.toString()}] merge-blocker mismatch: actual ${i} vs ${r.size}`)})}_updateAllTilesStatus(e){if(!this._viewChanged||!this._rootTiles||e.done)return;this._viewChanged=!1;const t=new nt(this._allTiles.length);t.pushAll(this._rootTiles);const i=this.snapLevel,r=this._splitLimits,s=this._eyePosRenderSR;this._allTiles.forAll(e=>{e.maxLevelDeltaNeighborCount=0,e.unmergableChildCount=0});const a=this.view.state.contentCamera.viewProjectionMatrix;for(;!t.empty;){const e=t.pop(),n=e.parent,l=null!=n&&n.hasPendingUpdate(4),o=l?4:e.shouldSplit(r,s,i),h=1===o;e.leaf?lt(e,h):t.pushAll(e.children),l?(e.resetPendingUpdate(1),e.leaf||e.setPendingUpdate(4),this._updateClippingStatus(e),e.updateVisibility(),e.updateScreenDepth(a)):h?(e.resetPendingUpdate(4),e.leaf&&e.setPendingUpdate(1)):(e.resetPendingUpdate(1)&&e.updateAgentSuspension(),2===o&&e.updateAgents(0),e.leaf||(e.setPendingUpdate(4),e.resetPendingUpdate(1)))}this.requestUpdate(),(this._shortBatches||!this._oneBatchPerFrameTask)&&this._updatePendingTileGeometries(),e.madeProgress()}_sortTiles(e){e.done||this._allTilesSorted||!this.view.pointsOfInterest?.focus||(qe(this._allTiles,this.view.pointsOfInterest.focus.renderLocation),this._allTilesSorted=!0,this._treeDebugger&&this._treeDebugger.update(),e.madeProgress())}_markTileToUpdate(e){ye(e.loaded),e.intersectsClippingArea&&(this._pendingTilesToUpdate.add(e),this._markAllTileNeighborsForUpdate(e))}_updatePendingTileGeometries(){const e=this._pendingTilesToUpdate,t=Array.from(e.keys()).filter(e=>e.loaded&&e.intersectsClippingArea);if(0===t.length)return void e.clear();const i=(i,r)=>{!r?.loaded||!r.intersectsClippingArea||r.level<i.level||e.has(r)||(e.add(r),t.push(r),r.renderData.updateNeighborData())};t.sort(Ae);const r=t.length;for(let s=0;s<r;++s){const r=t[s];ye(r.loaded),ye(r.intersectsClippingArea);const a=r.renderData;a.updateNeighborData();const n=a.dirtyEdgeResolutions,l=a.geometryState,o=e=>{const t=De[e];i(r,l.cornerPeerNeighbors[e]?.findCorner(Le(t),e=>e.loaded))};for(let t=0;t<4;++t)if(n&1<<t){const s=a.geometryState.edgePeerNeighbors[t];s&&s?.level>=r.level&&s.forAllSubtreeOnSide(Te(fe[t]),t=>!(!t.loaded||!t.intersectsClippingArea)&&(ye(e.has(t)||Ae(r,t)<0),i(r,t),!0)),o((t+1)%4),o(t)}}e.clear(),this._updateTilesGeometries(t),this._shouldEmitChangeEvent=!0,Ee&&Pe&&this.checkAllTilesWaterproofness()}_mergeAndSplit(e,t){if(this.suspended||e.done||!this._allTilesDirty)return;this._allTilesDirty=!1,this.requestUpdate();let i=!1;const r=this.view.state.fixedContentCamera;let s=!1;for(;!e.done;){s=!0;let a=!1;const n=!this._allTiles.some(s=>{if(!i&&!r&&!s.visible)return e.done;let n=s;if(s.hasPendingUpdate(4)){if(!t||s.unmergableChildCount>0)return e.done;for(s.resetPendingUpdate(4);null!=n.parent&&0===n.parent.unmergableChildCount&&n.parent.resetPendingUpdate(4);)n=n.parent;this._mergeTile(n),a=!0,e.madeProgress()}else if(s.resetPendingUpdate(1)){let t=!0;const i=s.level;if(i>=ue){const e=e=>e.leaf||i-e.level<ue;for(let r=0;r<4;++r){const a=s.findNeighborTile(fe[r],e);null!=a&&i-a.level===ue&&(t=!1,Ee&&(ye(a.leaf),ye(a.hasPendingUpdate(1))))}}t?(this._splitTile(s),e.madeProgress(),a=!0):s.setPendingUpdate(1)}return e.done});if(a&&(this._allTilesSorted=!1,this._allTilesDirty=!0,!this._oneBatchPerFrameTask&&this._updatePendingTileGeometries()),n){if(!i){i=!0;continue}if(!a)break}else this._allTilesDirty=!0}s?e.madeProgress():this._allTilesDirty=!0,!this._oneBatchPerFrameTask&&this._updatePendingTileGeometries(),this._sortTiles(e)}_updateElevation(e){e.done||(this._allTiles.some(t=>(t.resetPendingUpdate(8)&&(this._updateTileGeometryState(t),this._shortBatches&&this._updatePendingTileGeometries(),e.madeProgress()),e.done)),!this._oneBatchPerFrameTask&&this._updatePendingTileGeometries())}_updateTextures(e){e.done||this._allTiles.some(t=>(this._updateTileTexture(t,e),e.done))}_updateClippingExtent(){this.spatialReference&&(this.overlayManager?.updateOverlayParameters(1),this.overlayManager.setPlacementDirty(),this._updateRootTiles())}get _lodBias(){const e=this.view.quality;return this.view.qualitySettings.tiledSurface.lodBias-(1-e)*pe}_getLodBiasCorrectedScale(e){const t=this.tilingScheme.levels,i=l(e-this._lodBias,0,t.length-1),r=i-Math.floor(i);return t[Math.floor(i)].scale*(1-r)+t[Math.ceil(i)].scale*r}_removeAllTiles(){null!=this._rootTiles&&(this._rootTiles.forEach(e=>this._purgeTile(e)),this._setRootTiles(null),this.notifyChange("ready")),this._allTiles.clear(),this.notifyChange("demResolution"),this.emit("tiles-changed",{allTiles:this.allTiles}),this.renderer.visible=!1}_purgeSubtree(e){const t=e.children;t[0]&&(this._purgeTile(t[0]),this._purgeTile(t[1]),this._purgeTile(t[2]),this._purgeTile(t[3]),e.clearChildren())}_purgeTile(e){e.leaf?ht(e):this._purgeSubtree(e),this._allTiles.removeUnordered(e),this._unloadTile(e),e.dispose(),this._tileCache.put(Xe._tileMemcacheKey,e),this.notifyChange("demResolution"),this.emit("tiles-changed",{allTiles:this.allTiles})}_unloadTile(e){this._pendingTilesToUpdate.delete(e),this._pendingTilesForElevationUpdateEvent.delete(e),e.unload()}_splitTile(e){_e(e.leaf,"Tile that is already split should not be split again!"),_e(e.rendered,"Tile marked to split is not rendered"),ht(e);const t=e.createChildren();this._allTiles.pushArray(t),this.notifyChange("demResolution"),this.emit("tiles-changed",{allTiles:this.allTiles}),e.updateAgentSuspension(),_e(e.rendered,"parent should be rendered"),t.forEach(e=>this._loadTile(e)),t.forEach(e=>this._pendingTilesToUpdate.add(e)),this._unloadTile(e),this._markAllTileNeighborsForUpdate(e),this._emitTileScaleChange(e,e.level+1),this._allTilesDirty=!0,this._shortBatches&&this._updatePendingTileGeometries(),t.forEach(e=>lt(e,e.hasPendingUpdate(1))),++this._performanceInfo.numSplit}_emitTileScaleChange(e,t=e.level){st.spatialReference=this.spatialReference,st.extent=e.extent,st.scale=this._getLodBiasCorrectedScale(t),this.emit("scale-change",st)}createTile(e,t,i,r){_e(!!r,"createTile sanity check");const s=this._acquireTile(e,t,i,r);return s.updateClippingStatus(this.extent),s.updateScreenDepth(this.view.state.contentCamera.viewProjectionMatrix),this._shouldSplit(s)&&s.setPendingUpdate(1),s}get _shortBatches(){return 2!==this.view.state.mode}_mergeTile(e){_e(!e.hasPendingUpdate(1),"_mergeTile sanity check"),_e(!e.leaf,"Cannot merge a leaf"),e.leaf||(this._purgeSubtree(e),_e(!e.renderData,"Merging tile with existing render data?"),this._loadTile(e),this._markTileToUpdate(e),this._emitTileScaleChange(e),this._shortBatches&&this._updatePendingTileGeometries(),lt(e,!1),this._allTilesDirty=!0,++this._performanceInfo.numMerged)}_loadTile(e){e.load(),this.requestUpdate(),this._allTilesDirty=!0,this.overlayManager?.hasOverlays&&this.overlayManager.updateTileOverlayParameters(e)}_handleLayerViewChanges(e=Qe){if(!this._layerViewsDirty)return;this._layerViewsDirty=!1;let t=!1;const i=new Set;let r=-1;for(let s=this.view.allLayerViews.length-1;s>=0;s--){const e=this.view.allLayerViews.items[s];if(i.add(e.uid),ve(e)||we(e))if(this._basemapLayerViewHandles.has(e.uid)&&!we(e)){const i=this._layerClassFromLayerView(e),s=this.getLayerIndexByUID(i,e.uid);null!=s&&((s<r||null==r)&&(t=!0),r=s)}else this._registerTiledLayerView(e),e.layer.loaded&&(t=!0)}this._basemapLayerViewHandles.forEach((e,r)=>{i.has(r)||(this._unregisterTiledLayerView(r),t=!0)}),t&&this._updateTiledLayers(),this.hasCompositeBlendMode=this._hasCompositeBlendMode(),this._evaluateTransparency(),e.madeProgress()}get _isFullyTransparent(){if(this.view.map?.ground?.opacity>0)return!1;for(const e of this.view.allLayerViews.items)if(Se(e)&&!$(e.layer)&&0!==e.fullOpacity)return!1;return!0}_hasCompositeBlendMode(){for(const e of this.view.allLayerViews.items)if((Ce(e)||we(e))&&Ne(Fe[e.layer.blendMode]))return!0;return!1}_layerClassFromLayerView(e){return be(e)?0:1}_registerTiledLayerView(e){const t=[];if((Ce(e)||we(e))&&t.push(_(()=>e.layer.blendMode,()=>{this.hasCompositeBlendMode=this._hasCompositeBlendMode(),this._updateTileTextures(2)})),!we(e)){const i=this._layerClassFromLayerView(e);t.push(_(()=>!e.destroyed&&e.suspended,()=>this._updateTiledLayers())),t.push(_(()=>!e.destroyed&&e.fullOpacity,()=>this._updateTileTextures(2)));const{layer:r}=e;"effectiveScaleRange"in r&&t.push(_(()=>!e.destroyed&&r.effectiveScaleRange,()=>this._restartAllAgents(i))),t.push(e.on("data-changed",()=>{const t=this.getLayerIndexByUID(i,e.uid);null!=t&&this._invalidateLayerData(t,i)}))}this._unregisterTiledLayerView(e.uid),this._basemapLayerViewHandles.set(e.uid,t)}_unregisterTiledLayerView(e){const t=this._basemapLayerViewHandles.get(e);if(t){for(const e of t)e.remove();this._basemapLayerViewHandles.delete(e)}}_updateTiledLayers(){if(!this.tilingScheme||this.view.suspended)return;const e=this.view.allLayerViews,t=[[],[]];let i=null;e.forEach(e=>{if(!e.layer||e.suspended||!ve(e)||!e.fullExtent)return;const r=this._layerClassFromLayerView(e);if(1===r){const t=e.displayLevelRange.maxLevel;t!==1/0&&(null===i||t>i)&&(i=t)}t[r].push(e)});for(const r of ie){const e=this._layerViews[r],i=t[r];i.reverse();const s=i.length;let a=e.length!==s;const n=new Array(s),l=new Array(e.length);this._layerIndexByUid[r].clear();for(let t=0;t<s;t++){const s=i[t].uid;this._layerIndexByUid[r].set(s,t);const o=e.indexOf(i[t]);n[t]=o,t!==o&&(a=!0),o>-1&&(l[o]=t)}if(a){const e=this._postorderIterator;for(e.reset(this._rootTiles);!e.done;)e.next().modifyLayers(l,n,r);this._layerViews[r]=i,this._restartAllAgents(r),this._updateTilesVisibility(this._rootTiles)}}this.tilingScheme.ensureMaxLod(i)&&(this._viewChangeUpdate(),this.notifyChange("tilingScheme"))}_restartAllAgents(e){const t=this._postorderIterator;for(t.reset(this._rootTiles);!t.done;){const i=t.next();i.restartAgents(e),0===e&&i.computeElevationBounds()}this._updateRootTileElevationBounds()}layerViewByIndex(e,t){return this._layerViews[t][e]}numLayers(e){return this._layerViews[e].length}_updateTileTextures(e){this._allTiles.forAll(t=>{t.updateAgents(1),1===e?this.renderer.updateTileTexture(t,16):t.updateRenderData(1,e)}),this._evaluateTransparency()}_invalidateLayerData(e,t){this._allTiles.forAll(i=>i.removeLayerAgent(e,t)),this._allTiles.forAll(i=>i.invalidateLayerData(e,t))}setTileTreeDirty(){this._allTilesDirty=!0}requestRender(e=1){this.renderer.setNeedsRender(e)}requestUpdate(){1===++this._pendingUpdates&&(this._hasPendingUpdates=!0)}requestTileData(e,t,i,r){const s=this.layerViewByIndex(t,i),a=s.layer;return!a.tilemapCache||me(s)?this._requestTileData(e,i,s,r):(++this._asyncWorkItems,a.tilemapCache.fetchAvailability(e.level,e.lij[1],e.lij[2],{...r,timeout:6e3}).then(()=>--this._asyncWorkItems).catch(t=>{throw--this._asyncWorkItems,p(r),c(t)||this._dataMissing(e,i,s),t}).then(()=>this._frameTask.schedule(()=>this._requestTileData(e,i,s,r),r.signal)))}_requestTileData(e,t,i,r){if(this.destroying)return Promise.resolve();const s=0===t;return r.requester??=s?this._elevationDataRequester:this._mapDataRequester,s?be(i)?this._requestElevationTileData(e,i,r):Promise.reject():Se(i)?this._requestMapTileData(e,i,r):Promise.reject()}_requestElevationTileData(e,t,i){++this._asyncWorkItems;const r=r=>{!g(i)&&r&&(this.setMemoryDirty(),this.requestUpdate(),this._elevationDataArrived(e,t,r))},s=i=>{c(i)||(n.getLogger(this).error(`Tile ${e.lij.toString()} layer 0/${t.uid} error ${i}`),this._dataMissing(e,0,t),this.requestUpdate())};return t.fetchElevationTile(e,i).then(e=>this._frameTask.schedule(()=>r(e)),s).finally(()=>--this._asyncWorkItems)}_elevationDataArrived(e,t,i){const r=this._layerIndexByUid[0].get(t.uid);if(null==r)return void n.getLogger(this).warn("TerrainSurface: received data from unknown layer %d %s",0,e.lij.toString());const s=new Z(e.lij,e.extent,i);e.dataArrived(r,0,s),this.emit("tile-data-changed",{tile:e,layerIndex:r,layerClass:0});const a=[e],l=e.level,o=this._iteratorPool.acquire();for(o.reset(a);!o.done;){const e=o.next();e.findElevationBoundsForLayer(r,l),e.computeElevationBounds()}0===l&&this._updateRootTileElevationBounds(),o.remove(),this._updateTilesVisibility(a)}_requestMapTileData(e,t,i){++this._asyncWorkItems;const r=(r,s)=>{xe(s),g(i)||(console.error(`Tile ${e.lij.toString()} layer 1/${t.uid} error ${r}`),this._dataMissing(e,1,t),this.requestUpdate())},s=e=>t=>r(t,e),a=r=>this._frameTask.schedule(()=>{this.requestUpdate(),g(i)?xe(r):this._mapTileDataArrived(e,t,r)},i.signal,s(r)).catch(s(r)),n=(e,t=null)=>this._frameTask.schedule(()=>r(e,t));return t.fetchTile(e.lij,i).then(a,n).finally(()=>--this._asyncWorkItems)}_mapTileDataArrived(e,t,i){const r=this.getLayerIndexByUID(1,t.uid);if(null==r)return xe(i),void n.getLogger(this).warn("TerrainSurface: received data from unknown layer");e.dataArrived(r,1,i),this.emit("tile-data-changed",{tile:e,layerIndex:r,layerClass:1})}_dataMissing(e,t,i){const r=this.getLayerIndexByUID(t,i.uid);null!=r?(e.dataMissing(r,t),this.emit("tile-data-changed",{tile:e,layerIndex:r,layerClass:t})):n.getLogger(this).warn("TerrainSurface: received data from unknown layer")}get performanceInfo(){const e=this._performanceInfo;return e.numNodes=this._allTiles.length,e.numLeaves=e.numVisible=e.numRendered=e.numLoadedPerLevel.length=e.numRenderedPerLevel.length=0,this._allTiles.forAll(t=>{t.leaf&&e.numLeaves++;const i=t.level;t.renderData&&(e.numLoadedPerLevel[i]=(e.numLoadedPerLevel[i]||0)+1),t.visible&&(e.numVisible++,t.rendered&&(e.numRenderedPerLevel[i]=(e.numRenderedPerLevel[i]||0)+1,e.numRendered++))}),e}setMemoryDirty(){this._usedMemory=null}get usedMemory(){return this.tilingScheme?(null==this._usedMemory&&(this._usedMemory=this._recalculateUsedMemory()),this._usedMemory??0):0}_recalculateUsedMemory(){return this.tilingScheme?Math.round(this._allTiles.reduce((e,t)=>e+t.usedMemory,0)):null}getUsedMemoryForLayerView(e){let t=0;const i=this._layerClassFromLayerView(e),r=this.getLayerIndexByUID(i,e.uid);return null!=r&&this._allTiles.forAll(e=>t+=e.getUsedMemoryForLayer(i,r)),t}get renderPatchBorders(){return this._renderer.renderPatchBorders}set renderPatchBorders(e){this._renderer.renderPatchBorders=e}get visualizeNormals(){return this._renderer.visualizeNormals}set visualizeNormals(e){this._renderer.visualizeNormals=e}get renderingDisabled(){return this._renderer.renderingDisabled}set renderingDisabled(e){this._renderer.renderingDisabled=e}get test(){}checkAllTilesWaterproofness(){if(!Pe)return;const e=this._rootTiles;if(null==e)return;const t=e=>e?.renderData?.geometry?.indices?.length>0,i=(e,i)=>{t(e)&&console.error("Tile[",e.lij,"] has geometry although parent[",i.lij,"] has geom")},r=e=>{if(e.intersectsClippingArea)if(e.renderData&&!e.renderData.geometryState&&console.error("Tile[",e.lij,"] has renderData but not geometryState"),e.renderData&&!e.renderData.geometry&&console.error("Tile[",e.lij,"] has renderData but not geometryInfo"),!e.renderData?.geometry||(e.renderData.geometry.indices?.length??0)>0||console.error("Tile[",e.lij,"] has renderData but no indices - geometryInfo: ",e.renderData.geometry),t(e)){e.checkGeometryWaterproofness();for(const t of e.children)i(t,e)}else if(e.leaf)console.error("Tile[",e.lij,"] has no geometry and no children, from root to leaf");else for(const t of e.children)r(t)},s=e=>{const t=e.parent?.visible??!0,i=e.visible;e.computeVisibility();const r=e.visible;if(i!==r&&t&&console.error(" Tile[",e.lij,"] has out of date visibility: ",i," instead of ",r),!e.leaf)for(const a of e.children)s(a)};for(const a of e)r(a),s(a)}get isGlobal(){return this._isGlobal}get isGeographic(){return this._isGeographic}get isWebMercator(){return this._isWebMercator}get isWebMercatorOnPlateCarree(){return this._isWebMercatorOnPlateCarree}isEastEndWrap(e){return this._isGlobal&&e[2]===this.lijEastEnd(e[0])-1}isWestEndWrap(e){return this._isGlobal&&0===e[2]}lijEastEnd(e){return 1<<e+(this._isGeographic?1:0)}wrapEastWest(e){const t=this.lijEastEnd(e[0]),i=e[2];if(0<=i&&i<t)return e;if(!this._isGlobal)return null;const r=(i+(i<0?t:0))%t;return[e[0],e[1],r]}enableInternalChecks(e){Ue(e)}enableWaterproofnessChecks(e){Me(e)}static cleanupTerrainSurface(){it.prune()}enable(e){e!==this._enabled&&(e?(this._updateRootTiles(),this.suspended=!1):(this.suspended=!0,this._removeAllTiles(),this._setRootTiles(null)),this._enabled=e)}};e([v()],Ke.prototype,"_renderer",void 0),e([v({constructOnly:!0})],Ke.prototype,"_scaleRangeQueries",void 0),e([v({constructOnly:!0})],Ke.prototype,"view",void 0),e([v({constructOnly:!0})],Ke.prototype,"overlayManager",void 0),e([v({constructOnly:!0})],Ke.prototype,"terrainTextureCompressionTracker",void 0),e([v()],Ke.prototype,"_hasPendingUpdates",void 0),e([v()],Ke.prototype,"_asyncWorkItems",void 0),e([v()],Ke.prototype,"_allTilesDirty",void 0),e([v()],Ke.prototype,"_allTilesSorted",void 0),e([v()],Ke.prototype,"_viewChanged",void 0),e([v({type:Number})],Ke.prototype,"heading",void 0),e([v()],Ke.prototype,"_splitLimits",void 0),e([v({readOnly:!0})],Ke.prototype,"_watchUpdatingTracking",void 0),e([v()],Ke.prototype,"_frameTask",void 0),e([v()],Ke.prototype,"demResolution",null),e([v({readOnly:!0})],Ke.prototype,"snapLevel",null),e([v({readOnly:!0})],Ke.prototype,"lodSnappingEnabled",null),e([v()],Ke.prototype,"_userClippingExtent",null),e([v()],Ke.prototype,"_rootTilesExtent",void 0),e([v({readOnly:!0})],Ke.prototype,"extent",null),e([v({readOnly:!0})],Ke.prototype,"groundExtent",null),e([v({readOnly:!0})],Ke.prototype,"_tilingSchemeExtent",null),e([v({readOnly:!0})],Ke.prototype,"updating",null),e([v({readOnly:!0})],Ke.prototype,"readyToRun",null),e([v(K)],Ke.prototype,"updatingProgress",void 0),e([v({readOnly:!0})],Ke.prototype,"updatingProgressValue",null),e([v()],Ke.prototype,"_maxNumUpdating",void 0),e([v()],Ke.prototype,"baseOpacity",null),e([v()],Ke.prototype,"hasCompositeBlendMode",void 0),e([v({readOnly:!0})],Ke.prototype,"viewingMode",null),e([v()],Ke.prototype,"maxTextureScale",void 0),e([v({readOnly:!0})],Ke.prototype,"ready",null),e([v({readOnly:!0})],Ke.prototype,"rootTiles",null),e([v()],Ke.prototype,"_rootTiles",void 0),e([v({readOnly:!0})],Ke.prototype,"spatialReference",null),e([v({type:t})],Ke.prototype,"backgroundColor",null),e([v({value:!1})],Ke.prototype,"slicePlaneEnabled",null),e([v({readOnly:!0})],Ke.prototype,"tilingScheme",void 0),e([v({readOnly:!0})],Ke.prototype,"tilingSchemeLocked",null),e([v({readOnly:!0})],Ke.prototype,"tilingSchemeLogic",void 0),e([v()],Ke.prototype,"wireframe",null),e([v({value:!1})],Ke.prototype,"suspended",null),e([v()],Ke.prototype,"fadeDuration",null),e([v()],Ke.prototype,"visibleElevationBounds",void 0),e([v()],Ke.prototype,"rootTileElevationBounds",void 0),e([v()],Ke.prototype,"_layerViewsDirty",void 0),e([v()],Ke.prototype,"renderPatchBorders",null),e([v()],Ke.prototype,"visualizeNormals",null),e([v()],Ke.prototype,"renderingDisabled",null),Ke=Xe=e([w("esri.views.3d.terrain.TerrainSurface")],Ke);const Je=Ke,Ze=b(),et=G(),tt=D(),it=new u,rt=new Y("ground"),st={spatialReference:null,extent:null,scale:0};function at(e,t,i){for(const r of e){if(!r.containsPointXY(t,i))continue;let e=r;for(;e&&!e.renderData;){const r=(t>e.extentMidX?1:0)+(i<e.extentMidY?2:0);e=e.children[r]}const s=e?.renderData?.geometryState.samplerData??null;return ee(t,i,s)}return null}class nt{constructor(e){this.capacity=e,this._head=0,this._tail=0,this._data=new Array(e)}push(e){const t=this._tail;if(!(t<this.capacity))throw new Error("Queue full");this._data[t]=e,this._tail=t+1}pushAll(e){const t=e.length;if(0===t)return;const i=this._tail;if(!(i+t<=this.capacity))throw new Error("Queue full");for(let r=0;r<t;++r)this._data[i+r]=e[r];this._tail=i+t}pop(){const e=this._head;if(e<this._tail){const t=this._data[e];return this._head=e+1,t}}get empty(){return this._head>=this._tail}get full(){return this._tail>=this._data.length}}function lt(e,t){!e.leaf||e.level<ue||ut(e,e=>{t&&ot(e);const i=dt(e);if(e.maxLevelDeltaNeighborCount++,i){let t=e.parent;for(;t;){const e=dt(t);if(t.unmergableChildCount++,!e)break;t=t.parent}}})}function ot(e){if(e.hasPendingUpdate(1))return;let t=e.parent;for(;t?.resetPendingUpdate(4);)t=t.parent;e.resetPendingUpdate(4),e.leaf&&e.setPendingUpdate(1),e.level<ue||ut(e,e=>{ot(e)})}function ht(e){e.level<ue||ut(e,e=>{if(e.maxLevelDeltaNeighborCount--,0===e.maxLevelDeltaNeighborCount&&0===e.unmergableChildCount){let t=e.parent;for(;t&&(t.unmergableChildCount--,dt(t));)t=t.parent}})}function dt(e){return 0===e.maxLevelDeltaNeighborCount&&0===e.unmergableChildCount}function ut(e,t){if(e.level<ue)return;const i=e.level-ue,r=e.lij[1]>>ue,s=e.lij[2]>>ue,a=e=>e.leaf||e.level===i;for(let n=0;n<4;++n){const l=e.findNeighborTile(fe[n],a);if(!l||l.level!==i)continue;const o=l.lij;o[1]===r&&o[2]===s||t(l)}}const pt=b();export{Je as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../Color.js";import{difference as i}from"../../../core/arrayUtils.js";import r from"../../../core/CollectionFlattener.js";import{toConst as s}from"../../../core/compilerUtils.js";import{EventedAccessor as a}from"../../../core/Evented.js";import"../../../core/has.js";import n from"../../../core/Logger.js";import{clamp as l}from"../../../core/mathUtils.js";import{destroyMaybe as o}from"../../../core/maybe.js";import{MemCachePool as h}from"../../../core/MemCachePool.js";import d from"../../../core/ObjectPool.js";import u from"../../../core/PooledArray.js";import{throwIfAborted as p,isAbortError as c,isAborted as g}from"../../../core/promiseUtils.js";import{watch as _,syncAndInitial as m,sync as f,initial as y}from"../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as T}from"../../../core/unitUtils.js";import{property as v}from"../../../core/accessorSupport/decorators/property.js";import{subclass as w}from"../../../core/accessorSupport/decorators/subclass.js";import{i as S,c as C}from"../../../chunks/vec32.js";import{create as b}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as x}from"../../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as E}from"../../../geometry/ellipsoidUtils.js";import L from"../../../geometry/SpatialReference.js";import{getProjector as P}from"../../../geometry/projection/projectors.js";import{projectPointToVector as U}from"../../../geometry/projection/projectPointToVector.js";import{projectVectorToVector as M}from"../../../geometry/projection/projectVectorToVector.js";import{create as D,equals as R,intersection as j,intersectsSphere as B,empty as I,expand as k}from"../../../geometry/support/aaBoundingRect.js";import{create as A,copy as V}from"../../../geometry/support/frustum.js";import{isPlateCarree as q}from"../../../geometry/support/spatialReferenceUtils.js";import{j as O,c as G,a as N,k as F,e as W}from"../../../chunks/sphere.js";import{ElevationQueryTileCache as H}from"../../../layers/support/ElevationQueryTileCache.js";import{isBaseLayer as $}from"../../../layers/support/layerUtils.js";import{debugFlags as Q}from"../support/debugFlags.js";import{ElevationRange as z}from"../support/ElevationRange.js";import{ElevationUpdateEvent as Y}from"../support/ElevationUpdateEvent.js";import{toBoundingRect as X}from"../support/extentUtils.js";import{updatingProgress as K}from"../support/updatingProperties.js";import{ElevationBounds as J}from"./ElevationBounds.js";import{ElevationData as Z,sampleElevation as ee}from"./ElevationData.js";import{create as te}from"./ExtentHelper.js";import{LayerClasses as ie}from"./LayerClass.js";import{OverlayManager as re}from"./OverlayManager.js";import{PlanarPatch as se}from"./PlanarPatch.js";import{ScaleRangeQueries as ae}from"./ScaleRangeQueries.js";import{SphericalPatch as ne}from"./SphericalPatch.js";import{SplitLimits as le}from"./SplitLimits.js";import{maxRootTiles as oe,tooManyRootTilesAfterChangeError as he,tooManyRootTilesForLayerError as de,maxTileNeighborLevelDelta as ue,maxMemoryLodBias as pe}from"./TerrainConst.js";import{TerrainRenderer as ce}from"./TerrainRenderer.js";import ge from"./TerrainSurfacePerformanceInfo.js";import{weakAssert as _e,isVectorTileLayerView as me,neighborEdgeIndices as fe,internalAssert as ye,oppositeEdge as Te,isSurfaceLayerView as ve,isGroupLayerView as we,isMapTileLayerView as Se,isBlendableLayerView as Ce,isElevationLayerView as be,releaseTerrainData as xe,enableTerrainInternalChecks as Ee,oppositeCorner as Le,enableWaterproofTests as Pe,enableInternalTerrainChecks as Ue,enableTerrainWaterproofChecks as Me,neighborCornerIndices as De}from"./terrainUtils.js";import{Tile as Re,lijEquals as je}from"./Tile.js";import{printAllocations as Be}from"./TilePerLayerInfo.js";import{IteratorPreorder as Ie,IteratorPostorder as ke,compareTilesByLij as Ae,hasLoadableSiblings as Ve,sortTilesByPOI as qe}from"./tileUtils.js";import{TilingSchemeLogic as Oe}from"./TilingSchemeLogic.js";import{UpsampleInfo as Ge}from"./UpsampleInfo.js";import{isCompositeBlendMode as Ne,blendModeFromString as Fe}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{hasLayerBasedScaleVisibility as We}from"../../support/layerViewUtils.js";import{ImmediateTask as He,TaskPriority as $e,noBudget as Qe}from"../../support/Scheduler.js";import{TextureCompressionTracker as ze}from"../../support/TextureCompressionTracker.js";import{Yield as Ye}from"../../support/Yield.js";var Xe;let Ke=class extends a{static{Xe=this}get allTiles(){return s(this._allTiles)}get demResolution(){const{_allTiles:e,tilingScheme:t}=this;if(0===e.length)return{min:1,max:1};const i=T(t.spatialReference);let r=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;for(const a of e){const e=t.resolutionAtLevel(a.level)*i;r=Math.min(r,e),s=Math.max(s,e)}return{min:r,max:s}}constructor(e){super(e),this.terrainTextureCompressionTracker=new ze,this._iteratorPool=new d(Ie,e=>e.remove=()=>this._iteratorPool.release(e)),this._postorderIterator=new ke,this._hasPendingUpdates=!1,this._pendingUpdates=0,this._asyncWorkItems=0,this._allTilesDirty=!0,this._allTilesSorted=!0,this._usedMemory=null,this._performanceInfo=new ge,this._viewChanged=!1,this.heading=0,this._inFrameTask=!1,this._viewChangeUpdateDirty=!1,this._eyePosRenderSR=b(),this._eyePosSurfaceSR=b(),this._splitLimits=new le,this._frustum=A(),this._layerViews=[new Array,new Array],this._layerIndexByUid=[new Map,new Map],this._basemapLayerViewHandles=new Map,this._watchUpdatingTracking=new x,this._frameTask=He,this._allTiles=new u,this._upsampleInfoPool=new d(Ge),this._shouldEmitChangeEvent=!1,this._rootTilesExtent=D(),this.updatingProgress=.5,this._maxNumUpdating=1,this.maxTextureScale=1.2,this._spatialReference=L.WebMercator,this._elevationProjectorCache=new Map,this.visibleElevationBounds=new J(1/0,-1/0),this.rootTileElevationBounds=new J(1/0,-1/0),this._projectorCache=new Map,this._radiusModifier=Math.cos(Math.PI/16/16),this._tilingSchemeSpatialReference=null,this._updatingRootTiles=!1,this._pendingTilesForElevationUpdateEvent=new Set,this._pendingTilesToUpdate=new Set,this.totalGeometryUpdates=0,this.totalTileUpdates=0,this._oneBatchPerFrameTask=!0,this._layerViewsDirty=!1,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._isWebMercator=!1,this._isWebMercatorOnPlateCarree=!1,this._enabled=!0;const t=e.view;this.overlayManager=new re({...e,surface:this}),this._isGlobal=!t.state?.isLocal,this._isGeographic=this._spatialReference?.isGeographic??!1,this._tileConstructor=this._isGlobal?ne:se,this._ellipsoid=E(t.spatialReference),this._renderer=new ce(this.overlayManager.renderer,t.stage,this._allTiles,this._ellipsoid.radius,this.terrainTextureCompressionTracker,t.resourceController.memoryController),We()||(this._scaleRangeQueries=new ae)}initialize(){const e=this.view,t=e.resourceController,i=t.memoryController;this._tileCache=new h((e,t)=>i.newCache(e,t),"terrain-tile"),this._upsampleMapCache=i.newCache("terrain-upsample",e=>e.unloadMapData()),this._elevationQueryCache=new H(i.newCache("elevation-query"));const s=this.overlayManager;this.addHandles([_(()=>s.renderer.isEmpty,()=>this._evaluateTransparency()),_(()=>this.renderer.visible,e=>this.suspended=!e),_(()=>this.heading,e=>{this._renderer.updateHeading(e),this._updateTileTextures(0)}),_(()=>({heading:e.camera?.heading,state:e.state?.mode}),({heading:e,state:t})=>{if(null==e)return;if(this.isGlobal&&this.isGeographic||this.isWebMercatorOnPlateCarree)return void(this.heading=90*Math.round(e/90)%360);const i=Math.round(e)%360,r=Math.abs(i-this.heading);(2===t||Math.min(r,360-r)>=30)&&(this.heading=i)})],"overlayManager"),this.addHandles([_(()=>this.baseOpacity,()=>{this._handleLayerViewChanges(),this._updateTileTextures(this._evaluateTransparency()?1:2)},m),_(()=>this.hasCompositeBlendMode,()=>this._updateTileTextures(this._evaluateTransparency()?1:2),m),_(()=>this.backgroundColor,(e,t)=>{e?.equals(t)||(this._handleLayerViewChanges(),this._renderer.updateTileBackground(e))},f),_(()=>this.snapLevel,()=>this._viewChanged=!0,f),_(()=>this.view.pointsOfInterest,e=>{this._renderer.pointsOfInterest=e,this._watchUpdatingTracking.removeAll(),e&&this._watchUpdatingTracking.add(()=>e.focus?.renderLocation,()=>this._allTilesSorted=!1)}),_(()=>Q.TERRAIN_TILE_TREE_SHOW_TILES,t=>{t&&!this._treeDebugger?import("../layers/support/TerrainTileTree3DDebugger.js").then(({TerrainTileTree3DDebugger:t})=>{!this._treeDebugger&&Q.TERRAIN_TILE_TREE_SHOW_TILES&&(this._treeDebugger=new t({view:e}))}):t||(this._treeDebugger=o(this._treeDebugger))},y)]);const{spatialReference:a}=e;this._extentHelper=te(this.viewingMode,{layers:e.map.allLayers,layerViews:e.allLayerViews,viewSpatialReference:a});const n=new r({getCollections:()=>e.defaultsFromMap?.mapCollections?.map(({layers:e})=>e),getChildrenFunction:e=>e&&"layers"in e?e.layers:null}),l=new Oe({layers:n,extentHelper:this._extentHelper,viewingMode:this.viewingMode,viewSpatialReference:a});this._set("tilingSchemeLogic",l),this._updateTilingScheme(),this._elevationDataRequester=t.createStreamDataRequester(0),this._mapDataRequester=t.createStreamDataRequester(1);const d=t.scheduler;this._frameTask=d.registerTask($e.TERRAIN_SURFACE,this),this.addHandles([_(()=>this._extentHelper.stencilEnabledExtents,e=>this._renderer.setStencilEnabledLayerExtents(e),y),_(()=>this.tilingSchemeLogic.tilingScheme,()=>this._updateTilingScheme(),f),_(()=>this.extent,()=>this._updateRootTiles(),y),e.on("resize",()=>this._viewChangeUpdate()),_(()=>{const t=e.state;return[this._lodBias,this.lodSnappingEnabled,e.quality,t.camera,t.contentCamera,t.fixedContentCamera]},()=>this._viewChangeUpdate(),m),_(()=>e.qualitySettings?.fadeDuration,e=>this._renderer.textureFadingEnabled=e>0,y),_(()=>e.qualitySettings?.physicallyBasedRenderingEnabled,e=>this._renderer.pbrMode=e?5:0,y),_(()=>e.qualitySettings?.tiledSurface.elevationLevelDelta,()=>this._updateAllTileGeometries()),_(()=>this._userClippingExtent,()=>this._updateClippingExtent(),f)]),this.addHandles(e.allLayerViews.on("after-changes",()=>this._layerViewsDirty=!0)),this._layerViewsDirty=!0,this._handleLayerViewChanges(),this._renderer.updateTileBackground(this.backgroundColor)}clearHandles(){this._watchUpdatingTracking?.removeAll(),this.removeAllHandles(),this._basemapLayerViewHandles.forEach((e,t)=>this._unregisterTiledLayerView(t)),this._basemapLayerViewHandles.clear()}destroy(){this._frameTask.remove(),this._frameTask=He,this._watchUpdatingTracking?.destroy(),this._removeAllTiles(),this._set("tilingSchemeLogic",o(this.tilingSchemeLogic)),this._basemapLayerViewHandles.forEach((e,t)=>this._unregisterTiledLayerView(t)),this._basemapLayerViewHandles.clear(),this._elevationDataRequester=null,this._mapDataRequester=null,this._set("overlayManager",o(this.overlayManager)),this._tileCache=o(this._tileCache),this._allTiles.prune(),Re.prune(),this._treeDebugger=o(this._treeDebugger),this._renderer.destroyed||this._renderer.destroy(),this._renderer=null,this._iteratorPool=o(this._iteratorPool),this._upsampleMapCache=o(this._upsampleMapCache),this._elevationQueryCache=o(this._elevationQueryCache),this._set("view",null),this._extentHelper=o(this._extentHelper),this._upsampleInfoPool=o(this._upsampleInfoPool),Be(),this._layerViews.forEach(e=>e.length=0),this._performanceInfo=null}get renderer(){return this._renderer}get frustum(){return this._frustum}get snapLevel(){if(this.lodSnappingEnabled){const{view:e,tilingScheme:t}=this,i=e.scale;if(t&&i){const r=t.levelAtScale(i)+e.qualitySettings.tiledSurface.lodBias,s=t.getMaxLod();return r<=0?null:Math.min(r,s||1/0)}}return null}get lodSnappingEnabled(){return this.view.qualitySettings.tiledSurface.reduceTileLevelDifferences}get upsampleInfoPool(){return this._upsampleInfoPool}get upsampleMapCache(){return this._upsampleMapCache}get elevationQueryCache(){return this._elevationQueryCache}get hasStencilEnabledExtents(){return this._extentHelper.stencilEnabledExtents.length>0}get _userClippingExtent(){const{spatialReference:e}=this,t=this.view?.clippingArea;if(null==t||null==e)return null;const i=D(),r=X(t,i,e)?i:null,s=this._get("extent");return R(r,s)?s:r}get rootTilesExtent(){return this._rootTilesExtent}get extent(){const e=j(this.groundExtent,this._userClippingExtent,D()),t=this._get("extent");return R(e,t)?t:e}get groundExtent(){return null!=this._tilingSchemeExtent?this._tilingSchemeExtent:this._rootTilesExtent}get _tilingSchemeExtent(){return this.tilingSchemeLogic?.extent}get updating(){return this._hasPendingUpdates||(this._maxNumUpdating=1),!!((this.readyToRun||this._watchUpdatingTracking?.updating||this._asyncWorkItems>0)&&this.ready&&!this.suspended||this.overlayManager?.updating||this.terrainTextureCompressionTracker.compressing)}get readyToRun(){return(this._hasPendingUpdates||this._viewChanged||this._allTilesDirty||!this._allTilesSorted||this._layerViewsDirty||this._scaleRangeQueries?.updating||this._frameTask.updating)&&this.ready&&!this.suspended}get updatingProgressValue(){return this._maxNumUpdating=Math.max(this._pendingUpdates,this._maxNumUpdating),1-this._pendingUpdates/this._maxNumUpdating}get baseOpacity(){return this.view?.map?.ground?.opacity??1}set baseOpacity(e){this.view.map.ground.opacity=e}get viewingMode(){return this.view.state.viewingMode}get ready(){return null!=this._rootTiles}get rootTiles(){return this._rootTiles}get spatialReference(){return this.tilingScheme?.spatialReference??null}get backgroundColor(){return this.view?.map?.ground?.surfaceColor}set backgroundColor(e){this.view.map.ground.surfaceColor=e}set slicePlaneEnabled(e){this._renderer.slicePlaneEnabled=e,this._set("slicePlaneEnabled",e),this._evaluateTransparency()}get tilingSchemeLocked(){return this.tilingSchemeLogic?.tilingSchemeLocked??!1}get wireframe(){return this._renderer?.wireframe}set wireframe(e){e!==this._renderer.wireframe&&(this._renderer.wireframe=e,this._updateAllTileGeometries())}get opaque(){return 0===this._renderer.transparency}get invisible(){return 3===this._renderer.transparency}set suspended(e){this._set("suspended",e),this._viewChangeUpdate()}get fadeDuration(){return this.view.qualitySettings.fadeDuration??0}intersect(e,t,i,r){this._renderer.intersect(e,t,i,r)}getElevationLevelDelta(e){return e<4?3:this.view.qualitySettings.tiledSurface.elevationLevelDelta}getElevation(e,t,i,r){const s=this._rootTiles;if(!s?.length||!this._enabled)return null;if(0===s[0].layerInfo[0].length)return null;let a=this._elevationProjectorCache.get(r);if(void 0===a&&(a=P(r,this._spatialReference)??null,this._elevationProjectorCache.set(r,a)),null==a)return n.getLogger(this).error("TerrainSurface.getElevation(): could not project given point to tiling scheme coordinate system"),null;const l=S(Ze,e,t,i);a(l,0,l,0);return at(s,l[0],l[1])}getElevations(e,t,i){const r=this._rootTiles,s=r?r[0].layerInfo[0].length:0;if(r?.length&&0!==s&&this._enabled)for(let a=0;a<t;++a){const t=3*a;i(a,at(r,e[t],e[t+1]))}else for(let a=0;a<t;++a)i(a,null)}getLayerIndexByUID(e,t){return this._layerIndexByUid[e].get(t)}getScale(e){if(!this.tilingScheme)return null;if(!U(e,Ze,this.spatialReference))return n.getLogger(this).error("TerrainSurface.getScale(): could not project given point to tiling scheme coordinate system"),null;const t=this._rootTiles;if(null!=t)for(const i of t)if(i?.containsPoint(Ze)){let e=i;for(;e.children[0]&&!e.rendered;){const t=e.children[0].extent;let i=0;Ze[0]>t[2]&&(i+=1),Ze[1]<t[1]&&(i+=2),e=e.children[i]}return this._getLodBiasCorrectedScale(e.level)}return 1/0}_ensureProjector(e){const t=this._projectorCache.get(e);if(t)return t;const i=P(e,this._tilingSchemeSpatialReference)??null;return this._projectorCache.set(e,i),i}getSphereElevationBounds(e,t){const i=this._ensureProjector(t);if(null==i)return n.getLogger(this).error("TerrainSurface.getSphereElevationBounds(): could not project given point to tiling scheme coordinate system"),null;O(e,et);const r=N(et);i(r,0,r,0),F(et,r);const s=new z,a=this._rootTiles;if(null!=a){const e=[];for(const i of a)e.push(i);let t=0;for(;t<e.length;){const i=e[t];if(++t,!B(i.extent,et))continue;const r=i.children;if(null==r[0]||i.rendered)s.expandElevationRangeValues(i.elevationBoundsMin,i.elevationBoundsMax);else for(const t of r)e.push(t)}}return s}getRootElevationBounds(){return new z(this.rootTileElevationBounds.min,this.rootTileElevationBounds.max)}getLowerBoundRadius(){const e=(this._ellipsoid.radius+this.visibleElevationBounds.min)*this._radiusModifier;return Math.min(e,this._ellipsoid.radius)}getSphereScale(e,t){if(!this.tilingScheme)return null;if(!U(e,pt,this.spatialReference))return n.getLogger(this).error("TerrainSurface.getSphereScale(): could not project given point to tiling scheme coordinate system"),null;W(et,pt,t);let i=null;const r=e=>{if(e&&B(e.extent,et)){const t=e.children;if(t[0]&&!e.rendered)for(const e of t)r(e);else{const t=this._getLodBiasCorrectedScale(e.level);i=null==i?t:Math.min(i,t)}}},s=this._rootTiles;if(null!=s)for(const a of s)r(a);return i}queryVisibleScaleRange(e,t,i,r){if(!this._scaleRangeQueries)return;const s=t?this.tilingScheme.levelAtScale(t):0,a=i?this.tilingScheme.levelAtScale(i):1/0,n=this._lodBias;this._scaleRangeQueries.queryVisibleLevelRange(e,s+n,a+n,r)}_evaluateTransparency(){const e=this.baseOpacity,t=this.overlayManager.renderer.isEmpty,i=this._renderer.transparency,r=this._isFullyTransparent?t?3:2:e>=1&&!this.hasCompositeBlendMode&&!this._renderer.slicePlaneEnabled?0:1;return this._renderer.transparency=r,i!==r}_updateTilingScheme(){const e=this.tilingSchemeLogic.tilingScheme;if(!(e!==this.tilingScheme))return;_e(!!e,"tiling scheme cannot be reset to undefined"),this._isGlobal=!this.view?.state?.isLocal,this.tilingScheme&&this._removeAllTiles();const t=e?.spatialReference??L.WebMercator;this._spatialReference=t,this._isWebMercator=!!t?.isWebMercator,this._isWebMercatorOnPlateCarree=this._isWebMercator&&q(this.view?.renderSpatialReference),this._isGeographic=t?.isGeographic??!1,this._set("tilingScheme",e),this._tilingSchemeSpatialReference=this.tilingScheme?.spatialReference,this._projectorCache.clear(),this._updateClippingExtent(),e&&(this._updateTiledLayers(),this._renderer.tileSize=e.pixelSize,this.overlayManager.spatialReference=e.spatialReference,this._updateRootTiles())}static{this._tileMemcacheKey="TerrainTileMemcache"}_acquireTile(e,t,i,r){const s=this._tileCache.pop(Xe._tileMemcacheKey);return s?(s.init(e,t,i,r,this),s):new this._tileConstructor(e,t,i,r,this)}get updatingRootTiles(){return this._updatingRootTiles}_updateRootTiles(){const{extent:e,tilingScheme:t}=this;if(!t)return;const r=tt;let s=t.rootTilesInExtent(e,r,5*oe);if(null!=this._rootTiles){if(s.length>oe)return void n.getLogger(this).warn(he);const e=this._rootTiles.map(e=>e.lij),t=i(e,s,je);if(this._updatingRootTiles=!0,t.removed.length>0||t.added.length>0){const e=this._rootTiles.filter(e=>!(t.removed.findIndex(t=>je(t,e.lij))>-1)||(this._purgeTile(e),!1));t.added.forEach(t=>e.push(this._newRootTile(t))),this._setRootTiles(e)}}else this._updatingRootTiles=!0,s.length>oe&&(n.getLogger(this).warn(de),s=t.rootTilesInExtent(e,r,oe)),this._setRootTiles(s.map(e=>this._newRootTile(e)));R(r,this._rootTilesExtent)||(this._rootTilesExtent=D(r)),this.renderer.visible=!0,this._viewChangeUpdate(),this.overlayManager.setPlacementDirty(),this.notifyChange("ready"),this._updateAllTileGeometries(),this._updatingRootTiles=!1,this.checkAllTilesWaterproofness()}_updateAllTileGeometries(){const e=this._allTiles.filter(e=>e.loaded&&e.intersectsClippingArea);e.sort(Ae),e.forEach(e=>this._renderer.updateTileGeometryState(e)),e.forEach(e=>e.renderData.updateNeighborData()),this._updateTilesGeometries(e),this._pendingTilesToUpdate.clear()}_updateTilesGeometries(e){if(0===e.length)return;e.sort(Ae);const t=this.renderer;e.forEach(e=>t.updateGeometryIfNeeded(e)),e.forEach(e=>this._pendingTilesForElevationUpdateEvent.add(e))}_shouldSplit(e){return 1===e.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.snapLevel)}_newRootTile(e){const t=this._acquireTile(0,e[1],e[2],null);return this._shouldSplit(t)&&t.setPendingUpdate(1),this._loadTile(t),this._markTileToUpdate(t),this._updateRootTileElevationBounds(),t}_setRootTiles(e){if(this._rootTiles=e,this._allTiles.clear(),null!=e){const t=this._iteratorPool.acquire();for(t.reset(e);!t.done;)this._allTiles.push(t.next());t.remove()}this._renderer.setRootTiles(this._rootTiles),this._updateTilesVisibility(e),this.notifyChange("demResolution"),this.emit("tiles-changed",{allTiles:this.allTiles})}_runViewChangeUpdateIfDirty(){this._viewChangeUpdateDirty&&(this._viewChangeUpdateDirty=!1,this._viewChangeUpdate())}_viewChangeUpdate(){this.view&&!this.suspended&&this.tilingScheme&&this.renderer.visible&&(this._inFrameTask?this._viewChangeUpdateDirty=!0:(this._viewChangeUpdateDirty=!1,this._updateViewDependentParameters(),this._updateTilesVisibility(this._rootTiles)))}_updateClippingStatus(e){e.updateClippingStatus(this.extent)&&e.resetPendingUpdate(8)&&this._updateTileGeometryState(e)}_updateTilesVisibility(e){if(null==e)return;const t=Ve(e),i=this.visibleElevationBounds;let r=t?i.min:1/0,s=t?i.max:-1/0;const a=this.extent,n=this.view.state.contentCamera.viewProjectionMatrix;this.setTileTreeDirty();const l=this._iteratorPool.acquire();for(l.reset(e);!l.done;){const e=l.next();e.updateClippingStatus(a)&&e.resetPendingUpdate(8)&&this._updateTileGeometryState(e),e.computeVisibility(),e.updateScreenDepth(n),e.renderData&&(r=Math.min(e.elevationBoundsMin,r),s=Math.max(e.elevationBoundsMax,s))}l.remove(),this._viewChanged=!0,this._allTilesDirty=!0,this._updatePendingTileGeometries(),isFinite(r)&&isFinite(s)&&(i.min!==r||i.max!==s)&&(this.visibleElevationBounds=new J(r,s))}_updateRootTileElevationBounds(){let e=1/0,t=-1/0;const i=this._rootTiles;null!=i&&i.forEach(({elevationBoundsMin:i,elevationBoundsMax:r})=>{e=Math.min(e,i),t=Math.max(t,r)});const r=this.rootTileElevationBounds;r.min===e&&r.max===t||(this.rootTileElevationBounds=new J(e,t))}_updateViewDependentParameters(){const{camera:e,contentCamera:t}=this.view.state,i=Math.tan(.5*t.fovX),r=Math.tan(.5*t.fovY),s=this.tilingScheme.pixelSize,a=2**-this._lodBias*e.pixelRatio;this._splitLimits.aboveGround=e.aboveGround,this._splitLimits.fovX=i,this._splitLimits.fovY=r,this._splitLimits.relativeWidthLimit=s/e.width*this.maxTextureScale*a,this._splitLimits.relativeHeightLimit=s/e.height*this.maxTextureScale*a,this._splitLimits.maxLod=this.tilingScheme.getMaxLod(),this._splitLimits.angledSplitBias=this.view.qualitySettings.tiledSurface.angledSplitBias,this.view.state.fixedContentCamera?this._splitLimits.frustum=V(this._splitLimits.frustum??A(),t.frustum):this._splitLimits.frustum=null,V(this._frustum,e.frustum),C(this._eyePosRenderSR,t.eye),M(e.eye,this.view.renderSpatialReference,this._eyePosSurfaceSR,this.spatialReference)}_updateTileGeometryState(e){e.updateVisibility();this._renderer.updateTileGeometryState(e)&&this._markTileToUpdate(e),this.setMemoryDirty()}_markAllTileNeighborsForUpdate(e){e.forEachLoadedNeighbor(e=>{this._layerViews[1].some(me)&&e.setPendingUpdate(32),this._pendingTilesToUpdate.add(e)})}_updateTileTexture(e,t){const i=e.resetPendingUpdate(32)?32:!!e.resetPendingUpdate(16)&&16;i&&(this._renderer.updateTileTexture(e,i),this._usedMemory=null,t.madeProgress())}_emitElevationUpdateEventForTiles(){if(!this._shouldEmitChangeEvent)return;const e=rt.extent;I(e),this._pendingTilesForElevationUpdateEvent.forEach(t=>k(e,t.extent,e)),this._pendingTilesForElevationUpdateEvent.clear(),rt.spatialReference=this.spatialReference,this.emit("elevation-change",rt),this._shouldEmitChangeEvent=!1}runTask(e){this._handleLayerViewChanges(e),this._frameTask.processQueue(e),this.renderer.processScaleRangeQueries(this._scaleRangeQueries,e),this._inFrameTask=!0,this._pendingUpdates=0,this._hasPendingUpdates=!1,this._updateAllTilesStatus(e),this._sortTiles(e);const t=!this.view.state.fixedContentCamera;if(this._mergeAndSplit(e,t),this._updateElevation(e),this._updateTextures(e),t||this._mergeAndSplit(e,!0),this._inFrameTask=!1,this._runViewChangeUpdateIfDirty(),this._updatePendingTileGeometries(),this._emitElevationUpdateEventForTiles(),e.done&&e.hasProgressed&&this.requestUpdate(),this.notifyChange("updatingProgressValue"),Ee&&this._checkTileInvariant(),!e.hasProgressed)return Ye}_checkTileInvariant(){const e=new Map;this._allTiles.forAll(t=>e.set(t,new Set)),this._allTiles.forAll(t=>{if(_e(t.rendered===t.leaf,` rendered ${t.rendered} != ${t.leaf} leaf`),!t.leaf){const e=e=>0===e.unmergableChildCount&&0===e.maxLevelDeltaNeighborCount,i=t.children.reduce((t,i)=>t+(e(i)?0:1),0);if(_e(t.unmergableChildCount===i,` Tile[${t.lij.toString()}] unmergeable child count mismatch: actual ${t.unmergableChildCount} vs ${i}`),t.hasPendingUpdate(4)){_e(!t.hasPendingUpdate(1),"Tile can be both split and merge at the same time");for(const e of t.children)_e(e.leaf||e.hasPendingUpdate(4),"Child of tile to merge must also merge")}}for(let i=0;i<4;++i){if(t.rendered){const e=t.renderData?.geometryState.edgePeerNeighbors[i];if(null!=e){{const r=t.level-e.level<=ue;r||(console.log(`tile level delta [${t.lij.toString()}] vs [${e.lij.toString()}] > ${ue} (edge[${i}])`),_e(r,`tile level delta [${t.level}] vs [${e.level}] > ${ue}`))}_e(t.level-e.level<=ue,`Max tile lod delta exceeded: [${t.lij.toString()}] vs [${e.lij.toString()}]`)}}const r=t.level-ue,s=e=>e.leaf||e.level===t.level,a=t.findNeighborTile(fe[i],s);if(null!=a){if(t.leaf&&t.level>=ue){let i=a;for(;t.level-i.level<ue;)i=i.parent;const s=[r,t.lij[1]>>ue,t.lij[2]>>ue];if(!je(s,i.lij)){const r=e.get(i);_e(!r.has(t),"Cannot already have neighbor"),r.add(t)}}_e(a.rendered||a.level===t.level,"Non-same-level-neighbor of rendered must be rendered"),_e(t.level-a.level<=ue,`Tile level delta [${t.level}] vs [${a.level}] > ${ue}`)}}}),this._allTiles.forAll(t=>{const i=t.maxLevelDeltaNeighborCount,r=e.get(t);_e(i===r.size,`Tile[${t.lij.toString()}] merge-blocker mismatch: actual ${i} vs ${r.size}`)})}_updateAllTilesStatus(e){if(!this._viewChanged||!this._rootTiles||e.done)return;this._viewChanged=!1;const t=new nt(this._allTiles.length);t.pushAll(this._rootTiles);const i=this.snapLevel,r=this._splitLimits,s=this._eyePosRenderSR;this._allTiles.forAll(e=>{e.maxLevelDeltaNeighborCount=0,e.unmergableChildCount=0});const a=this.view.state.contentCamera.viewProjectionMatrix;for(;!t.empty;){const e=t.pop(),n=e.parent,l=null!=n&&n.hasPendingUpdate(4),o=l?4:e.shouldSplit(r,s,i),h=1===o;e.leaf?lt(e,h):t.pushAll(e.children),l?(e.resetPendingUpdate(1),e.leaf||e.setPendingUpdate(4),this._updateClippingStatus(e),e.updateVisibility(),e.updateScreenDepth(a)):h?(e.resetPendingUpdate(4),e.leaf&&e.setPendingUpdate(1)):(e.resetPendingUpdate(1)&&e.updateAgentSuspension(),2===o&&e.updateAgents(0),e.leaf||(e.setPendingUpdate(4),e.resetPendingUpdate(1)))}this.requestUpdate(),(this._shortBatches||!this._oneBatchPerFrameTask)&&this._updatePendingTileGeometries(),e.madeProgress()}_sortTiles(e){e.done||this._allTilesSorted||!this.view.pointsOfInterest?.focus||(qe(this._allTiles,this.view.pointsOfInterest.focus.renderLocation),this._allTilesSorted=!0,this._treeDebugger?.update(),e.madeProgress())}_markTileToUpdate(e){ye(e.loaded),e.intersectsClippingArea&&(this._pendingTilesToUpdate.add(e),this._markAllTileNeighborsForUpdate(e))}_updatePendingTileGeometries(){const e=this._pendingTilesToUpdate,t=Array.from(e.keys()).filter(e=>e.loaded&&e.intersectsClippingArea);if(0===t.length)return void e.clear();const i=(i,r)=>{!r?.loaded||!r.intersectsClippingArea||r.level<i.level||e.has(r)||(e.add(r),t.push(r),r.renderData.updateNeighborData())};t.sort(Ae);const r=t.length;for(let s=0;s<r;++s){const r=t[s];ye(r.loaded),ye(r.intersectsClippingArea);const a=r.renderData;a.updateNeighborData();const n=a.dirtyEdgeResolutions,l=a.geometryState,o=e=>{const t=De[e];i(r,l.cornerPeerNeighbors[e]?.findCorner(Le(t),e=>e.loaded))};for(let t=0;t<4;++t)if(n&1<<t){const s=a.geometryState.edgePeerNeighbors[t];s&&s?.level>=r.level&&s.forAllSubtreeOnSide(Te(fe[t]),t=>!(!t.loaded||!t.intersectsClippingArea)&&(ye(e.has(t)||Ae(r,t)<0),i(r,t),!0)),o((t+1)%4),o(t)}}e.clear(),this._updateTilesGeometries(t),this._shouldEmitChangeEvent=!0,Ee&&Pe&&this.checkAllTilesWaterproofness()}_mergeAndSplit(e,t){if(this.suspended||e.done||!this._allTilesDirty)return;this._allTilesDirty=!1,this.requestUpdate();let i=!1;const r=this.view.state.fixedContentCamera;let s=!1;for(;!e.done;){s=!0;let a=!1;const n=!this._allTiles.some(s=>{if(!i&&!r&&!s.visible)return e.done;let n=s;if(s.hasPendingUpdate(4)){if(!t||s.unmergableChildCount>0)return e.done;for(s.resetPendingUpdate(4);null!=n.parent&&0===n.parent.unmergableChildCount&&n.parent.resetPendingUpdate(4);)n=n.parent;this._mergeTile(n),a=!0,e.madeProgress()}else if(s.resetPendingUpdate(1)){let t=!0;const i=s.level;if(i>=ue){const e=e=>e.leaf||i-e.level<ue;for(let r=0;r<4;++r){const a=s.findNeighborTile(fe[r],e);null!=a&&i-a.level===ue&&(t=!1,Ee&&(ye(a.leaf),ye(a.hasPendingUpdate(1))))}}t?(this._splitTile(s),e.madeProgress(),a=!0):s.setPendingUpdate(1)}return e.done});if(a&&(this._allTilesSorted=!1,this._allTilesDirty=!0,!this._oneBatchPerFrameTask&&this._updatePendingTileGeometries()),n){if(!i){i=!0;continue}if(!a)break}else this._allTilesDirty=!0}s?e.madeProgress():this._allTilesDirty=!0,!this._oneBatchPerFrameTask&&this._updatePendingTileGeometries(),this._sortTiles(e)}_updateElevation(e){e.done||(this._allTiles.some(t=>(t.resetPendingUpdate(8)&&(this._updateTileGeometryState(t),this._shortBatches&&this._updatePendingTileGeometries(),e.madeProgress()),e.done)),!this._oneBatchPerFrameTask&&this._updatePendingTileGeometries())}_updateTextures(e){e.done||this._allTiles.some(t=>(this._updateTileTexture(t,e),e.done))}_updateClippingExtent(){this.spatialReference&&(this.overlayManager?.updateOverlayParameters(1),this.overlayManager.setPlacementDirty(),this._updateRootTiles())}get _lodBias(){const e=this.view.quality;return this.view.qualitySettings.tiledSurface.lodBias-(1-e)*pe}_getLodBiasCorrectedScale(e){const t=this.tilingScheme.levels,i=l(e-this._lodBias,0,t.length-1),r=i-Math.floor(i);return t[Math.floor(i)].scale*(1-r)+t[Math.ceil(i)].scale*r}_removeAllTiles(){null!=this._rootTiles&&(this._rootTiles.forEach(e=>this._purgeTile(e)),this._setRootTiles(null),this.notifyChange("ready")),this._allTiles.clear(),this.notifyChange("demResolution"),this.emit("tiles-changed",{allTiles:this.allTiles}),this.renderer.visible=!1}_purgeSubtree(e){const t=e.children;t[0]&&(this._purgeTile(t[0]),this._purgeTile(t[1]),this._purgeTile(t[2]),this._purgeTile(t[3]),e.clearChildren())}_purgeTile(e){e.leaf?ht(e):this._purgeSubtree(e),this._allTiles.removeUnordered(e),this._unloadTile(e),e.dispose(),this._tileCache.put(Xe._tileMemcacheKey,e),this.notifyChange("demResolution"),this.emit("tiles-changed",{allTiles:this.allTiles})}_unloadTile(e){this._pendingTilesToUpdate.delete(e),this._pendingTilesForElevationUpdateEvent.delete(e),e.unload()}_splitTile(e){_e(e.leaf,"Tile that is already split should not be split again!"),_e(e.rendered,"Tile marked to split is not rendered"),ht(e);const t=e.createChildren();this._allTiles.pushArray(t),this.notifyChange("demResolution"),this.emit("tiles-changed",{allTiles:this.allTiles}),e.updateAgentSuspension(),_e(e.rendered,"parent should be rendered"),t.forEach(e=>this._loadTile(e)),t.forEach(e=>this._pendingTilesToUpdate.add(e)),this._unloadTile(e),this._markAllTileNeighborsForUpdate(e),this._emitTileScaleChange(e,e.level+1),this._allTilesDirty=!0,this._shortBatches&&this._updatePendingTileGeometries(),t.forEach(e=>lt(e,e.hasPendingUpdate(1))),++this._performanceInfo.numSplit}_emitTileScaleChange(e,t=e.level){st.spatialReference=this.spatialReference,st.extent=e.extent,st.scale=this._getLodBiasCorrectedScale(t),this.emit("scale-change",st)}createTile(e,t,i,r){_e(!!r,"createTile sanity check");const s=this._acquireTile(e,t,i,r);return s.updateClippingStatus(this.extent),s.updateScreenDepth(this.view.state.contentCamera.viewProjectionMatrix),this._shouldSplit(s)&&s.setPendingUpdate(1),s}get _shortBatches(){return 2!==this.view.state.mode}_mergeTile(e){_e(!e.hasPendingUpdate(1),"_mergeTile sanity check"),_e(!e.leaf,"Cannot merge a leaf"),e.leaf||(this._purgeSubtree(e),_e(!e.renderData,"Merging tile with existing render data?"),this._loadTile(e),this._markTileToUpdate(e),this._emitTileScaleChange(e),this._shortBatches&&this._updatePendingTileGeometries(),lt(e,!1),this._allTilesDirty=!0,++this._performanceInfo.numMerged)}_loadTile(e){e.load(),this.requestUpdate(),this._allTilesDirty=!0,this.overlayManager?.hasOverlays&&this.overlayManager.updateTileOverlayParameters(e)}_handleLayerViewChanges(e=Qe){if(!this._layerViewsDirty)return;this._layerViewsDirty=!1;let t=!1;const i=new Set;let r=-1;for(let s=this.view.allLayerViews.length-1;s>=0;s--){const e=this.view.allLayerViews.items[s];if(i.add(e.uid),ve(e)||we(e))if(this._basemapLayerViewHandles.has(e.uid)&&!we(e)){const i=this._layerClassFromLayerView(e),s=this.getLayerIndexByUID(i,e.uid);null!=s&&((s<r||null==r)&&(t=!0),r=s)}else this._registerTiledLayerView(e),e.layer.loaded&&(t=!0)}this._basemapLayerViewHandles.forEach((e,r)=>{i.has(r)||(this._unregisterTiledLayerView(r),t=!0)}),t&&this._updateTiledLayers(),this.hasCompositeBlendMode=this._hasCompositeBlendMode(),this._evaluateTransparency(),e.madeProgress()}get _isFullyTransparent(){if(this.view.map?.ground?.opacity>0)return!1;for(const e of this.view.allLayerViews.items)if(Se(e)&&!$(e.layer)&&0!==e.fullOpacity)return!1;return!0}_hasCompositeBlendMode(){for(const e of this.view.allLayerViews.items)if((Ce(e)||we(e))&&Ne(Fe[e.layer.blendMode]))return!0;return!1}_layerClassFromLayerView(e){return be(e)?0:1}_registerTiledLayerView(e){const t=[];if((Ce(e)||we(e))&&t.push(_(()=>e.layer.blendMode,()=>{this.hasCompositeBlendMode=this._hasCompositeBlendMode(),this._updateTileTextures(2)})),!we(e)){const i=this._layerClassFromLayerView(e);t.push(_(()=>!e.destroyed&&e.suspended,()=>this._updateTiledLayers())),t.push(_(()=>!e.destroyed&&e.fullOpacity,()=>this._updateTileTextures(2)));const{layer:r}=e;"effectiveScaleRange"in r&&t.push(_(()=>!e.destroyed&&r.effectiveScaleRange,()=>this._restartAllAgents(i))),t.push(e.on("data-changed",()=>{const t=this.getLayerIndexByUID(i,e.uid);null!=t&&this._invalidateLayerData(t,i)}))}this._unregisterTiledLayerView(e.uid),this._basemapLayerViewHandles.set(e.uid,t)}_unregisterTiledLayerView(e){const t=this._basemapLayerViewHandles.get(e);if(t){for(const e of t)e.remove();this._basemapLayerViewHandles.delete(e)}}_updateTiledLayers(){if(!this.tilingScheme||this.view.suspended)return;const e=this.view.allLayerViews,t=[[],[]];let i=null;e.forEach(e=>{if(!e.layer||e.suspended||!ve(e)||!e.fullExtent)return;const r=this._layerClassFromLayerView(e);if(1===r){const t=e.displayLevelRange.maxLevel;t!==1/0&&(null===i||t>i)&&(i=t)}t[r].push(e)});for(const r of ie){const e=this._layerViews[r],i=t[r];i.reverse();const s=i.length;let a=e.length!==s;const n=new Array(s),l=new Array(e.length);this._layerIndexByUid[r].clear();for(let t=0;t<s;t++){const s=i[t].uid;this._layerIndexByUid[r].set(s,t);const o=e.indexOf(i[t]);n[t]=o,t!==o&&(a=!0),o>-1&&(l[o]=t)}if(a){const e=this._postorderIterator;for(e.reset(this._rootTiles);!e.done;)e.next().modifyLayers(l,n,r);this._layerViews[r]=i,this._restartAllAgents(r),this._updateTilesVisibility(this._rootTiles)}}this.tilingScheme.ensureMaxLod(i)&&(this._viewChangeUpdate(),this.notifyChange("tilingScheme"))}_restartAllAgents(e){const t=this._postorderIterator;for(t.reset(this._rootTiles);!t.done;){const i=t.next();i.restartAgents(e),0===e&&i.computeElevationBounds()}this._updateRootTileElevationBounds()}layerViewByIndex(e,t){return this._layerViews[t][e]}numLayers(e){return this._layerViews[e].length}_updateTileTextures(e){this._allTiles.forAll(t=>{t.updateAgents(1),1===e?this.renderer.updateTileTexture(t,16):t.updateRenderData(1,e)}),this._evaluateTransparency()}_invalidateLayerData(e,t){this._allTiles.forAll(i=>i.removeLayerAgent(e,t)),this._allTiles.forAll(i=>i.invalidateLayerData(e,t))}setTileTreeDirty(){this._allTilesDirty=!0}requestRender(e=1){this.renderer.setNeedsRender(e)}requestUpdate(){1===++this._pendingUpdates&&(this._hasPendingUpdates=!0)}requestTileData(e,t,i,r){const s=this.layerViewByIndex(t,i),a=s.layer;return!a.tilemapCache||me(s)?this._requestTileData(e,i,s,r):(++this._asyncWorkItems,a.tilemapCache.fetchAvailability(e.level,e.lij[1],e.lij[2],{...r,timeout:6e3}).then(()=>--this._asyncWorkItems).catch(t=>{throw--this._asyncWorkItems,p(r),c(t)||this._dataMissing(e,i,s),t}).then(()=>this._frameTask.schedule(()=>this._requestTileData(e,i,s,r),r.signal)))}_requestTileData(e,t,i,r){if(this.destroying)return Promise.resolve();const s=0===t;return r.requester??=s?this._elevationDataRequester:this._mapDataRequester,s?be(i)?this._requestElevationTileData(e,i,r):Promise.reject():Se(i)?this._requestMapTileData(e,i,r):Promise.reject()}_requestElevationTileData(e,t,i){++this._asyncWorkItems;const r=r=>{!g(i)&&r&&(this.setMemoryDirty(),this.requestUpdate(),this._elevationDataArrived(e,t,r))},s=i=>{c(i)||(n.getLogger(this).error(`Tile ${e.lij.toString()} layer 0/${t.uid} error ${i}`),this._dataMissing(e,0,t),this.requestUpdate())};return t.fetchElevationTile(e,i).then(e=>this._frameTask.schedule(()=>r(e)),s).finally(()=>--this._asyncWorkItems)}_elevationDataArrived(e,t,i){const r=this._layerIndexByUid[0].get(t.uid);if(null==r)return void n.getLogger(this).warn("TerrainSurface: received data from unknown layer %d %s",0,e.lij.toString());const s=new Z(e.lij,e.extent,i);e.dataArrived(r,0,s),this.emit("tile-data-changed",{tile:e,layerIndex:r,layerClass:0});const a=[e],l=e.level,o=this._iteratorPool.acquire();for(o.reset(a);!o.done;){const e=o.next();e.findElevationBoundsForLayer(r,l),e.computeElevationBounds()}0===l&&this._updateRootTileElevationBounds(),o.remove(),this._updateTilesVisibility(a)}_requestMapTileData(e,t,i){++this._asyncWorkItems;const r=(r,s)=>{xe(s),g(i)||(console.error(`Tile ${e.lij.toString()} layer 1/${t.uid} error ${r}`),this._dataMissing(e,1,t),this.requestUpdate())},s=e=>t=>r(t,e),a=r=>this._frameTask.schedule(()=>{this.requestUpdate(),g(i)?xe(r):this._mapTileDataArrived(e,t,r)},i.signal,s(r)).catch(s(r)),n=(e,t=null)=>this._frameTask.schedule(()=>r(e,t));return t.fetchTile(e.lij,i).then(a,n).finally(()=>--this._asyncWorkItems)}_mapTileDataArrived(e,t,i){const r=this.getLayerIndexByUID(1,t.uid);if(null==r)return xe(i),void n.getLogger(this).warn("TerrainSurface: received data from unknown layer");e.dataArrived(r,1,i),this.emit("tile-data-changed",{tile:e,layerIndex:r,layerClass:1})}_dataMissing(e,t,i){const r=this.getLayerIndexByUID(t,i.uid);null!=r?(e.dataMissing(r,t),this.emit("tile-data-changed",{tile:e,layerIndex:r,layerClass:t})):n.getLogger(this).warn("TerrainSurface: received data from unknown layer")}get performanceInfo(){const e=this._performanceInfo;return e.numNodes=this._allTiles.length,e.numLeaves=e.numVisible=e.numRendered=e.numLoadedPerLevel.length=e.numRenderedPerLevel.length=0,this._allTiles.forAll(t=>{t.leaf&&e.numLeaves++;const i=t.level;t.renderData&&(e.numLoadedPerLevel[i]=(e.numLoadedPerLevel[i]||0)+1),t.visible&&(e.numVisible++,t.rendered&&(e.numRenderedPerLevel[i]=(e.numRenderedPerLevel[i]||0)+1,e.numRendered++))}),e}setMemoryDirty(){this._usedMemory=null}get usedMemory(){return this.tilingScheme?(null==this._usedMemory&&(this._usedMemory=this._recalculateUsedMemory()),this._usedMemory??0):0}_recalculateUsedMemory(){return this.tilingScheme?Math.round(this._allTiles.reduce((e,t)=>e+t.usedMemory,0)):null}getUsedMemoryForLayerView(e){let t=0;const i=this._layerClassFromLayerView(e),r=this.getLayerIndexByUID(i,e.uid);return null!=r&&this._allTiles.forAll(e=>t+=e.getUsedMemoryForLayer(i,r)),t}get renderPatchBorders(){return this._renderer.renderPatchBorders}set renderPatchBorders(e){this._renderer.renderPatchBorders=e}get visualizeNormals(){return this._renderer.visualizeNormals}set visualizeNormals(e){this._renderer.visualizeNormals=e}get renderingDisabled(){return this._renderer.renderingDisabled}set renderingDisabled(e){this._renderer.renderingDisabled=e}get test(){}checkAllTilesWaterproofness(){if(!Pe)return;const e=this._rootTiles;if(null==e)return;const t=e=>e?.renderData?.geometry?.indices?.length>0,i=(e,i)=>{t(e)&&console.error("Tile[",e.lij,"] has geometry although parent[",i.lij,"] has geom")},r=e=>{if(e.intersectsClippingArea)if(e.renderData&&!e.renderData.geometryState&&console.error("Tile[",e.lij,"] has renderData but not geometryState"),e.renderData&&!e.renderData.geometry&&console.error("Tile[",e.lij,"] has renderData but not geometryInfo"),!e.renderData?.geometry||(e.renderData.geometry.indices?.length??0)>0||console.error("Tile[",e.lij,"] has renderData but no indices - geometryInfo: ",e.renderData.geometry),t(e)){e.checkGeometryWaterproofness();for(const t of e.children)i(t,e)}else if(e.leaf)console.error("Tile[",e.lij,"] has no geometry and no children, from root to leaf");else for(const t of e.children)r(t)},s=e=>{const t=e.parent?.visible??!0,i=e.visible;e.computeVisibility();const r=e.visible;if(i!==r&&t&&console.error(" Tile[",e.lij,"] has out of date visibility: ",i," instead of ",r),!e.leaf)for(const a of e.children)s(a)};for(const a of e)r(a),s(a)}get isGlobal(){return this._isGlobal}get isGeographic(){return this._isGeographic}get isWebMercator(){return this._isWebMercator}get isWebMercatorOnPlateCarree(){return this._isWebMercatorOnPlateCarree}isEastEndWrap(e){return this._isGlobal&&e[2]===this.lijEastEnd(e[0])-1}isWestEndWrap(e){return this._isGlobal&&0===e[2]}lijEastEnd(e){return 1<<e+(this._isGeographic?1:0)}wrapEastWest(e){const t=this.lijEastEnd(e[0]),i=e[2];if(0<=i&&i<t)return e;if(!this._isGlobal)return null;const r=(i+(i<0?t:0))%t;return[e[0],e[1],r]}enableInternalChecks(e){Ue(e)}enableWaterproofnessChecks(e){Me(e)}static cleanupTerrainSurface(){it.prune()}enable(e){e!==this._enabled&&(e?(this._updateRootTiles(),this.suspended=!1):(this.suspended=!0,this._removeAllTiles(),this._setRootTiles(null)),this._enabled=e)}};e([v()],Ke.prototype,"_renderer",void 0),e([v({constructOnly:!0})],Ke.prototype,"_scaleRangeQueries",void 0),e([v({constructOnly:!0})],Ke.prototype,"view",void 0),e([v({constructOnly:!0})],Ke.prototype,"overlayManager",void 0),e([v({constructOnly:!0})],Ke.prototype,"terrainTextureCompressionTracker",void 0),e([v()],Ke.prototype,"_hasPendingUpdates",void 0),e([v()],Ke.prototype,"_asyncWorkItems",void 0),e([v()],Ke.prototype,"_allTilesDirty",void 0),e([v()],Ke.prototype,"_allTilesSorted",void 0),e([v()],Ke.prototype,"_viewChanged",void 0),e([v({type:Number})],Ke.prototype,"heading",void 0),e([v()],Ke.prototype,"_splitLimits",void 0),e([v({readOnly:!0})],Ke.prototype,"_watchUpdatingTracking",void 0),e([v()],Ke.prototype,"_frameTask",void 0),e([v()],Ke.prototype,"demResolution",null),e([v({readOnly:!0})],Ke.prototype,"snapLevel",null),e([v({readOnly:!0})],Ke.prototype,"lodSnappingEnabled",null),e([v()],Ke.prototype,"_userClippingExtent",null),e([v()],Ke.prototype,"_rootTilesExtent",void 0),e([v({readOnly:!0})],Ke.prototype,"extent",null),e([v({readOnly:!0})],Ke.prototype,"groundExtent",null),e([v({readOnly:!0})],Ke.prototype,"_tilingSchemeExtent",null),e([v({readOnly:!0})],Ke.prototype,"updating",null),e([v({readOnly:!0})],Ke.prototype,"readyToRun",null),e([v(K)],Ke.prototype,"updatingProgress",void 0),e([v({readOnly:!0})],Ke.prototype,"updatingProgressValue",null),e([v()],Ke.prototype,"_maxNumUpdating",void 0),e([v()],Ke.prototype,"baseOpacity",null),e([v()],Ke.prototype,"hasCompositeBlendMode",void 0),e([v({readOnly:!0})],Ke.prototype,"viewingMode",null),e([v()],Ke.prototype,"maxTextureScale",void 0),e([v({readOnly:!0})],Ke.prototype,"ready",null),e([v({readOnly:!0})],Ke.prototype,"rootTiles",null),e([v()],Ke.prototype,"_rootTiles",void 0),e([v({readOnly:!0})],Ke.prototype,"spatialReference",null),e([v({type:t})],Ke.prototype,"backgroundColor",null),e([v({value:!1})],Ke.prototype,"slicePlaneEnabled",null),e([v({readOnly:!0})],Ke.prototype,"tilingScheme",void 0),e([v({readOnly:!0})],Ke.prototype,"tilingSchemeLocked",null),e([v({readOnly:!0})],Ke.prototype,"tilingSchemeLogic",void 0),e([v()],Ke.prototype,"wireframe",null),e([v({value:!1})],Ke.prototype,"suspended",null),e([v()],Ke.prototype,"fadeDuration",null),e([v()],Ke.prototype,"visibleElevationBounds",void 0),e([v()],Ke.prototype,"rootTileElevationBounds",void 0),e([v()],Ke.prototype,"_layerViewsDirty",void 0),e([v()],Ke.prototype,"renderPatchBorders",null),e([v()],Ke.prototype,"visualizeNormals",null),e([v()],Ke.prototype,"renderingDisabled",null),Ke=Xe=e([w("esri.views.3d.terrain.TerrainSurface")],Ke);const Je=Ke,Ze=b(),et=G(),tt=D(),it=new u,rt=new Y("ground"),st={spatialReference:null,extent:null,scale:0};function at(e,t,i){for(const r of e){if(!r.containsPointXY(t,i))continue;let e=r;for(;e&&!e.renderData;){const r=(t>e.extentMidX?1:0)+(i<e.extentMidY?2:0);e=e.children[r]}const s=e?.renderData?.geometryState.samplerData??null;return ee(t,i,s)}return null}class nt{constructor(e){this.capacity=e,this._head=0,this._tail=0,this._data=new Array(e)}push(e){const t=this._tail;if(!(t<this.capacity))throw new Error("Queue full");this._data[t]=e,this._tail=t+1}pushAll(e){const t=e.length;if(0===t)return;const i=this._tail;if(!(i+t<=this.capacity))throw new Error("Queue full");for(let r=0;r<t;++r)this._data[i+r]=e[r];this._tail=i+t}pop(){const e=this._head;if(e<this._tail){const t=this._data[e];return this._head=e+1,t}}get empty(){return this._head>=this._tail}get full(){return this._tail>=this._data.length}}function lt(e,t){!e.leaf||e.level<ue||ut(e,e=>{t&&ot(e);const i=dt(e);if(e.maxLevelDeltaNeighborCount++,i){let t=e.parent;for(;t;){const e=dt(t);if(t.unmergableChildCount++,!e)break;t=t.parent}}})}function ot(e){if(e.hasPendingUpdate(1))return;let t=e.parent;for(;t?.resetPendingUpdate(4);)t=t.parent;e.resetPendingUpdate(4),e.leaf&&e.setPendingUpdate(1),e.level<ue||ut(e,e=>{ot(e)})}function ht(e){e.level<ue||ut(e,e=>{if(e.maxLevelDeltaNeighborCount--,0===e.maxLevelDeltaNeighborCount&&0===e.unmergableChildCount){let t=e.parent;for(;t&&(t.unmergableChildCount--,dt(t));)t=t.parent}})}function dt(e){return 0===e.maxLevelDeltaNeighborCount&&0===e.unmergableChildCount}function ut(e,t){if(e.level<ue)return;const i=e.level-ue,r=e.lij[1]>>ue,s=e.lij[2]>>ue,a=e=>e.leaf||e.level===i;for(let n=0;n<4;++n){const l=e.findNeighborTile(fe[n],a);if(!l||l.level!==i)continue;const o=l.lij;o[1]===r&&o[2]===s||t(l)}}const pt=b();export{Je 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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../../../core/ObjectPool.js";import e from"../../../../core/PooledArray.js";import{m as n,s as o,g as i,f as s}from"../../../../chunks/vec32.js";import{fromValues as r,create as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{intersectsSphere as a}from"../../../../geometry/support/frustum.js";import{wrap as l}from"../../../../geometry/support/ray.js";import{j as d,g as u,a as c,p as f,c as m,q as _,k as p}from"../../../../chunks/sphere.js";import{rayBoxTest as b}from"./Util.js";class g{get bounds(){return this._root.bounds}get halfSize(){return this._root.halfSize}get root(){return this._root.node}get maximumObjectsPerNode(){return this._maximumObjectsPerNode}get maximumDepth(){return this._maximumDepth}get objectCount(){return this._objectCount}constructor(t,e){this.objectToBoundingSphere=t,this._maximumObjectsPerNode=10,this._maximumDepth=20,this._degenerateObjects=new Set,this._root=new S,this._objectCount=0,e&&(void 0!==e.maximumObjectsPerNode&&(this._maximumObjectsPerNode=e.maximumObjectsPerNode),void 0!==e.maximumDepth&&(this._maximumDepth=e.maximumDepth))}destroy(){this._degenerateObjects.clear(),S.clearPool(),k[0]=null,W.prune(),X.prune()}add(t){const e=Array.from(t);this._grow(e);const n=S.acquire();for(const o of e)++this._objectCount,this._isDegenerate(o)?this._degenerateObjects.add(o):(n.init(this._root),this._add(o,n));S.release(n)}remove(t,e=null){this._objectCount-=t.length;const n=S.acquire();for(const o of t){const t=e??d(this.objectToBoundingSphere(o),V);F(t[3])?(n.init(this._root),O(o,t,n)):this._degenerateObjects.delete(o)}S.release(n),this._shrink()}update(t,e){if(!F(e[3])&&this._isDegenerate(t))return;const n=C(t);this.remove(n,e),this.add(n)}forEachAlongRay(t,e,n){const o=l(t,e);j(this._root,t=>{if(!M(o,t))return!1;const e=t.node;return e.terminals.forAll(t=>{this._intersectsObject(o,t)&&n(t)}),null!==e.residents&&e.residents.forAll(t=>{this._intersectsObject(o,t)&&n(t)}),!0})}forEachAlongRayWithVerticalOffset(t,e,n,o){const i=l(t,e);j(this._root,t=>{if(!N(i,t,o))return!1;const e=t.node;return e.terminals.forAll(t=>{this._intersectsObjectWithOffset(i,t,o)&&n(t)}),null!==e.residents&&e.residents.forAll(t=>{this._intersectsObjectWithOffset(i,t,o)&&n(t)}),!0})}forEach(t){j(this._root,e=>{const n=e.node;return n.terminals.forAll(t),null!==n.residents&&n.residents.forAll(t),!0}),this._degenerateObjects.forEach(t)}forEachDegenerateObject(t){this._degenerateObjects.forEach(t)}findClosest(t,e,n,o=()=>!0,r=1/0){let h=1/0,l=1/0,d=null;const u=P(t,e),f=i=>{if(--r,!o(i))return;const s=this.objectToBoundingSphere(i);if(!a(n,s))return;const u=R(t,e,c(s)),f=u-s[3],m=u+s[3];f<h&&(h=f,l=m,d=i)};return x(this._root,o=>{if(r<=0||!a(n,o.bounds))return!1;i(L,u,o.halfSize),s(L,L,c(o.bounds));if(R(t,e,L)>l)return!1;const h=o.node;return h.terminals.forAll(t=>f(t)),null!==h.residents&&h.residents.forAll(t=>f(t)),!0},t,e),d}forEachInDepthRange(t,e,n,o,r,h,l){let d=-1/0,u=1/0;const f={setRange:t=>{1===n?(d=Math.max(d,t.near),u=Math.min(u,t.far)):(d=Math.max(d,-t.far),u=Math.min(u,-t.near))}};f.setRange(o);const m=R(e,n,t),_=P(e,n),p=P(e,-n),b=t=>{if(!l(t))return;const o=this.objectToBoundingSphere(t),i=c(o),s=R(e,n,i)-m,_=s-o[3],p=s+o[3];_>u||p<d||!a(h,o)||r(t,f)};x(this._root,t=>{if(!a(h,t.bounds))return!1;i(L,_,t.halfSize),s(L,L,c(t.bounds));if(R(e,n,L)-m>u)return!1;i(L,p,t.halfSize),s(L,L,c(t.bounds));if(R(e,n,L)-m<d)return!1;const o=t.node;return o.terminals.forAll(t=>b(t)),null!==o.residents&&o.residents.forAll(t=>b(t)),!0},e,n)}forEachNode(t){j(this._root,e=>t(e.node,e.bounds,e.halfSize,e.depth))}forEachNeighbor(t,e){const n=u(e),i=c(e),s=e=>{const s=this.objectToBoundingSphere(e),r=u(s),h=n+r;return!(o(c(s),i)-h*h<=0)||t(e)};let r=!0;const h=t=>{r&&(r=s(t))};j(this._root,t=>{const e=u(t.bounds),s=n+e;if(o(c(t.bounds),i)-s*s>0)return!1;const a=t.node;return a.terminals.forAll(h),r&&null!==a.residents&&a.residents.forAll(h),r}),r&&this.forEachDegenerateObject(h)}_intersectsObject(t,e){const n=this.objectToBoundingSphere(e);return!(n[3]>0)||f(n,t)}_intersectsObjectWithOffset(t,e,n){const o=this.objectToBoundingSphere(e);return!(o[3]>0)||f(n.applyToBoundingSphere(o),t)}_add(t,e){e.advanceTo(this.objectToBoundingSphere(t))?e.node.terminals.push(t):(e.node.residents.push(t),e.node.residents.length>this._maximumObjectsPerNode&&e.depth<this._maximumDepth&&this._split(e))}_split(t){const e=t.node.residents;t.node.residents=null;for(let n=0;n<e.length;n++){const o=S.acquire().init(t);this._add(e.at(n),o),S.release(o)}}_grow(t){if(v(t,t=>this.objectToBoundingSphere(t),G),F(G[3])&&!this._fitsInsideTree(G))if(T(this._root.node))d(G,this._root.bounds),this._root.halfSize=1.25*this._root.bounds[3],this._root.updateBoundsRadiusFromHalfSize();else{const t=this._rootBoundsForRootAsSubNode(G);this._placingRootViolatesMaxDepth(t)?this._rebuildTree(G,t):this._growRootAsSubNode(t),S.release(t)}}_rebuildTree(t,e){_(U,e.bounds),U[3]=e.halfSize,v([t,U],t=>t,K);const n=S.acquire().init(this._root);this._root.initFrom(null,K,K[3]),this._root.increaseHalfSize(1.25),j(n,t=>(this.add(t.node.terminals.data),null!==t.node.residents&&this.add(t.node.residents.data),!0)),S.release(n)}_placingRootViolatesMaxDepth(t){const e=Math.log(t.halfSize/this._root.halfSize)*Math.LOG2E;let n=0;return j(this._root,t=>(n=Math.max(n,t.depth),n+e<=this._maximumDepth)),n+e>this._maximumDepth}_rootBoundsForRootAsSubNode(t){const e=t[3],n=t;let o=-1/0;const i=this._root.bounds,s=this._root.halfSize;for(let h=0;h<3;h++){const t=i[h]-s-(n[h]-e),r=n[h]+e-(i[h]+s),a=Math.max(0,Math.ceil(t/(2*s))),l=Math.max(0,Math.ceil(r/(2*s)))+1,d=2**Math.ceil(Math.log(a+l)*Math.LOG2E);o=Math.max(o,d),Q[h].min=a,Q[h].max=l}for(let h=0;h<3;h++){let t=Q[h].min,e=Q[h].max;const n=(o-(t+e))/2;t+=Math.ceil(n),e+=Math.floor(n);const r=i[h]-s-t*s*2;I[h]=r+(e+t)*s}const r=o*s;return I[3]=r*y,S.acquire().initFrom(null,I,r,0)}_growRootAsSubNode(t){const e=this._root.node;_(G,this._root.bounds),G[3]=this._root.halfSize,this._root.init(t),t.advanceTo(G,null,!0),t.node.children=e.children,t.node.residents=e.residents,t.node.terminals=e.terminals}_shrink(){for(;;){const t=this._findShrinkIndex();if(-1===t)break;this._root.advance(t),this._root.depth=0}}_findShrinkIndex(){if(0!==this._root.node.terminals.length||this._root.isLeaf())return-1;let t=null;const e=this._root.node.children;let n=0,o=0;for(;o<e.length&&null==t;)n=o++,t=e[n];for(;o<e.length;)if(e[o++])return-1;return n}_isDegenerate(t){return!F(this.objectToBoundingSphere(t)[3])}_fitsInsideTree(t){const e=this._root.bounds,n=this._root.halfSize;return t[3]<=n&&t[0]>=e[0]-n&&t[0]<=e[0]+n&&t[1]>=e[1]-n&&t[1]<=e[1]+n&&t[2]>=e[2]-n&&t[2]<=e[2]+n}toJSON(){const{maximumDepth:t,maximumObjectsPerNode:e,_objectCount:n}=this,o=this._nodeToJSON(this._root.node);return{maximumDepth:t,maximumObjectsPerNode:e,objectCount:n,root:{bounds:this._root.bounds,halfSize:this._root.halfSize,depth:this._root.depth,node:o}}}_nodeToJSON(t){const e=t.children.map(t=>t?this._nodeToJSON(t):null),n=t.residents?.map(t=>this.objectToBoundingSphere(t)),o=t.terminals?.map(t=>this.objectToBoundingSphere(t));return{children:e,residents:n,terminals:o}}static fromJSON(t){const e=new g(t=>t,{maximumDepth:t.maximumDepth,maximumObjectsPerNode:t.maximumObjectsPerNode});return e._objectCount=t.objectCount,e._root.initFrom(t.root.node,t.root.bounds,t.root.halfSize,t.root.depth),e}}class S{constructor(){this.bounds=m(),this.halfSize=0,this.initFrom(null,null,0,0)}init(t){return this.initFrom(t.node,t.bounds,t.halfSize,t.depth)}initFrom(t,e,n,o=this.depth){return this.node=null!=t?t:S.createEmptyNode(),e&&d(e,this.bounds),this.halfSize=n,this.depth=o,this}increaseHalfSize(t){this.halfSize*=t,this.updateBoundsRadiusFromHalfSize()}updateBoundsRadiusFromHalfSize(){this.bounds[3]=this.halfSize*y}advance(t){let e=this.node.children[t];e||(e=S.createEmptyNode(),this.node.children[t]=e),this.node=e,this.halfSize/=2,this.depth++;const n=q[t];return this.bounds[0]+=n[0]*this.halfSize,this.bounds[1]+=n[1]*this.halfSize,this.bounds[2]+=n[2]*this.halfSize,this.updateBoundsRadiusFromHalfSize(),this}advanceTo(t,e,n=!1){for(;;){if(this.isTerminalFor(t))return e&&e(this,-1),!0;if(this.isLeaf()){if(!n)return e&&e(this,-1),!1;this.node.residents=null}const o=this._childIndex(t);e&&e(this,o),this.advance(o)}}isLeaf(){return null!=this.node.residents}isTerminalFor(t){return t[3]>this.halfSize/2}_childIndex(t){const e=this.bounds;return(e[0]<t[0]?1:0)+(e[1]<t[1]?2:0)+(e[2]<t[2]?4:0)}static createEmptyNode(){return{children:[null,null,null,null,null,null,null,null],terminals:new e({shrink:!0}),residents:new e({shrink:!0})}}static{this._pool=new t(S)}static acquire(){return S._pool.acquire()}static release(t){S._pool.release(t)}static clearPool(){S._pool.prune()}}function j(t,e){let n=S.acquire().init(t);const o=[n];for(;0!==o.length;){if(n=o.pop(),e(n)&&!n.isLeaf())for(let t=0;t<n.node.children.length;t++){n.node.children[t]&&o.push(S.acquire().init(n).advance(t))}S.release(n)}}function x(t,e,n,o=1){let i=S.acquire().init(t);const s=[i];for(E(n,o,Y);0!==s.length;){if(i=s.pop(),e(i)&&!i.isLeaf())for(let t=7;t>=0;--t){const e=Y[t];i.node.children[e]&&s.push(S.acquire().init(i).advance(e))}S.release(i)}}function O(t,e,n){W.clear();const o=n.advanceTo(e,(t,e)=>{W.push(t.node),W.push(e)})?n.node.terminals:n.node.residents;if(o.removeUnordered(t),0===o.length)for(let i=W.length-2;i>=0;i-=2){if(!z(W.data[i],W.data[i+1]))break}}function z(t,n){return n>=0&&(t.children[n]=null),!!T(t)&&(null===t.residents&&(t.residents=new e({shrink:!0})),!0)}function M(t,e){return B(c(e.bounds),2*-e.halfSize,H),B(c(e.bounds),2*e.halfSize,J),b(t.origin,t.direction,H,J)}function N(t,e,n){return B(c(e.bounds),2*-e.halfSize,H),B(c(e.bounds),2*e.halfSize,J),n.applyToMinMax(H,J),b(t.origin,t.direction,H,J)}function T(t){if(0!==t.terminals.length)return!1;if(null!==t.residents)return 0===t.residents.length;for(let e=0;e<t.children.length;e++)if(t.children[e])return!1;return!0}function D(t,e){t[0]=Math.min(t[0],e[0]-e[3]),t[1]=Math.min(t[1],e[1]-e[3]),t[2]=Math.min(t[2],e[2]-e[3])}function A(t,e){t[0]=Math.max(t[0],e[0]+e[3]),t[1]=Math.max(t[1],e[1]+e[3]),t[2]=Math.max(t[2],e[2]+e[3])}function B(t,e,n){n[0]=t[0]+e,n[1]=t[1]+e,n[2]=t[2]+e}function v(t,e,o){H[0]=1/0,H[1]=1/0,H[2]=1/0,J[0]=-1/0,J[1]=-1/0,J[2]=-1/0;for(const n of t){const t=e(n);F(t[3])&&(D(H,t),A(J,t))}p(o,n(Z,H,J,.5)),o[3]=Math.max(J[0]-H[0],J[1]-H[1],J[2]-H[2])/2}function E(t,e,n){if(!X.length)for(let o=0;o<8;++o)X.push({index:0,distance:0});for(let o=0;o<8;++o){const n=q[o];X.data[o].index=o,X.data[o].distance=R(t,e,n)}X.sort((t,e)=>t.distance-e.distance);for(let o=0;o<8;++o)n[o]=X.data[o].index}function P(t,e){let n,o=1/0;for(let i=0;i<8;++i){const s=R(t,e,w[i]);s<o&&(o=s,n=w[i])}return n}function R(t,e,n){return e*(t[0]*n[0]+t[1]*n[1]+t[2]*n[2])}function F(t){return!isNaN(t)&&t!==-1/0&&t!==1/0&&t>0}const q=[r(-1,-1,-1),r(1,-1,-1),r(-1,1,-1),r(1,1,-1),r(-1,-1,1),r(1,-1,1),r(-1,1,1),r(1,1,1)],w=[r(-1,-1,-1),r(-1,-1,1),r(-1,1,-1),r(-1,1,1),r(1,-1,-1),r(1,-1,1),r(1,1,-1),r(1,1,1)],y=Math.sqrt(3),k=[null];function C(t){return k[0]=t,k}const I=m(),L=h(),H=h(),J=h(),W=new e,V=m(),G=m(),U=m(),K=m(),Q=[{min:0,max:0},{min:0,max:0},{min:0,max:0}],X=new e,Y=[0,0,0,0,0,0,0,0],Z=h();export{g as Octree};
|
|
5
|
+
import t from"../../../../core/ObjectPool.js";import e from"../../../../core/PooledArray.js";import{m as n,s as o,g as i,f as s}from"../../../../chunks/vec32.js";import{fromValues as r,create as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{intersectsSphere as a}from"../../../../geometry/support/frustum.js";import{wrap as l}from"../../../../geometry/support/ray.js";import{j as d,g as u,a as c,p as f,c as m,q as _,k as p}from"../../../../chunks/sphere.js";import{rayBoxTest as b}from"./Util.js";class g{get bounds(){return this._root.bounds}get halfSize(){return this._root.halfSize}get root(){return this._root.node}get maximumObjectsPerNode(){return this._maximumObjectsPerNode}get maximumDepth(){return this._maximumDepth}get objectCount(){return this._objectCount}constructor(t,e){this.objectToBoundingSphere=t,this._maximumObjectsPerNode=10,this._maximumDepth=20,this._degenerateObjects=new Set,this._root=new S,this._objectCount=0,e&&(void 0!==e.maximumObjectsPerNode&&(this._maximumObjectsPerNode=e.maximumObjectsPerNode),void 0!==e.maximumDepth&&(this._maximumDepth=e.maximumDepth))}destroy(){this._degenerateObjects.clear(),S.clearPool(),k[0]=null,W.prune(),X.prune()}add(t){const e=Array.from(t);this._grow(e);const n=S.acquire();for(const o of e)++this._objectCount,this._isDegenerate(o)?this._degenerateObjects.add(o):(n.init(this._root),this._add(o,n));S.release(n)}remove(t,e=null){this._objectCount-=t.length;const n=S.acquire();for(const o of t){const t=e??d(this.objectToBoundingSphere(o),V);F(t[3])?(n.init(this._root),O(o,t,n)):this._degenerateObjects.delete(o)}S.release(n),this._shrink()}update(t,e){if(!F(e[3])&&this._isDegenerate(t))return;const n=C(t);this.remove(n,e),this.add(n)}forEachAlongRay(t,e,n){const o=l(t,e);j(this._root,t=>{if(!M(o,t))return!1;const e=t.node;return e.terminals.forAll(t=>{this._intersectsObject(o,t)&&n(t)}),null!==e.residents&&e.residents.forAll(t=>{this._intersectsObject(o,t)&&n(t)}),!0})}forEachAlongRayWithVerticalOffset(t,e,n,o){const i=l(t,e);j(this._root,t=>{if(!N(i,t,o))return!1;const e=t.node;return e.terminals.forAll(t=>{this._intersectsObjectWithOffset(i,t,o)&&n(t)}),null!==e.residents&&e.residents.forAll(t=>{this._intersectsObjectWithOffset(i,t,o)&&n(t)}),!0})}forEach(t){j(this._root,e=>{const n=e.node;return n.terminals.forAll(t),null!==n.residents&&n.residents.forAll(t),!0}),this._degenerateObjects.forEach(t)}forEachDegenerateObject(t){this._degenerateObjects.forEach(t)}findClosest(t,e,n,o=()=>!0,r=1/0){let h=1/0,l=1/0,d=null;const u=P(t,e),f=i=>{if(--r,!o(i))return;const s=this.objectToBoundingSphere(i);if(!a(n,s))return;const u=R(t,e,c(s)),f=u-s[3],m=u+s[3];f<h&&(h=f,l=m,d=i)};return x(this._root,o=>{if(r<=0||!a(n,o.bounds))return!1;i(L,u,o.halfSize),s(L,L,c(o.bounds));if(R(t,e,L)>l)return!1;const h=o.node;return h.terminals.forAll(t=>f(t)),null!==h.residents&&h.residents.forAll(t=>f(t)),!0},t,e),d}forEachInDepthRange(t,e,n,o,r,h,l){let d=-1/0,u=1/0;const f={setRange:t=>{1===n?(d=Math.max(d,t.near),u=Math.min(u,t.far)):(d=Math.max(d,-t.far),u=Math.min(u,-t.near))}};f.setRange(o);const m=R(e,n,t),_=P(e,n),p=P(e,-n),b=t=>{if(!l(t))return;const o=this.objectToBoundingSphere(t),i=c(o),s=R(e,n,i)-m,_=s-o[3],p=s+o[3];_>u||p<d||!a(h,o)||r(t,f)};x(this._root,t=>{if(!a(h,t.bounds))return!1;i(L,_,t.halfSize),s(L,L,c(t.bounds));if(R(e,n,L)-m>u)return!1;i(L,p,t.halfSize),s(L,L,c(t.bounds));if(R(e,n,L)-m<d)return!1;const o=t.node;return o.terminals.forAll(t=>b(t)),null!==o.residents&&o.residents.forAll(t=>b(t)),!0},e,n)}forEachNode(t){j(this._root,e=>t(e.node,e.bounds,e.halfSize,e.depth))}forEachNeighbor(t,e){const n=u(e),i=c(e),s=e=>{const s=this.objectToBoundingSphere(e),r=u(s),h=n+r;return!(o(c(s),i)-h*h<=0)||t(e)};let r=!0;const h=t=>{r&&(r=s(t))};j(this._root,t=>{const e=u(t.bounds),s=n+e;if(o(c(t.bounds),i)-s*s>0)return!1;const a=t.node;return a.terminals.forAll(h),r&&null!==a.residents&&a.residents.forAll(h),r}),r&&this.forEachDegenerateObject(h)}_intersectsObject(t,e){const n=this.objectToBoundingSphere(e);return!(n[3]>0)||f(n,t)}_intersectsObjectWithOffset(t,e,n){const o=this.objectToBoundingSphere(e);return!(o[3]>0)||f(n.applyToBoundingSphere(o),t)}_add(t,e){e.advanceTo(this.objectToBoundingSphere(t))?e.node.terminals.push(t):(e.node.residents.push(t),e.node.residents.length>this._maximumObjectsPerNode&&e.depth<this._maximumDepth&&this._split(e))}_split(t){const e=t.node.residents;t.node.residents=null;for(let n=0;n<e.length;n++){const o=S.acquire().init(t);this._add(e.at(n),o),S.release(o)}}_grow(t){if(v(t,t=>this.objectToBoundingSphere(t),G),F(G[3])&&!this._fitsInsideTree(G))if(T(this._root.node))d(G,this._root.bounds),this._root.halfSize=1.25*this._root.bounds[3],this._root.updateBoundsRadiusFromHalfSize();else{const t=this._rootBoundsForRootAsSubNode(G);this._placingRootViolatesMaxDepth(t)?this._rebuildTree(G,t):this._growRootAsSubNode(t),S.release(t)}}_rebuildTree(t,e){_(U,e.bounds),U[3]=e.halfSize,v([t,U],t=>t,K);const n=S.acquire().init(this._root);this._root.initFrom(null,K,K[3]),this._root.increaseHalfSize(1.25),j(n,t=>(this.add(t.node.terminals.data),null!==t.node.residents&&this.add(t.node.residents.data),!0)),S.release(n)}_placingRootViolatesMaxDepth(t){const e=Math.log(t.halfSize/this._root.halfSize)*Math.LOG2E;let n=0;return j(this._root,t=>(n=Math.max(n,t.depth),n+e<=this._maximumDepth)),n+e>this._maximumDepth}_rootBoundsForRootAsSubNode(t){const e=t[3],n=t;let o=-1/0;const i=this._root.bounds,s=this._root.halfSize;for(let h=0;h<3;h++){const t=i[h]-s-(n[h]-e),r=n[h]+e-(i[h]+s),a=Math.max(0,Math.ceil(t/(2*s))),l=Math.max(0,Math.ceil(r/(2*s)))+1,d=2**Math.ceil(Math.log(a+l)*Math.LOG2E);o=Math.max(o,d),Q[h].min=a,Q[h].max=l}for(let h=0;h<3;h++){let t=Q[h].min,e=Q[h].max;const n=(o-(t+e))/2;t+=Math.ceil(n),e+=Math.floor(n);const r=i[h]-s-t*s*2;I[h]=r+(e+t)*s}const r=o*s;return I[3]=r*y,S.acquire().initFrom(null,I,r,0)}_growRootAsSubNode(t){const e=this._root.node;_(G,this._root.bounds),G[3]=this._root.halfSize,this._root.init(t),t.advanceTo(G,null,!0),t.node.children=e.children,t.node.residents=e.residents,t.node.terminals=e.terminals}_shrink(){for(;;){const t=this._findShrinkIndex();if(-1===t)break;this._root.advance(t),this._root.depth=0}}_findShrinkIndex(){if(0!==this._root.node.terminals.length||this._root.isLeaf())return-1;let t=null;const e=this._root.node.children;let n=0,o=0;for(;o<e.length&&null==t;)n=o++,t=e[n];for(;o<e.length;)if(e[o++])return-1;return n}_isDegenerate(t){return!F(this.objectToBoundingSphere(t)[3])}_fitsInsideTree(t){const e=this._root.bounds,n=this._root.halfSize;return t[3]<=n&&t[0]>=e[0]-n&&t[0]<=e[0]+n&&t[1]>=e[1]-n&&t[1]<=e[1]+n&&t[2]>=e[2]-n&&t[2]<=e[2]+n}toJSON(){const{maximumDepth:t,maximumObjectsPerNode:e,_objectCount:n}=this,o=this._nodeToJSON(this._root.node);return{maximumDepth:t,maximumObjectsPerNode:e,objectCount:n,root:{bounds:this._root.bounds,halfSize:this._root.halfSize,depth:this._root.depth,node:o}}}_nodeToJSON(t){const e=t.children.map(t=>t?this._nodeToJSON(t):null),n=t.residents?.map(t=>this.objectToBoundingSphere(t)),o=t.terminals?.map(t=>this.objectToBoundingSphere(t));return{children:e,residents:n,terminals:o}}static fromJSON(t){const e=new g(t=>t,{maximumDepth:t.maximumDepth,maximumObjectsPerNode:t.maximumObjectsPerNode});return e._objectCount=t.objectCount,e._root.initFrom(t.root.node,t.root.bounds,t.root.halfSize,t.root.depth),e}}class S{constructor(){this.bounds=m(),this.halfSize=0,this.initFrom(null,null,0,0)}init(t){return this.initFrom(t.node,t.bounds,t.halfSize,t.depth)}initFrom(t,e,n,o=this.depth){return this.node=null!=t?t:S.createEmptyNode(),e&&d(e,this.bounds),this.halfSize=n,this.depth=o,this}increaseHalfSize(t){this.halfSize*=t,this.updateBoundsRadiusFromHalfSize()}updateBoundsRadiusFromHalfSize(){this.bounds[3]=this.halfSize*y}advance(t){let e=this.node.children[t];e||(e=S.createEmptyNode(),this.node.children[t]=e),this.node=e,this.halfSize/=2,this.depth++;const n=q[t];return this.bounds[0]+=n[0]*this.halfSize,this.bounds[1]+=n[1]*this.halfSize,this.bounds[2]+=n[2]*this.halfSize,this.updateBoundsRadiusFromHalfSize(),this}advanceTo(t,e,n=!1){for(;;){if(this.isTerminalFor(t))return e?.(this,-1),!0;if(this.isLeaf()){if(!n)return e?.(this,-1),!1;this.node.residents=null}const o=this._childIndex(t);e?.(this,o),this.advance(o)}}isLeaf(){return null!=this.node.residents}isTerminalFor(t){return t[3]>this.halfSize/2}_childIndex(t){const e=this.bounds;return(e[0]<t[0]?1:0)+(e[1]<t[1]?2:0)+(e[2]<t[2]?4:0)}static createEmptyNode(){return{children:[null,null,null,null,null,null,null,null],terminals:new e({shrink:!0}),residents:new e({shrink:!0})}}static{this._pool=new t(S)}static acquire(){return S._pool.acquire()}static release(t){S._pool.release(t)}static clearPool(){S._pool.prune()}}function j(t,e){let n=S.acquire().init(t);const o=[n];for(;0!==o.length;){if(n=o.pop(),e(n)&&!n.isLeaf())for(let t=0;t<n.node.children.length;t++){n.node.children[t]&&o.push(S.acquire().init(n).advance(t))}S.release(n)}}function x(t,e,n,o=1){let i=S.acquire().init(t);const s=[i];for(E(n,o,Y);0!==s.length;){if(i=s.pop(),e(i)&&!i.isLeaf())for(let t=7;t>=0;--t){const e=Y[t];i.node.children[e]&&s.push(S.acquire().init(i).advance(e))}S.release(i)}}function O(t,e,n){W.clear();const o=n.advanceTo(e,(t,e)=>{W.push(t.node),W.push(e)})?n.node.terminals:n.node.residents;if(o.removeUnordered(t),0===o.length)for(let i=W.length-2;i>=0;i-=2){if(!z(W.data[i],W.data[i+1]))break}}function z(t,n){return n>=0&&(t.children[n]=null),!!T(t)&&(null===t.residents&&(t.residents=new e({shrink:!0})),!0)}function M(t,e){return B(c(e.bounds),2*-e.halfSize,H),B(c(e.bounds),2*e.halfSize,J),b(t.origin,t.direction,H,J)}function N(t,e,n){return B(c(e.bounds),2*-e.halfSize,H),B(c(e.bounds),2*e.halfSize,J),n.applyToMinMax(H,J),b(t.origin,t.direction,H,J)}function T(t){if(0!==t.terminals.length)return!1;if(null!==t.residents)return 0===t.residents.length;for(let e=0;e<t.children.length;e++)if(t.children[e])return!1;return!0}function D(t,e){t[0]=Math.min(t[0],e[0]-e[3]),t[1]=Math.min(t[1],e[1]-e[3]),t[2]=Math.min(t[2],e[2]-e[3])}function A(t,e){t[0]=Math.max(t[0],e[0]+e[3]),t[1]=Math.max(t[1],e[1]+e[3]),t[2]=Math.max(t[2],e[2]+e[3])}function B(t,e,n){n[0]=t[0]+e,n[1]=t[1]+e,n[2]=t[2]+e}function v(t,e,o){H[0]=1/0,H[1]=1/0,H[2]=1/0,J[0]=-1/0,J[1]=-1/0,J[2]=-1/0;for(const n of t){const t=e(n);F(t[3])&&(D(H,t),A(J,t))}p(o,n(Z,H,J,.5)),o[3]=Math.max(J[0]-H[0],J[1]-H[1],J[2]-H[2])/2}function E(t,e,n){if(!X.length)for(let o=0;o<8;++o)X.push({index:0,distance:0});for(let o=0;o<8;++o){const n=q[o];X.data[o].index=o,X.data[o].distance=R(t,e,n)}X.sort((t,e)=>t.distance-e.distance);for(let o=0;o<8;++o)n[o]=X.data[o].index}function P(t,e){let n,o=1/0;for(let i=0;i<8;++i){const s=R(t,e,w[i]);s<o&&(o=s,n=w[i])}return n}function R(t,e,n){return e*(t[0]*n[0]+t[1]*n[1]+t[2]*n[2])}function F(t){return!isNaN(t)&&t!==-1/0&&t!==1/0&&t>0}const q=[r(-1,-1,-1),r(1,-1,-1),r(-1,1,-1),r(1,1,-1),r(-1,-1,1),r(1,-1,1),r(-1,1,1),r(1,1,1)],w=[r(-1,-1,-1),r(-1,-1,1),r(-1,1,-1),r(-1,1,1),r(1,-1,-1),r(1,-1,1),r(1,1,-1),r(1,1,1)],y=Math.sqrt(3),k=[null];function C(t){return k[0]=t,k}const I=m(),L=h(),H=h(),J=h(),W=new e,V=m(),G=m(),U=m(),K=m(),Q=[{min:0,max:0},{min:0,max:0},{min:0,max:0}],X=new e,Y=[0,0,0,0,0,0,0,0],Z=h();export{g as Octree};
|
package/views/draw/Draw.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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import e from"../../core/Accessor.js";import"../../core/has.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import r from"./MultipointDrawAction.js";import c from"./PointDrawAction.js";import s from"./PolygonDrawAction.js";import n from"./PolylineDrawAction.js";import a from"./SegmentDrawAction.js";let p=class extends e{constructor(t){super(t),this.activeAction=null,this.type="draw",this.view=null}destroy(){this.activeAction&&(this.activeAction.destroy(),this.activeAction=null)}create(t,e){this.reset();const o={view:this.view,...e};switch(t){case"point":o.editGeometryType="point",this.activeAction=new c(o);break;case"polyline":o.editGeometryType="polyline",this.activeAction=new n(o);break;case"multipoint":o.editGeometryType="polygon",this.activeAction=new r(o);break;case"polygon":o.editGeometryType="polygon",this.activeAction=new s(o);break;case"rectangle":case"circle":case"ellipse":case"triangle":o.editGeometryType="polygon",this.activeAction=new a(o)}return this.activeAction}complete(){this.activeAction
|
|
5
|
+
import{__decorate as t}from"tslib";import e from"../../core/Accessor.js";import"../../core/has.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import r from"./MultipointDrawAction.js";import c from"./PointDrawAction.js";import s from"./PolygonDrawAction.js";import n from"./PolylineDrawAction.js";import a from"./SegmentDrawAction.js";let p=class extends e{constructor(t){super(t),this.activeAction=null,this.type="draw",this.view=null}destroy(){this.activeAction&&(this.activeAction.destroy(),this.activeAction=null)}create(t,e){this.reset();const o={view:this.view,...e};switch(t){case"point":o.editGeometryType="point",this.activeAction=new c(o);break;case"polyline":o.editGeometryType="polyline",this.activeAction=new n(o);break;case"multipoint":o.editGeometryType="polygon",this.activeAction=new r(o);break;case"polygon":o.editGeometryType="polygon",this.activeAction=new s(o);break;case"rectangle":case"circle":case"ellipse":case"triangle":o.editGeometryType="polygon",this.activeAction=new a(o)}return this.activeAction}complete(){this.activeAction?.complete(),this.activeAction=null}reset(){this.activeAction?.destroy(),this.activeAction=null}};t([o()],p.prototype,"activeAction",void 0),t([o({readOnly:!0})],p.prototype,"type",void 0),t([o()],p.prototype,"view",void 0),p=t([i("esri.views.draw.Draw")],p);const l=p;export{l 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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import e from"../../../Graphic.js";import{EventedAccessor as i}from"../../../core/Evented.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{zeroMeters as o}from"../../../core/quantityUtils.js";import{when as r,watch as a,syncAndInitial as h,initial as c}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import p from"../../../geometry/Point.js";import _ from"../../../geometry/Polygon.js";import d from"../../../geometry/Polyline.js";import{create as m}from"../../../geometry/support/aaBoundingRect.js";import{getRingsOrPathsBounds as g}from"../../../geometry/support/boundsUtils.js";import{geometryToCoordinates as u}from"../../../geometry/support/coordsUtils.js";import y from"../../../geometry/support/rotate.js";import v from"../../../symbols/SimpleFillSymbol.js";import f from"../../../symbols/SimpleLineSymbol.js";import G from"../../../symbols/SimpleMarkerSymbol.js";import{cloneMove as b,scale as x,getScaleRatio as w,getRotationAngle as S}from"./drawUtils.js";import k from"./GraphicMover.js";import R from"./HighlightHelper.js";import{addUniqueLayer as C}from"./layerUtils.js";import{settings as M}from"./settings.js";import H from"../../interactive/sketch/SketchOptions.js";import{makeTooltip as I}from"../../interactive/tooltip/tooltipCommonUtils.js";import{ExtentRotateTooltipInfo as O}from"../../interactive/tooltip/infos/ExtentRotateTooltipInfo.js";import{ExtentScaleTooltipInfo as j}from"../../interactive/tooltip/infos/ExtentScaleTooltipInfo.js";import{TranslateTooltipInfo as T}from"../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{autoSize2D as L}from"../../support/extentUtils.js";const E=M.transformGraphics,z={centerIndicator:new G({style:"cross",size:E.center.size,color:E.center.color}),fill:{default:new v({color:E.fill.color,outline:{color:E.fill.outlineColor,join:"round",width:1}}),active:new v({color:E.fill.stagedColor,outline:{color:E.fill.outlineColor,join:"round",style:"dash",width:1}})},handles:{default:new G({style:"square",size:E.vertex.size,color:E.vertex.color,outline:{color:E.vertex.outlineColor,width:1}}),hover:new G({style:"square",size:E.vertex.hoverSize,color:E.vertex.hoverColor,outline:{color:E.vertex.hoverOutlineColor,width:1}})},rotator:{default:new G({style:"circle",size:E.vertex.size,color:E.vertex.color,outline:{color:E.vertex.outlineColor,width:1}}),hover:new G({style:"circle",size:E.vertex.hoverSize,color:E.vertex.hoverColor,outline:{color:E.vertex.hoverOutlineColor,width:1}})},rotatorLine:new f({color:E.line.color,width:1})},B=Symbol();let N=class extends i{constructor(t){super(t),this._activeHandleGraphic=null,this._graphicAttributes={esriSketchTool:"box"},this._mover=null,this._centerGraphic=null,this._backgroundGraphic=null,this._vertexGraphics=[],this._rotateHandleGraphic=null,this._rotateGraphicOffset=20,this._angleOfRotation=0,this._rotateLineGraphic=null,this._startInfo=null,this._totalDx=0,this._totalDy=0,this._xScale=1,this._yScale=1,this.tooltip=null,this.type="box",this.callbacks={onMoveStart(){},onMove(){},onMoveStop(){},onScaleStart(){},onScale(){},onScaleStop(){},onRotateStart(){},onRotate(){},onRotateStop(){},onGraphicClick(){}},this.enableMovement=!0,this.enableRotation=!0,this.enableScaling=!0,this.graphics=[],this.highlightName=null,this.highlightsEnabled=!0,this.layer=null,this.preserveAspectRatio=!1,this.showCenterGraphic=!0,this.symbols=z,this.sketchOptions=new H,this.view=null,this._getBounds=(()=>{const t=m();return(e,i)=>{e[0]=Number.POSITIVE_INFINITY,e[1]=Number.POSITIVE_INFINITY,e[2]=Number.NEGATIVE_INFINITY,e[3]=Number.NEGATIVE_INFINITY;for(const s of i){if(!s)continue;let i,o,r,a;if("point"===s.type)i=r=s.x,o=a=s.y;else if("multipoint"===s.type){const e=u(s);[i,o,r,a]=g(t,[e])}else if("extent"===s.type)[i,o,r,a]=[s.xmin,s.ymin,s.xmax,s.ymax];else{const e=u(s);[i,o,r,a]=g(t,e)}e[0]=Math.min(i,e[0]),e[1]=Math.min(o,e[1]),e[2]=Math.max(r,e[2]),e[3]=Math.max(a,e[3])}return e}})()}initialize(){const t=this.view;this._highlightHelper=new R({view:t}),this._setup(),this.addHandles([r(()=>t?.ready,()=>{const{layer:t,view:e}=this;C(e,t)},{once:!0,initial:!0}),a(()=>this.preserveAspectRatio,()=>{this._activeHandleGraphic&&(this._scaleGraphic(this._activeHandleGraphic),this._updateGraphics(),this._updateTooltip(this._activeHandleGraphic))}),a(()=>t?.scale,()=>{this._updateRotateGraphic(),this._updateRotateLineGraphic()}),a(()=>this.graphics,()=>this.refresh()),a(()=>this.layer,(t,e)=>{e&&this._resetGraphics(e),this.refresh()}),a(()=>[this.highlightsEnabled,this.highlightName],()=>{this._highlightHelper?.removeAll(),this._setUpHighlights()}),a(()=>this.sketchOptions.tooltips.effectiveEnabled,e=>{this.tooltip=e?I(()=>({view:t,options:this.sketchOptions.tooltips})):s(this.tooltip)},h),a(()=>this.view.effectiveTheme.accentColor,()=>this._updateSymbolsForTheme(),c),this.on("move-start",t=>this.callbacks?.onMoveStart?.(t)),this.on("move",t=>this.callbacks?.onMove?.(t)),this.on("move-stop",t=>this.callbacks?.onMoveStop?.(t)),this.on("rotate-start",t=>this.callbacks?.onRotateStart?.(t)),this.on("rotate",t=>this.callbacks?.onRotate?.(t)),this.on("rotate-stop",t=>this.callbacks?.onRotateStop?.(t)),this.on("scale-start",t=>this.callbacks?.onScaleStart?.(t)),this.on("scale",t=>this.callbacks?.onScale?.(t)),this.on("scale-stop",t=>this.callbacks?.onScaleStop?.(t))])}destroy(){this._reset(),this.tooltip=s(this.tooltip)}get state(){const t=this.view?.ready??!1,e=this.graphics.length&&this.layer;return t&&e?"active":t?"ready":"disabled"}isUIGraphic(t){return this._vertexGraphics.includes(t)||t===this._backgroundGraphic||t===this._centerGraphic||t===this._rotateHandleGraphic||t===this._rotateLineGraphic}move(t,e){if(this._mover&&this.graphics.length){for(const i of this.graphics){const s=i.geometry,o=b(s,t,e,this.view);i.geometry=o}this.refresh(),this.emit("move-stop",{graphics:this.graphics,mover:null,dx:t,dy:e,type:"move-stop"})}}scale(t,e){if(this._mover&&this.graphics.length){for(const i of this.graphics){const s=i.geometry,o=x(s,t,e);i.geometry=o}this.refresh(),this.emit("scale-stop",{graphics:this.graphics,mover:null,xScale:t,yScale:e,type:"scale-stop"})}}rotate(t,e){if(this._mover&&this.graphics.length){if(!e){const t=this._vertexGraphics[1].geometry.x,i=this._vertexGraphics[3].geometry.y;e=new p(t,i,this.view.spatialReference)}for(const i of this.graphics){const s=i.geometry,o=y(s,t,e);i.geometry=o}this.refresh(),this.emit("rotate-stop",{graphics:this.graphics,mover:null,angle:t,type:"rotate-stop"})}}refresh(){this._reset(),this._setup()}reset(){this.graphics=[]}_setup(){"active"===this.state&&(this._setUpHighlights(),this._setupGraphics(),this._setupMover(),this._updateGraphics())}_reset(){this._highlightHelper?.removeAll(),this._resetGraphicStateVars(),this._resetGraphics(),this._updateTooltip(),this._mover&&this._mover.destroy(),this._mover=null,this.removeHandles(B)}_resetGraphicStateVars(){this._startInfo=null,this._activeHandleGraphic=null,this._totalDx=0,this._totalDy=0,this._xScale=1,this._yScale=1,this._angleOfRotation=0}_resetGraphics(t){(t=t||this.layer)&&(t.removeMany(this._vertexGraphics),t.remove(this._backgroundGraphic),t.remove(this._centerGraphic),t.remove(this._rotateHandleGraphic),t.remove(this._rotateLineGraphic)),this._vertexGraphics.forEach(t=>!t.destroyed&&t.destroy()),!this._backgroundGraphic.destroyed&&this._backgroundGraphic.destroy(),!this._centerGraphic.destroyed&&this._centerGraphic.destroy(),!this._rotateHandleGraphic.destroyed&&this._rotateHandleGraphic.destroy(),!this._rotateLineGraphic.destroyed&&this._rotateLineGraphic.destroy(),this._vertexGraphics=[],this._backgroundGraphic=null,this._centerGraphic=null,this._rotateHandleGraphic=null,this._rotateLineGraphic=null}_setupMover(){let t=[];this.enableScaling&&(t=t.concat(this._vertexGraphics)),this.enableRotation&&t.push(this._rotateHandleGraphic),this.enableMovement&&(t=t.concat(this.graphics,this._backgroundGraphic)),this.showCenterGraphic&&t.push(this._centerGraphic),this._mover=new k({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,view:this.view,graphics:t,callbacks:{onGraphicClick:t=>this._onGraphicClickCallback(t),onGraphicMoveStart:t=>this._onGraphicMoveStartCallback(t),onGraphicMove:t=>this._onGraphicMoveCallback(t),onGraphicMoveStop:t=>this._onGraphicMoveStopCallback(t),onGraphicPointerOver:t=>this._onGraphicPointerOverCallback(t),onGraphicPointerOut:t=>this._onGraphicPointerOutCallback(t)}})}_setCursor(t){this.addHandles(this.view.acquireCursor(t,"high"),B)}_getStartInfo(t){const[e,i,s,o]=this._getBoxBounds(m()),r=Math.abs(s-e),a=Math.abs(o-i),h=(s+e)/2,c=(o+i)/2,{x:n,y:l}=t.geometry;return{width:r,height:a,centerX:h,centerY:c,startX:n,startY:l,graphicInfos:this._getGraphicInfos(),box:this._backgroundGraphic.geometry,rotate:this._rotateHandleGraphic.geometry}}_getGraphicInfos(){return this.graphics.map(t=>this._getGraphicInfo(t))}_getGraphicInfo(t){const e=t.geometry,[i,s,o,r]=this._getBounds(m(),[e]);return{width:Math.abs(o-i),height:Math.abs(r-s),centerX:(o+i)/2,centerY:(r+s)/2,geometry:e}}_onGraphicClickCallback(t){t.viewEvent.stopPropagation(),this.emit("graphic-click",t),this.callbacks.onGraphicClick&&this.callbacks.onGraphicClick(t)}_onGraphicMoveStartCallback(t){const{_angleOfRotation:e,_xScale:i,_yScale:s,_backgroundGraphic:o,_vertexGraphics:r,_rotateHandleGraphic:a,symbols:h,graphics:c}=this,{graphic:n,dx:l,dy:p,viewEvent:_}=t;this._resetGraphicStateVars(),this._hideGraphicsBeforeUpdate(),o.symbol=h.fill.active,this._startInfo=this._getStartInfo(n),this._updateTooltip(n,_),n===a?(this._setCursor("grabbing"),this.emit("rotate-start",{type:"rotate-start",mover:n,graphics:c,angle:e})):r.includes(n)?(this._activeHandleGraphic=n,this.emit("scale-start",{type:"scale-start",mover:n,graphics:c,xScale:i,yScale:s})):this.emit("move-start",{type:"move-start",graphics:c,mover:n,dx:l,dy:p})}_onGraphicMoveCallback(t){const e=t.graphic;if(!this._startInfo)return;const{_xScale:i,_yScale:s,_angleOfRotation:o,graphics:r}=this;if(this._vertexGraphics.includes(e))this._scaleGraphic(e),this._updateTooltip(e,t.viewEvent),this.emit("scale",{type:"scale",graphics:r,mover:e,xScale:i,yScale:s});else if(e===this._rotateHandleGraphic)this._rotateGraphic(e),this._updateTooltip(e,t.viewEvent),this.emit("rotate",{type:"rotate",graphics:r,mover:e,angle:o});else{const{dx:i,dy:s}=t;this._totalDx+=i,this._totalDy+=s,this._moveGraphic(e,i,s),this._updateTooltip(e,t.viewEvent),this.emit("move",{type:"move",graphics:r,mover:e,dx:i,dy:s})}}_onGraphicMoveStopCallback(t){const e=t.graphic;if(!this._startInfo)return void this.refresh();const{_angleOfRotation:i,_totalDx:s,_totalDy:o,_xScale:r,_yScale:a,_vertexGraphics:h,_rotateHandleGraphic:c,graphics:n}=this;this.refresh(),e===c?(this._setCursor("pointer"),this.emit("rotate-stop",{type:"rotate-stop",graphics:n,mover:e,angle:i})):h.includes(e)?this.emit("scale-stop",{type:"scale-stop",mover:e,graphics:n,xScale:r,yScale:a}):this.emit("move-stop",{type:"move-stop",graphics:n,mover:e,dx:s,dy:o})}_onGraphicPointerOverCallback(t){const{_backgroundGraphic:e,_vertexGraphics:i,graphics:s,_rotateHandleGraphic:o,symbols:r,view:a}=this,h=t.graphic;if(this._hoveredGraphic=h,h===o)return o.symbol=r.rotator.hover,this._setCursor("pointer"),void this._updateTooltip(h);if(s.includes(h)||h===e)return void this._setCursor("move");if(!i.includes(h))return void this._setCursor("pointer");this._updateTooltip(h),t.graphic.symbol=r.handles.hover;const c=a.rotation;let n,l=t.index;switch(l<8&&(c>=0&&c<45?l%=8:l=c>=45&&c<90?(l+1)%8:c>=90&&c<135?(l+2)%8:c>=135&&c<180?(l+3)%8:c>=180&&c<225?(l+4)%8:c>=225&&c<270?(l+5)%8:c>=270&&c<315?(l+6)%8:(l+7)%8),l){case 0:case 4:n="nwse-resize";break;case 1:case 5:n="ns-resize";break;case 2:case 6:n="nesw-resize";break;case 3:case 7:n="ew-resize";break;default:n="pointer"}this._setCursor(n)}_onGraphicPointerOutCallback(t){const{_vertexGraphics:e,_rotateHandleGraphic:i,symbols:s}=this;this._hoveredGraphic=null,t.graphic===i?i.symbol=s.rotator.default:e.includes(t.graphic)&&(t.graphic.symbol=s.handles.default),this.removeHandles(B),this._updateTooltip()}_scaleGraphic(t){const{_startInfo:e,_vertexGraphics:i,preserveAspectRatio:s,view:o}=this,{centerX:r,centerY:a,graphicInfos:h,height:c,startX:n,startY:l,width:_}=e,{resolution:d,transform:m}=o.state,g=i.indexOf(t);1!==g&&5!==g||this._updateX(t,r),3!==g&&7!==g||this._updateY(t,a);const{x:u,y}=t.geometry,v=m[0]*u+m[2]*y+m[4],f=m[1]*u+m[3]*y+m[5],G=h?.map(t=>t.geometry)??[],S=G.every(t=>"point"===t.type);if((0===_||0===c)&&S){const t=U((u-n)/d),i=U((l-y)/d);for(let e=0;e<G.length;e++)this.graphics[e].geometry=b(G[e],t,i,o,!0);return this._centerGraphic.geometry=new p(u,y,o.spatialReference),void(this._backgroundGraphic.geometry=b(e.box,t,i,o,!0))}if(s){const t=U(m[0]*r+m[2]*a+m[4],2),e=U(m[1]*r+m[3]*a+m[5],2),i=U(m[0]*n+m[2]*l+m[4],2),s=U(m[1]*n+m[3]*l+m[5],2);let o=w(t,e,i,s,v,f);0!==o&&Math.abs(o)!==1/0||(o=1),this._xScale=this._yScale=o;for(const h of G){const t=G.indexOf(h);this.graphics[t].geometry=x(h,this._xScale,this._yScale,[r,a])}this._updateBackgroundGraphic()}else{let t=u-n,i=l-y;if(1===g||5===g?t=0:3!==g&&7!==g||(i=0),0===t&&0===i)return;const s=r+t/2,h=a+i/2;let m=(_+(n>r?t:-1*t))/_,v=(c+(l<a?i:-1*i))/c;1!==g&&5!==g&&0!==m&&Math.abs(m)!==1/0||(m=1),3!==g&&7!==g&&0!==v&&Math.abs(v)!==1/0||(v=1),this._xScale=m,this._yScale=v;const f=(s-r)/d,w=(h-a)/d,S=x(e.box,this._xScale,this._yScale);this._backgroundGraphic.geometry=b(S,f,w,o,!0);const{centerX:k,centerY:R}=this._getGraphicInfo(this._backgroundGraphic),C=(k-r)/d,M=-1*(R-a)/d;for(const e of G){const t=G.indexOf(e),i=x(e,this._xScale,this._yScale,[r,a]);this.graphics[t].geometry=b(i,C,M,o,!0)}this._centerGraphic.geometry=new p(k,R,o.spatialReference)}}_rotateGraphic(t){const{centerX:e,centerY:i,startX:s,startY:o,box:r,rotate:a}=this._startInfo,h=this.view.spatialReference,c=new p(s,o,h),n=new p(e,i,h),l=t.geometry;this._angleOfRotation=S(c,l,n);const _=this._startInfo.graphicInfos?.map(t=>t.geometry)??[];for(const p of _){const t=_.indexOf(p),e=y(p,this._angleOfRotation,n);this.graphics[t].geometry=e}this._backgroundGraphic.geometry=y(r,this._angleOfRotation,n),this._rotateHandleGraphic.geometry=y(a,this._angleOfRotation,n)}_moveGraphic(t,e,i){if(this.graphics.includes(t)){const s=this._backgroundGraphic.geometry;this._backgroundGraphic.geometry=b(s,e,i,this.view);for(const o of this.graphics)o!==t&&(o.geometry=b(o.geometry,e,i,this.view))}else if(t===this._centerGraphic){const t=this._backgroundGraphic.geometry;this._backgroundGraphic.geometry=b(t,e,i,this.view)}if(t===this._backgroundGraphic||t===this._centerGraphic)for(const s of this.graphics)s.geometry=b(s.geometry,e,i,this.view)}_setUpHighlights(){this.highlightsEnabled&&this.graphics.length&&this._highlightHelper?.add(this.graphics,this.highlightName)}_setupGraphics(){const{_graphicAttributes:t,symbols:i}=this;this._centerGraphic=new e({symbol:i.centerIndicator,attributes:t}),this.showCenterGraphic&&this.layer.add(this._centerGraphic),this._backgroundGraphic=new e({symbol:i.fill.default,attributes:t}),this.layer.add(this._backgroundGraphic),this._rotateLineGraphic=new e({symbol:i.rotatorLine,attributes:t}),this._rotateHandleGraphic=new e({symbol:i.rotator.default,attributes:t}),this.enableRotation&&!this._hasExtentGraphic()&&this.layer.addMany([this._rotateLineGraphic,this._rotateHandleGraphic]);for(let s=0;s<8;s++)this._vertexGraphics.push(new e({symbol:i.handles.default,attributes:t}));this.enableScaling&&this.layer.addMany(this._vertexGraphics)}_updateSymbolsForTheme(){const t=this.view.effectiveTheme.accentColor;this.symbols={...this.symbols,fill:{active:this.symbols.fill.active?.clone().set("outline.color",t),default:this.symbols.fill.default?.clone().set("outline.color",t)},handles:{...this.symbols.handles,default:this.symbols.handles.default.clone().set("outline.color",t)},rotator:{...this.symbols.rotator,default:this.symbols.rotator.default.clone().set("outline.color",t)},rotatorLine:this.symbols.rotatorLine.clone().set("color",t)};for(const e of this._vertexGraphics)e.symbol=e===this._hoveredGraphic?this.symbols.handles.hover:this.symbols.handles.default;this._backgroundGraphic.symbol=this.symbols.fill.default,this._rotateHandleGraphic.symbol=this._rotateHandleGraphic===this._hoveredGraphic?this.symbols.rotator.hover:this.symbols.rotator.default,this._rotateLineGraphic.symbol=this.symbols.rotatorLine}_updateGraphics(){this._updateBackgroundGraphic(),this._updateHandleGraphics(),this._updateCenterGraphic(),this._updateRotateGraphic(),this._updateRotateLineGraphic()}_hideGraphicsBeforeUpdate(){this._centerGraphic.visible=!1,this._rotateHandleGraphic.visible=!1,this._rotateLineGraphic.visible=!1,this._vertexGraphics.forEach(t=>t.visible=!1)}_updateHandleGraphics(){const t=this._getCoordinates(!0);this._vertexGraphics.forEach((e,i)=>{const[s,o]=t[i];this._updateXY(e,s,o)})}_updateBackgroundGraphic(){const t=this._getCoordinates().map(([t,e])=>[t,e]);this._backgroundGraphic.geometry=new _({rings:[t],spatialReference:this.view.spatialReference})}_updateCenterGraphic(){const[t,e,i,s]=this._getBoxBounds(m()),o=(i+t)/2,r=(s+e)/2;this._centerGraphic.geometry=new p(o,r,this.view.spatialReference)}_updateRotateGraphic(){if(!this._vertexGraphics.length)return;const{x:t,y:e}=this._vertexGraphics[1].geometry,i=e+this.view.state.resolution*this._rotateGraphicOffset;this._rotateHandleGraphic.geometry=new p(t,i,this.view.spatialReference)}_updateRotateLineGraphic(){if(!this._vertexGraphics.length||!this._rotateHandleGraphic?.geometry)return;const t=this._vertexGraphics[1].geometry,e=this._rotateHandleGraphic.geometry;this._rotateLineGraphic.geometry=new d({paths:[[[t.x,t.y],[e.x,e.y]]],spatialReference:this.view.spatialReference})}_updateXY(t,e,i){t.geometry=new p(e,i,this.view.spatialReference)}_updateX(t,e){const i=t.geometry.y;t.geometry=new p(e,i,this.view.spatialReference)}_updateY(t,e){const i=t.geometry.x;t.geometry=new p(i,e,this.view.spatialReference)}_hasExtentGraphic(){return this.graphics.some(t=>null!=t?.geometry&&"extent"===t.geometry.type)}_getBoxBounds(t){const e=this.graphics.map(t=>t.geometry);return this._getBounds(t,e)}_getCoordinates(t){const[e,i,s,o]=this._getBoxBounds(m());if(t){const t=(e+s)/2,r=(o+i)/2;return[[e,o],[t,o],[s,o],[s,r],[s,i],[t,i],[e,i],[e,r]]}return[[e,o],[s,o],[s,i],[e,i]]}_updateTooltip(t,e){if(null==this.tooltip)return;if(!t)return void this.tooltip.clear();const{_backgroundGraphic:i,graphics:s,_vertexGraphics:o,_rotateHandleGraphic:r}=this;t===r?this._updateRotateTooltip():o.includes(t)?this._updateScaleTooltip():(s.includes(t)||t===i)&&this._updateMoveTooltip(e)}_updateRotateTooltip(){null!=this.tooltip&&(this.tooltip.info=new O({sketchOptions:this.sketchOptions,angle:-this._angleOfRotation}))}_updateScaleTooltip(){const{tooltip:t,_xScale:e,_yScale:i,sketchOptions:s,view:o,automaticLengthMeasurementUtils:r}=this;if(null==t)return;const a=this._getCoordinates(),h=L({topLeft:a[0],topRight:a[1],bottomRight:a[2],bottomLeft:a[3],spatialReference:o.spatialReference,automaticLengthMeasurementUtils:r});if(null==h)return;const{xSize:c,ySize:n}=h,l=Math.abs(e),p=Math.abs(i);t.info=new j({sketchOptions:s,xScale:l,yScale:p,xSize:c,ySize:n})}_updateMoveTooltip(t){const{tooltip:e,sketchOptions:i,view:s,automaticLengthMeasurementUtils:r}=this;if(null==e)return;const a=new T({sketchOptions:i});if(t){const{x:e,y:i}=t.origin,h=s.toMap(t),c=s.toMap({x:e,y:i}),n=r.autoDistanceBetweenPoints2D(c,h);a.distance=null!=n?n:o}e.info=a}};function U(t,e=2){return Number.parseFloat(t.toFixed(e))}t([n()],N.prototype,"tooltip",void 0),t([n({readOnly:!0})],N.prototype,"type",void 0),t([n()],N.prototype,"callbacks",void 0),t([n()],N.prototype,"enableMovement",void 0),t([n()],N.prototype,"enableRotation",void 0),t([n()],N.prototype,"enableScaling",void 0),t([n()],N.prototype,"graphics",void 0),t([n()],N.prototype,"highlightName",void 0),t([n()],N.prototype,"highlightsEnabled",void 0),t([n()],N.prototype,"layer",void 0),t([n()],N.prototype,"preserveAspectRatio",void 0),t([n()],N.prototype,"showCenterGraphic",void 0),t([n({readOnly:!0})],N.prototype,"state",null),t([n()],N.prototype,"symbols",void 0),t([n({type:H})],N.prototype,"sketchOptions",void 0),t([n({constructOnly:!0})],N.prototype,"view",void 0),t([n({constructOnly:!0})],N.prototype,"automaticLengthMeasurementUtils",void 0),N=t([l("esri.views.draw.support.Box")],N);const Y=N;export{Y as default};
|
|
5
|
+
import{__decorate as t}from"tslib";import e from"../../../Graphic.js";import{EventedAccessor as i}from"../../../core/Evented.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{zeroMeters as o}from"../../../core/quantityUtils.js";import{when as r,watch as a,syncAndInitial as h,initial as c}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import p from"../../../geometry/Point.js";import _ from"../../../geometry/Polygon.js";import d from"../../../geometry/Polyline.js";import{create as m}from"../../../geometry/support/aaBoundingRect.js";import{getRingsOrPathsBounds as g}from"../../../geometry/support/boundsUtils.js";import{geometryToCoordinates as u}from"../../../geometry/support/coordsUtils.js";import y from"../../../geometry/support/rotate.js";import v from"../../../symbols/SimpleFillSymbol.js";import f from"../../../symbols/SimpleLineSymbol.js";import G from"../../../symbols/SimpleMarkerSymbol.js";import{cloneMove as b,scale as x,getScaleRatio as w,getRotationAngle as S}from"./drawUtils.js";import k from"./GraphicMover.js";import R from"./HighlightHelper.js";import{addUniqueLayer as C}from"./layerUtils.js";import{settings as M}from"./settings.js";import H from"../../interactive/sketch/SketchOptions.js";import{makeTooltip as I}from"../../interactive/tooltip/tooltipCommonUtils.js";import{ExtentRotateTooltipInfo as O}from"../../interactive/tooltip/infos/ExtentRotateTooltipInfo.js";import{ExtentScaleTooltipInfo as j}from"../../interactive/tooltip/infos/ExtentScaleTooltipInfo.js";import{TranslateTooltipInfo as T}from"../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{autoSize2D as L}from"../../support/extentUtils.js";const E=M.transformGraphics,z={centerIndicator:new G({style:"cross",size:E.center.size,color:E.center.color}),fill:{default:new v({color:E.fill.color,outline:{color:E.fill.outlineColor,join:"round",width:1}}),active:new v({color:E.fill.stagedColor,outline:{color:E.fill.outlineColor,join:"round",style:"dash",width:1}})},handles:{default:new G({style:"square",size:E.vertex.size,color:E.vertex.color,outline:{color:E.vertex.outlineColor,width:1}}),hover:new G({style:"square",size:E.vertex.hoverSize,color:E.vertex.hoverColor,outline:{color:E.vertex.hoverOutlineColor,width:1}})},rotator:{default:new G({style:"circle",size:E.vertex.size,color:E.vertex.color,outline:{color:E.vertex.outlineColor,width:1}}),hover:new G({style:"circle",size:E.vertex.hoverSize,color:E.vertex.hoverColor,outline:{color:E.vertex.hoverOutlineColor,width:1}})},rotatorLine:new f({color:E.line.color,width:1})},B=Symbol();let N=class extends i{constructor(t){super(t),this._activeHandleGraphic=null,this._graphicAttributes={esriSketchTool:"box"},this._mover=null,this._centerGraphic=null,this._backgroundGraphic=null,this._vertexGraphics=[],this._rotateHandleGraphic=null,this._rotateGraphicOffset=20,this._angleOfRotation=0,this._rotateLineGraphic=null,this._startInfo=null,this._totalDx=0,this._totalDy=0,this._xScale=1,this._yScale=1,this.tooltip=null,this.type="box",this.callbacks={onMoveStart(){},onMove(){},onMoveStop(){},onScaleStart(){},onScale(){},onScaleStop(){},onRotateStart(){},onRotate(){},onRotateStop(){},onGraphicClick(){}},this.enableMovement=!0,this.enableRotation=!0,this.enableScaling=!0,this.graphics=[],this.highlightName=null,this.highlightsEnabled=!0,this.layer=null,this.preserveAspectRatio=!1,this.showCenterGraphic=!0,this.symbols=z,this.sketchOptions=new H,this.view=null,this._getBounds=(()=>{const t=m();return(e,i)=>{e[0]=Number.POSITIVE_INFINITY,e[1]=Number.POSITIVE_INFINITY,e[2]=Number.NEGATIVE_INFINITY,e[3]=Number.NEGATIVE_INFINITY;for(const s of i){if(!s)continue;let i,o,r,a;if("point"===s.type)i=r=s.x,o=a=s.y;else if("multipoint"===s.type){const e=u(s);[i,o,r,a]=g(t,[e])}else if("extent"===s.type)[i,o,r,a]=[s.xmin,s.ymin,s.xmax,s.ymax];else{const e=u(s);[i,o,r,a]=g(t,e)}e[0]=Math.min(i,e[0]),e[1]=Math.min(o,e[1]),e[2]=Math.max(r,e[2]),e[3]=Math.max(a,e[3])}return e}})()}initialize(){const t=this.view;this._highlightHelper=new R({view:t}),this._setup(),this.addHandles([r(()=>t?.ready,()=>{const{layer:t,view:e}=this;C(e,t)},{once:!0,initial:!0}),a(()=>this.preserveAspectRatio,()=>{this._activeHandleGraphic&&(this._scaleGraphic(this._activeHandleGraphic),this._updateGraphics(),this._updateTooltip(this._activeHandleGraphic))}),a(()=>t?.scale,()=>{this._updateRotateGraphic(),this._updateRotateLineGraphic()}),a(()=>this.graphics,()=>this.refresh()),a(()=>this.layer,(t,e)=>{e&&this._resetGraphics(e),this.refresh()}),a(()=>[this.highlightsEnabled,this.highlightName],()=>{this._highlightHelper?.removeAll(),this._setUpHighlights()}),a(()=>this.sketchOptions.tooltips.effectiveEnabled,e=>{this.tooltip=e?I(()=>({view:t,options:this.sketchOptions.tooltips})):s(this.tooltip)},h),a(()=>this.view.effectiveTheme.accentColor,()=>this._updateSymbolsForTheme(),c),this.on("move-start",t=>this.callbacks?.onMoveStart?.(t)),this.on("move",t=>this.callbacks?.onMove?.(t)),this.on("move-stop",t=>this.callbacks?.onMoveStop?.(t)),this.on("rotate-start",t=>this.callbacks?.onRotateStart?.(t)),this.on("rotate",t=>this.callbacks?.onRotate?.(t)),this.on("rotate-stop",t=>this.callbacks?.onRotateStop?.(t)),this.on("scale-start",t=>this.callbacks?.onScaleStart?.(t)),this.on("scale",t=>this.callbacks?.onScale?.(t)),this.on("scale-stop",t=>this.callbacks?.onScaleStop?.(t))])}destroy(){this._reset(),this.tooltip=s(this.tooltip)}get state(){const t=this.view?.ready??!1,e=this.graphics.length&&this.layer;return t&&e?"active":t?"ready":"disabled"}isUIGraphic(t){return this._vertexGraphics.includes(t)||t===this._backgroundGraphic||t===this._centerGraphic||t===this._rotateHandleGraphic||t===this._rotateLineGraphic}move(t,e){if(this._mover&&this.graphics.length){for(const i of this.graphics){const s=i.geometry,o=b(s,t,e,this.view);i.geometry=o}this.refresh(),this.emit("move-stop",{graphics:this.graphics,mover:null,dx:t,dy:e,type:"move-stop"})}}scale(t,e){if(this._mover&&this.graphics.length){for(const i of this.graphics){const s=i.geometry,o=x(s,t,e);i.geometry=o}this.refresh(),this.emit("scale-stop",{graphics:this.graphics,mover:null,xScale:t,yScale:e,type:"scale-stop"})}}rotate(t,e){if(this._mover&&this.graphics.length){if(!e){const t=this._vertexGraphics[1].geometry.x,i=this._vertexGraphics[3].geometry.y;e=new p(t,i,this.view.spatialReference)}for(const i of this.graphics){const s=i.geometry,o=y(s,t,e);i.geometry=o}this.refresh(),this.emit("rotate-stop",{graphics:this.graphics,mover:null,angle:t,type:"rotate-stop"})}}refresh(){this._reset(),this._setup()}reset(){this.graphics=[]}_setup(){"active"===this.state&&(this._setUpHighlights(),this._setupGraphics(),this._setupMover(),this._updateGraphics())}_reset(){this._highlightHelper?.removeAll(),this._resetGraphicStateVars(),this._resetGraphics(),this._updateTooltip(),this._mover?.destroy(),this._mover=null,this.removeHandles(B)}_resetGraphicStateVars(){this._startInfo=null,this._activeHandleGraphic=null,this._totalDx=0,this._totalDy=0,this._xScale=1,this._yScale=1,this._angleOfRotation=0}_resetGraphics(t){(t=t||this.layer)&&(t.removeMany(this._vertexGraphics),t.remove(this._backgroundGraphic),t.remove(this._centerGraphic),t.remove(this._rotateHandleGraphic),t.remove(this._rotateLineGraphic)),this._vertexGraphics.forEach(t=>!t.destroyed&&t.destroy()),!this._backgroundGraphic.destroyed&&this._backgroundGraphic.destroy(),!this._centerGraphic.destroyed&&this._centerGraphic.destroy(),!this._rotateHandleGraphic.destroyed&&this._rotateHandleGraphic.destroy(),!this._rotateLineGraphic.destroyed&&this._rotateLineGraphic.destroy(),this._vertexGraphics=[],this._backgroundGraphic=null,this._centerGraphic=null,this._rotateHandleGraphic=null,this._rotateLineGraphic=null}_setupMover(){let t=[];this.enableScaling&&(t=t.concat(this._vertexGraphics)),this.enableRotation&&t.push(this._rotateHandleGraphic),this.enableMovement&&(t=t.concat(this.graphics,this._backgroundGraphic)),this.showCenterGraphic&&t.push(this._centerGraphic),this._mover=new k({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,view:this.view,graphics:t,callbacks:{onGraphicClick:t=>this._onGraphicClickCallback(t),onGraphicMoveStart:t=>this._onGraphicMoveStartCallback(t),onGraphicMove:t=>this._onGraphicMoveCallback(t),onGraphicMoveStop:t=>this._onGraphicMoveStopCallback(t),onGraphicPointerOver:t=>this._onGraphicPointerOverCallback(t),onGraphicPointerOut:t=>this._onGraphicPointerOutCallback(t)}})}_setCursor(t){this.addHandles(this.view.acquireCursor(t,"high"),B)}_getStartInfo(t){const[e,i,s,o]=this._getBoxBounds(m()),r=Math.abs(s-e),a=Math.abs(o-i),h=(s+e)/2,c=(o+i)/2,{x:n,y:l}=t.geometry;return{width:r,height:a,centerX:h,centerY:c,startX:n,startY:l,graphicInfos:this._getGraphicInfos(),box:this._backgroundGraphic.geometry,rotate:this._rotateHandleGraphic.geometry}}_getGraphicInfos(){return this.graphics.map(t=>this._getGraphicInfo(t))}_getGraphicInfo(t){const e=t.geometry,[i,s,o,r]=this._getBounds(m(),[e]);return{width:Math.abs(o-i),height:Math.abs(r-s),centerX:(o+i)/2,centerY:(r+s)/2,geometry:e}}_onGraphicClickCallback(t){t.viewEvent.stopPropagation(),this.emit("graphic-click",t),this.callbacks.onGraphicClick&&this.callbacks.onGraphicClick(t)}_onGraphicMoveStartCallback(t){const{_angleOfRotation:e,_xScale:i,_yScale:s,_backgroundGraphic:o,_vertexGraphics:r,_rotateHandleGraphic:a,symbols:h,graphics:c}=this,{graphic:n,dx:l,dy:p,viewEvent:_}=t;this._resetGraphicStateVars(),this._hideGraphicsBeforeUpdate(),o.symbol=h.fill.active,this._startInfo=this._getStartInfo(n),this._updateTooltip(n,_),n===a?(this._setCursor("grabbing"),this.emit("rotate-start",{type:"rotate-start",mover:n,graphics:c,angle:e})):r.includes(n)?(this._activeHandleGraphic=n,this.emit("scale-start",{type:"scale-start",mover:n,graphics:c,xScale:i,yScale:s})):this.emit("move-start",{type:"move-start",graphics:c,mover:n,dx:l,dy:p})}_onGraphicMoveCallback(t){const e=t.graphic;if(!this._startInfo)return;const{_xScale:i,_yScale:s,_angleOfRotation:o,graphics:r}=this;if(this._vertexGraphics.includes(e))this._scaleGraphic(e),this._updateTooltip(e,t.viewEvent),this.emit("scale",{type:"scale",graphics:r,mover:e,xScale:i,yScale:s});else if(e===this._rotateHandleGraphic)this._rotateGraphic(e),this._updateTooltip(e,t.viewEvent),this.emit("rotate",{type:"rotate",graphics:r,mover:e,angle:o});else{const{dx:i,dy:s}=t;this._totalDx+=i,this._totalDy+=s,this._moveGraphic(e,i,s),this._updateTooltip(e,t.viewEvent),this.emit("move",{type:"move",graphics:r,mover:e,dx:i,dy:s})}}_onGraphicMoveStopCallback(t){const e=t.graphic;if(!this._startInfo)return void this.refresh();const{_angleOfRotation:i,_totalDx:s,_totalDy:o,_xScale:r,_yScale:a,_vertexGraphics:h,_rotateHandleGraphic:c,graphics:n}=this;this.refresh(),e===c?(this._setCursor("pointer"),this.emit("rotate-stop",{type:"rotate-stop",graphics:n,mover:e,angle:i})):h.includes(e)?this.emit("scale-stop",{type:"scale-stop",mover:e,graphics:n,xScale:r,yScale:a}):this.emit("move-stop",{type:"move-stop",graphics:n,mover:e,dx:s,dy:o})}_onGraphicPointerOverCallback(t){const{_backgroundGraphic:e,_vertexGraphics:i,graphics:s,_rotateHandleGraphic:o,symbols:r,view:a}=this,h=t.graphic;if(this._hoveredGraphic=h,h===o)return o.symbol=r.rotator.hover,this._setCursor("pointer"),void this._updateTooltip(h);if(s.includes(h)||h===e)return void this._setCursor("move");if(!i.includes(h))return void this._setCursor("pointer");this._updateTooltip(h),t.graphic.symbol=r.handles.hover;const c=a.rotation;let n,l=t.index;switch(l<8&&(c>=0&&c<45?l%=8:l=c>=45&&c<90?(l+1)%8:c>=90&&c<135?(l+2)%8:c>=135&&c<180?(l+3)%8:c>=180&&c<225?(l+4)%8:c>=225&&c<270?(l+5)%8:c>=270&&c<315?(l+6)%8:(l+7)%8),l){case 0:case 4:n="nwse-resize";break;case 1:case 5:n="ns-resize";break;case 2:case 6:n="nesw-resize";break;case 3:case 7:n="ew-resize";break;default:n="pointer"}this._setCursor(n)}_onGraphicPointerOutCallback(t){const{_vertexGraphics:e,_rotateHandleGraphic:i,symbols:s}=this;this._hoveredGraphic=null,t.graphic===i?i.symbol=s.rotator.default:e.includes(t.graphic)&&(t.graphic.symbol=s.handles.default),this.removeHandles(B),this._updateTooltip()}_scaleGraphic(t){const{_startInfo:e,_vertexGraphics:i,preserveAspectRatio:s,view:o}=this,{centerX:r,centerY:a,graphicInfos:h,height:c,startX:n,startY:l,width:_}=e,{resolution:d,transform:m}=o.state,g=i.indexOf(t);1!==g&&5!==g||this._updateX(t,r),3!==g&&7!==g||this._updateY(t,a);const{x:u,y}=t.geometry,v=m[0]*u+m[2]*y+m[4],f=m[1]*u+m[3]*y+m[5],G=h?.map(t=>t.geometry)??[],S=G.every(t=>"point"===t.type);if((0===_||0===c)&&S){const t=U((u-n)/d),i=U((l-y)/d);for(let e=0;e<G.length;e++)this.graphics[e].geometry=b(G[e],t,i,o,!0);return this._centerGraphic.geometry=new p(u,y,o.spatialReference),void(this._backgroundGraphic.geometry=b(e.box,t,i,o,!0))}if(s){const t=U(m[0]*r+m[2]*a+m[4],2),e=U(m[1]*r+m[3]*a+m[5],2),i=U(m[0]*n+m[2]*l+m[4],2),s=U(m[1]*n+m[3]*l+m[5],2);let o=w(t,e,i,s,v,f);0!==o&&Math.abs(o)!==1/0||(o=1),this._xScale=this._yScale=o;for(const h of G){const t=G.indexOf(h);this.graphics[t].geometry=x(h,this._xScale,this._yScale,[r,a])}this._updateBackgroundGraphic()}else{let t=u-n,i=l-y;if(1===g||5===g?t=0:3!==g&&7!==g||(i=0),0===t&&0===i)return;const s=r+t/2,h=a+i/2;let m=(_+(n>r?t:-1*t))/_,v=(c+(l<a?i:-1*i))/c;1!==g&&5!==g&&0!==m&&Math.abs(m)!==1/0||(m=1),3!==g&&7!==g&&0!==v&&Math.abs(v)!==1/0||(v=1),this._xScale=m,this._yScale=v;const f=(s-r)/d,w=(h-a)/d,S=x(e.box,this._xScale,this._yScale);this._backgroundGraphic.geometry=b(S,f,w,o,!0);const{centerX:k,centerY:R}=this._getGraphicInfo(this._backgroundGraphic),C=(k-r)/d,M=-1*(R-a)/d;for(const e of G){const t=G.indexOf(e),i=x(e,this._xScale,this._yScale,[r,a]);this.graphics[t].geometry=b(i,C,M,o,!0)}this._centerGraphic.geometry=new p(k,R,o.spatialReference)}}_rotateGraphic(t){const{centerX:e,centerY:i,startX:s,startY:o,box:r,rotate:a}=this._startInfo,h=this.view.spatialReference,c=new p(s,o,h),n=new p(e,i,h),l=t.geometry;this._angleOfRotation=S(c,l,n);const _=this._startInfo.graphicInfos?.map(t=>t.geometry)??[];for(const p of _){const t=_.indexOf(p),e=y(p,this._angleOfRotation,n);this.graphics[t].geometry=e}this._backgroundGraphic.geometry=y(r,this._angleOfRotation,n),this._rotateHandleGraphic.geometry=y(a,this._angleOfRotation,n)}_moveGraphic(t,e,i){if(this.graphics.includes(t)){const s=this._backgroundGraphic.geometry;this._backgroundGraphic.geometry=b(s,e,i,this.view);for(const o of this.graphics)o!==t&&(o.geometry=b(o.geometry,e,i,this.view))}else if(t===this._centerGraphic){const t=this._backgroundGraphic.geometry;this._backgroundGraphic.geometry=b(t,e,i,this.view)}if(t===this._backgroundGraphic||t===this._centerGraphic)for(const s of this.graphics)s.geometry=b(s.geometry,e,i,this.view)}_setUpHighlights(){this.highlightsEnabled&&this.graphics.length&&this._highlightHelper?.add(this.graphics,this.highlightName)}_setupGraphics(){const{_graphicAttributes:t,symbols:i}=this;this._centerGraphic=new e({symbol:i.centerIndicator,attributes:t}),this.showCenterGraphic&&this.layer.add(this._centerGraphic),this._backgroundGraphic=new e({symbol:i.fill.default,attributes:t}),this.layer.add(this._backgroundGraphic),this._rotateLineGraphic=new e({symbol:i.rotatorLine,attributes:t}),this._rotateHandleGraphic=new e({symbol:i.rotator.default,attributes:t}),this.enableRotation&&!this._hasExtentGraphic()&&this.layer.addMany([this._rotateLineGraphic,this._rotateHandleGraphic]);for(let s=0;s<8;s++)this._vertexGraphics.push(new e({symbol:i.handles.default,attributes:t}));this.enableScaling&&this.layer.addMany(this._vertexGraphics)}_updateSymbolsForTheme(){const t=this.view.effectiveTheme.accentColor;this.symbols={...this.symbols,fill:{active:this.symbols.fill.active?.clone().set("outline.color",t),default:this.symbols.fill.default?.clone().set("outline.color",t)},handles:{...this.symbols.handles,default:this.symbols.handles.default.clone().set("outline.color",t)},rotator:{...this.symbols.rotator,default:this.symbols.rotator.default.clone().set("outline.color",t)},rotatorLine:this.symbols.rotatorLine.clone().set("color",t)};for(const e of this._vertexGraphics)e.symbol=e===this._hoveredGraphic?this.symbols.handles.hover:this.symbols.handles.default;this._backgroundGraphic.symbol=this.symbols.fill.default,this._rotateHandleGraphic.symbol=this._rotateHandleGraphic===this._hoveredGraphic?this.symbols.rotator.hover:this.symbols.rotator.default,this._rotateLineGraphic.symbol=this.symbols.rotatorLine}_updateGraphics(){this._updateBackgroundGraphic(),this._updateHandleGraphics(),this._updateCenterGraphic(),this._updateRotateGraphic(),this._updateRotateLineGraphic()}_hideGraphicsBeforeUpdate(){this._centerGraphic.visible=!1,this._rotateHandleGraphic.visible=!1,this._rotateLineGraphic.visible=!1,this._vertexGraphics.forEach(t=>t.visible=!1)}_updateHandleGraphics(){const t=this._getCoordinates(!0);this._vertexGraphics.forEach((e,i)=>{const[s,o]=t[i];this._updateXY(e,s,o)})}_updateBackgroundGraphic(){const t=this._getCoordinates().map(([t,e])=>[t,e]);this._backgroundGraphic.geometry=new _({rings:[t],spatialReference:this.view.spatialReference})}_updateCenterGraphic(){const[t,e,i,s]=this._getBoxBounds(m()),o=(i+t)/2,r=(s+e)/2;this._centerGraphic.geometry=new p(o,r,this.view.spatialReference)}_updateRotateGraphic(){if(!this._vertexGraphics.length)return;const{x:t,y:e}=this._vertexGraphics[1].geometry,i=e+this.view.state.resolution*this._rotateGraphicOffset;this._rotateHandleGraphic.geometry=new p(t,i,this.view.spatialReference)}_updateRotateLineGraphic(){if(!this._vertexGraphics.length||!this._rotateHandleGraphic?.geometry)return;const t=this._vertexGraphics[1].geometry,e=this._rotateHandleGraphic.geometry;this._rotateLineGraphic.geometry=new d({paths:[[[t.x,t.y],[e.x,e.y]]],spatialReference:this.view.spatialReference})}_updateXY(t,e,i){t.geometry=new p(e,i,this.view.spatialReference)}_updateX(t,e){const i=t.geometry.y;t.geometry=new p(e,i,this.view.spatialReference)}_updateY(t,e){const i=t.geometry.x;t.geometry=new p(i,e,this.view.spatialReference)}_hasExtentGraphic(){return this.graphics.some(t=>null!=t?.geometry&&"extent"===t.geometry.type)}_getBoxBounds(t){const e=this.graphics.map(t=>t.geometry);return this._getBounds(t,e)}_getCoordinates(t){const[e,i,s,o]=this._getBoxBounds(m());if(t){const t=(e+s)/2,r=(o+i)/2;return[[e,o],[t,o],[s,o],[s,r],[s,i],[t,i],[e,i],[e,r]]}return[[e,o],[s,o],[s,i],[e,i]]}_updateTooltip(t,e){if(null==this.tooltip)return;if(!t)return void this.tooltip.clear();const{_backgroundGraphic:i,graphics:s,_vertexGraphics:o,_rotateHandleGraphic:r}=this;t===r?this._updateRotateTooltip():o.includes(t)?this._updateScaleTooltip():(s.includes(t)||t===i)&&this._updateMoveTooltip(e)}_updateRotateTooltip(){null!=this.tooltip&&(this.tooltip.info=new O({sketchOptions:this.sketchOptions,angle:-this._angleOfRotation}))}_updateScaleTooltip(){const{tooltip:t,_xScale:e,_yScale:i,sketchOptions:s,view:o,automaticLengthMeasurementUtils:r}=this;if(null==t)return;const a=this._getCoordinates(),h=L({topLeft:a[0],topRight:a[1],bottomRight:a[2],bottomLeft:a[3],spatialReference:o.spatialReference,automaticLengthMeasurementUtils:r});if(null==h)return;const{xSize:c,ySize:n}=h,l=Math.abs(e),p=Math.abs(i);t.info=new j({sketchOptions:s,xScale:l,yScale:p,xSize:c,ySize:n})}_updateMoveTooltip(t){const{tooltip:e,sketchOptions:i,view:s,automaticLengthMeasurementUtils:r}=this;if(null==e)return;const a=new T({sketchOptions:i});if(t){const{x:e,y:i}=t.origin,h=s.toMap(t),c=s.toMap({x:e,y:i}),n=r.autoDistanceBetweenPoints2D(c,h);a.distance=null!=n?n:o}e.info=a}};function U(t,e=2){return Number.parseFloat(t.toFixed(e))}t([n()],N.prototype,"tooltip",void 0),t([n({readOnly:!0})],N.prototype,"type",void 0),t([n()],N.prototype,"callbacks",void 0),t([n()],N.prototype,"enableMovement",void 0),t([n()],N.prototype,"enableRotation",void 0),t([n()],N.prototype,"enableScaling",void 0),t([n()],N.prototype,"graphics",void 0),t([n()],N.prototype,"highlightName",void 0),t([n()],N.prototype,"highlightsEnabled",void 0),t([n()],N.prototype,"layer",void 0),t([n()],N.prototype,"preserveAspectRatio",void 0),t([n()],N.prototype,"showCenterGraphic",void 0),t([n({readOnly:!0})],N.prototype,"state",null),t([n()],N.prototype,"symbols",void 0),t([n({type:H})],N.prototype,"sketchOptions",void 0),t([n({constructOnly:!0})],N.prototype,"view",void 0),t([n({constructOnly:!0})],N.prototype,"automaticLengthMeasurementUtils",void 0),N=t([l("esri.views.draw.support.Box")],N);const Y=N;export{Y 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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as i}from"tslib";import{EventedAccessor as t}from"../../../core/Evented.js";import{clone as e}from"../../../core/lang.js";import{watch as s,when as r}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import{subclass as
|
|
5
|
+
import{__decorate as i}from"tslib";import{EventedAccessor as t}from"../../../core/Evented.js";import{clone as e}from"../../../core/lang.js";import{watch as s,when as r}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import a from"../../../layers/GraphicsLayer.js";import n from"../../../symbols/SimpleFillSymbol.js";import c from"../../../symbols/SimpleLineSymbol.js";import l from"../../../symbols/SimpleMarkerSymbol.js";import{cloneMove as p}from"./drawUtils.js";import d from"./HighlightHelper.js";import{addUniqueLayer as g,findLayerView as m}from"./layerUtils.js";import{GraphicClickEvent as v,GraphicDoubleClickEvent as _,GraphicPointerDownEvent as y,GraphicPointerUpEvent as f,GraphicPointerOutEvent as u,GraphicPointerOverEvent as w,GraphicMoveStartEvent as G,GraphicMoveEvent as b,GraphicMoveStopEvent as k}from"./input/GraphicMoverEvents.js";import{ViewEventPriorities as O}from"../../input/InputManager.js";import{GraphicManipulator as x}from"../../interactive/GraphicManipulator.js";import{createScreenPointFromEvent as H}from"../../support/screenUtils.js";const M="indicator-symbols";let E=class extends t{constructor(i){super(i),this._activeGraphic=null,this._dragEvent=null,this._hoverGraphic=null,this._indicators=[],this._initialDragGeometry=null,this._manipulators=[],this._layerViews=null,this.type="graphic-mover",this.callbacks={onGraphicClick(){},onGraphicDoubleClick(){},onGraphicMoveStart(){},onGraphicMove(){},onGraphicMoveStop(){},onGraphicPointerOver(){},onGraphicPointerOut(){},onGraphicPointerDown(){},onGraphicPointerUp(){}},this.enableMoveAllGraphics=!1,this.graphics=[],this.highlightName=null,this.highlightsEnabled=!1,this.indicatorsEnabled=!1,this._defaultLayer=new a({listMode:"hide",internal:!0,title:"GraphicMover highlight layer"}),this.layer=this._defaultLayer,this.view=null}initialize(){g(this.view,this.layer),this._highlightHelper=new d({view:this.view}),this.refresh(),this.addHandles([s(()=>this.graphics.length,()=>this.refresh()),r(()=>this.view?.ready,()=>{this.addHandles([this.view.on("immediate-click",i=>this._clickHandler(i),O.TOOL),this.view.on("double-click",i=>this._doubleClickHandler(i),O.TOOL),this.view.on("pointer-down",i=>this._pointerDownHandler(i),O.TOOL),this.view.on("pointer-move",i=>this._pointerMoveHandler(i),O.TOOL),this.view.on("pointer-up",i=>this._pointerUpHandler(i),O.TOOL),this.view.on("drag",i=>this._dragHandler(i),O.TOOL),this.view.on("key-down",i=>this._keyDownHandler(i),O.TOOL)])},{once:!0,initial:!0}),s(()=>this.view,i=>{this._highlightHelper.removeAll(),this._highlightHelper.view=i}),s(()=>[this.highlightsEnabled,this.highlightName],()=>{this._highlightHelper?.removeAll(),this._setUpHighlights()})])}destroy(){this._removeIndicators(),this.view.map?.remove(this.layer),this._defaultLayer.destroy(),this.reset(),this._manipulators.forEach(i=>i.destroy()),this._manipulators=null}get state(){const i=this.view.ready,t=this.graphics.length>0,e=this._activeGraphic;return i&&t?e?"moving":"active":i?"ready":"disabled"}refresh(){this.reset(),this._setup()}reset(){this._activeGraphic=null,this._hoverGraphic=null,this._dragEvent=null,this._highlightHelper.removeAll()}updateGeometry(i,t){const e=this.graphics[i];e&&(e.set("geometry",t),this._setUpIndicators())}_setup(){this._setUpHighlights(),this._setUpIndicators(),this._setUpManipulators(),this._syncLayerViews()}_clickHandler(i){const t=this._findTargetGraphic(H(i));if(t){const e=new v(t,this.graphics.indexOf(t),i.x,i.y,i);this.emit("graphic-click",e),this.callbacks.onGraphicClick?.(e)}}_doubleClickHandler(i){const t=this._findTargetGraphic(H(i));if(t){const e=new _(t,this.graphics.indexOf(t),i.x,i.y,i);this.emit("graphic-double-click",e),this.callbacks.onGraphicDoubleClick?.(e)}}_pointerDownHandler(i){const t=this._findTargetGraphic(H(i));if(t){this._activeGraphic=t;const{x:e,y:s}=i,r=new y(t,this.graphics.indexOf(t),e,s,i);this.emit("graphic-pointer-down",r),this.callbacks.onGraphicPointerDown?.(r)}else this._activeGraphic=null}_pointerUpHandler(i){if(this._activeGraphic){const{x:t,y:e}=i,s=this.graphics.indexOf(this._activeGraphic),r=new f(this._activeGraphic,s,t,e,i);this.emit("graphic-pointer-up",r),this.callbacks.onGraphicPointerUp?.(r)}}_pointerMoveHandler(i){if(this._dragEvent)return;const t=this._findTargetGraphic(H(i));if(t){const{x:e,y:s}=i;if(this._hoverGraphic){if(this._hoverGraphic===t)return;const r=this.graphics.indexOf(this._hoverGraphic),h=new u(this.graphics[r],r,e,s,i);this._hoverGraphic=null,this.emit("graphic-pointer-out",h),this.callbacks.onGraphicPointerOut?.(h)}const r=this.graphics.indexOf(t),h=new w(t,r,e,s,i);return this._hoverGraphic=t,this.emit("graphic-pointer-over",h),void this.callbacks.onGraphicPointerOver?.(h)}if(this._hoverGraphic){const{x:t,y:e}=i,s=this.graphics.indexOf(this._hoverGraphic),r=new u(this.graphics[s],s,t,e,i);this._hoverGraphic=null,this.emit("graphic-pointer-out",r),this.callbacks.onGraphicPointerOut?.(r)}}_dragHandler(i){if("start"!==i.action&&!this._dragEvent||!this._activeGraphic?.geometry)return;"start"===i.action&&this._removeIndicators(),i.stopPropagation();const{action:t,x:s,y:r}=i,h=this.graphics.indexOf(this._activeGraphic),o=this._dragEvent?s-this._dragEvent.x:0,a=this._dragEvent?r-this._dragEvent.y:0,n=s-i.origin.x,c=r-i.origin.y,l="start"===t?this._activeGraphic.geometry:this._initialDragGeometry,d=p(l,n,c,this.view);if(this._activeGraphic.geometry=d,this.enableMoveAllGraphics&&this.graphics.forEach(i=>{i!==this._activeGraphic&&(i.geometry=p(i.geometry,o,a,this.view))}),this._dragEvent=i,"start"===t){this._initialDragGeometry=e(l);const t=new G(this._activeGraphic,this.graphics,h,s,r,o,a,n,c,i);this.emit("graphic-move-start",t),this.callbacks.onGraphicMoveStart?.(t),t.defaultPrevented&&this._activeGraphic.set("geometry",l)}else if("update"===t){const t=new b(this._activeGraphic,this.graphics,h,s,r,o,a,n,c,i);this.emit("graphic-move",t),this.callbacks.onGraphicMove?.(t),t.defaultPrevented&&(this._activeGraphic.geometry=l)}else{const t=new k(this._activeGraphic,this.graphics,h,s,r,o,a,n,c,i);this._dragEvent=null,this._activeGraphic=null,this._setUpIndicators(),this.emit("graphic-move-stop",t),this.callbacks.onGraphicMoveStop?.(t),t.defaultPrevented&&(this.graphics[h].set("geometry",this._initialDragGeometry),this._setUpIndicators()),this._initialDragGeometry=null}}_keyDownHandler(i){"a"!==i.key&&"d"!==i.key&&"n"!==i.key||"moving"!==this.state||i.stopPropagation()}_findTargetGraphic(i){const t=this.view.toMap(i),e=this.graphics;let s=null,r=Number.MAX_VALUE;this._syncLayerViews();const h=this._layerViews.flatMap(i=>"graphicsViews"in i?Array.from(i.graphicsViews(),i=>i.hitTest(t)).flat():i.graphicsView.hitTest(t)).filter(i=>e.includes(i)).sort((i,t)=>e.indexOf(i)-e.indexOf(t));return h.length?h[0]:(this._manipulators.forEach(t=>{const e=t.intersectionDistance(i);null!=e&&e<r&&(r=e,s=t.graphic)}),s)}_syncLayerViews(){this._layerViews=[];const i=new Set;for(const t of this.graphics){const e=m(this.view,t.layer);e&&i.add(e)}this._layerViews=[...i]}_setUpManipulators(){const{graphics:i,view:t}=this;this._manipulators.forEach(i=>i.destroy()),this._manipulators=i.length?i.map(i=>new x({graphic:i,view:t})):[]}_setUpHighlights(){this.highlightsEnabled&&this.graphics.length&&this._highlightHelper.add(this.graphics,this.highlightName)}_setUpIndicators(){if(this._removeIndicators(),this.indicatorsEnabled){for(const i of this.graphics){const t=i.clone();t.symbol=U(i),this._indicators.push(t),this.addHandles(s(()=>i.symbol,()=>this._setUpIndicators()),M)}this.layer.addMany(this._indicators)}}_removeIndicators(){this.removeHandles(M),this._indicators.length&&(this.layer.removeMany(this._indicators),this._indicators.forEach(i=>i.destroy()),this._indicators=[])}};function U(i){const t=12;if(null==i.symbol)return null;switch(i.symbol.type){case"cim":return new l({style:"circle",size:t,color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}});case"picture-marker":{const{xoffset:t,yoffset:e,height:s,width:r}=i.symbol,h=s===r?r:Math.max(s,r);return new l({xoffset:t,yoffset:e,size:h,style:"square",color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}})}case"simple-marker":{const{xoffset:t,yoffset:e,size:s,style:r}=i.symbol;return new l({xoffset:t,yoffset:e,style:"circle"===r?"circle":"square",size:s+2,color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}})}case"simple-fill":return new n({color:[0,0,0,0],outline:{style:"dash",color:[255,127,0,1],width:1}});case"simple-line":return new c({color:[255,127,0,1],style:"dash",width:1});case"text":{const{xoffset:e,yoffset:s}=i.symbol;return new l({xoffset:e,yoffset:s,size:t,color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}})}default:return null}}i([h()],E.prototype,"_activeGraphic",void 0),i([h({readOnly:!0})],E.prototype,"type",void 0),i([h()],E.prototype,"callbacks",void 0),i([h()],E.prototype,"enableMoveAllGraphics",void 0),i([h()],E.prototype,"graphics",void 0),i([h()],E.prototype,"highlightName",void 0),i([h()],E.prototype,"highlightsEnabled",void 0),i([h()],E.prototype,"indicatorsEnabled",void 0),i([h()],E.prototype,"_defaultLayer",void 0),i([h()],E.prototype,"layer",void 0),i([h({readOnly:!0})],E.prototype,"state",null),i([h()],E.prototype,"view",void 0),E=i([o("esri.views.draw.support.GraphicMover")],E);export{E as default};
|