@arcgis/core 4.34.0-next.52 → 4.34.0-next.54
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/applications/Components/formatUtils.d.ts +3 -0
- package/applications/Components/formatUtils.js +5 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{35fc8a64674005b1d1d7.js → 0a4357af5b8c0532b439.js} +1 -1
- package/assets/esri/core/workers/chunks/{e58336aafe8c95bb6831.js → 0eb728cee6e40cb30c01.js} +1 -1
- package/assets/esri/core/workers/chunks/{b87ed14fde381f79bc9f.js → 17776d9d3558d45ea7b5.js} +1 -1
- package/assets/esri/core/workers/chunks/23f54b49742098def8ae.js +1 -0
- 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/435169b455fd2846799b.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/69e6000044bfb03776ac.js +1 -0
- package/assets/esri/core/workers/chunks/{037bc400257bc13b3ec8.js → 772e81e9162e2240a7a6.js} +1 -1
- package/assets/esri/core/workers/chunks/813efde41e90e652b7db.js +1 -0
- package/assets/esri/core/workers/chunks/82404ff7c298493ff6f4.js +1 -0
- package/assets/esri/core/workers/chunks/{f1de768b0a6d345f7e39.js → 8f6ff09e7d2f01b79faf.js} +1 -1
- package/assets/esri/core/workers/chunks/9639a6f6fab52a501bf7.js +1 -0
- 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/dd120d562b63618e71c0.js +1 -0
- 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/{fb4950995f6780f6c22a.js → ee0286b5f5475f2d853f.js} +1 -1
- 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/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/geometry/operators/json/graphicBufferOperator.js +5 -0
- package/geometry/support/coordinateSystem.js +1 -1
- package/interfaces.d.ts +93 -185
- 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/networks/support/typeUtils.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/rest/featureService/FeatureService.js +1 -1
- package/rest/networks/support/Circuit.js +5 -0
- package/rest/networks/support/CircuitSection.js +1 -1
- package/rest/networks/support/Subcircuit.js +1 -1
- package/rest/print.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/CIMEffects.js +1 -1
- package/symbols/cim/effects/EffectOffset.js +1 -1
- package/views/2d/analysisViewModuleImportUtils.js +5 -0
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
- package/views/2d/input/MapViewInputManager.js +1 -1
- package/views/2d/layers/LayerView2D.js +1 -1
- package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
- package/views/3d/analysis/ElevationProfile/HoveredPointsVisualization.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
- package/views/3d/analysis/Viewshed/FieldOfViewManipulation.js +1 -1
- package/views/3d/analysisViewModuleImportUtils.js +5 -0
- package/views/3d/input/SceneInputManager.js +1 -1
- package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
- package/views/3d/interactive/editingTools/manipulations/MoveManipulation.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
- package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.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/effects/highlight/ShadowHighlight.js +1 -1
- package/views/3d/webgl-engine/lib/Octree.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/ToolViewManager.js +1 -1
- package/views/View.js +1 -1
- package/views/View2D.js +1 -1
- package/views/draw/Draw.js +1 -1
- package/views/draw/DrawGraphicTool.js +1 -1
- package/views/draw/DrawOperation.js +1 -1
- package/views/draw/LegacyDrawManipulator.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/input/InputManager.js +1 -1
- package/views/input/handlers/LatestPointer.js +1 -1
- package/views/interactive/InteractiveToolBase.js +1 -1
- package/views/interactive/ToolViewManagerManipulatorState.js +1 -1
- package/views/interactive/Tooltip.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/AnalysisViewManager.js +5 -0
- package/views/support/PromiseQueue.js +5 -0
- package/views/support/Scheduler.js +1 -1
- package/widgets/Feature/FeatureViewModel.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/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/2b75212c31145cc07d16.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/4c6862ad3af947c704f7.js +0 -1
- package/assets/esri/core/workers/chunks/4d544e3e19ce07c2c195.js +0 -1
- package/assets/esri/core/workers/chunks/781b59ba0cabe78bc122.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/b877142a275188a16e17.js +0 -1
- package/assets/esri/core/workers/chunks/c87bb42f825c39f9cce3.js +0 -1
- package/assets/esri/core/workers/chunks/cc0cb4906e4419f7c4a9.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/views/3d/analysis/AnalysisViewManager3D.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 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/SceneView.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../Camera.js";import i from"../Viewpoint.js";import r from"../core/Collection.js";import{byId as s}from"../core/domUtils.js";import n from"../core/Error.js";import{on as a}from"../core/events.js";import{makeHandle as o}from"../core/handleUtils.js";import has from"../core/has.js";import l from"../core/Logger.js";import{destroyMaybe as p,maybeProperty as h}from"../core/maybe.js";import{throwIfDestroyed as d,throwIfAborted as u,createAbortError as c}from"../core/promiseUtils.js";import g from"../core/ReactiveSet.js";import{on as m,watch as y,initial as f,sync as w,whenOnce as v,syncAndInitial as _}from"../core/reactiveUtils.js";import{setFrameDuration as b,cleanupScheduling as M}from"../core/scheduling.js";import{createScreenPointArray as S,createScreenPoint as V}from"../core/screenUtils.js";import{cleanupWhereClauseCache as j}from"../core/sql.js";import{getMetersPerUnitForSR as C}from"../core/unitUtils.js";import{initialize as T}from"../core/workers/workers.js";import{property as R}from"../core/accessorSupport/decorators/property.js";import{cast as x}from"../core/accessorSupport/decorators/cast.js";import"../core/RandomLCG.js";import{subclass as O}from"../core/accessorSupport/decorators/subclass.js";import{ensureType as A,ensureClass as E}from"../core/accessorSupport/ensureType.js";import{overrideDefaultsFrom as H}from"../core/accessorSupport/overrideDefaultsFrom.js";import{drainNotificationQueue as L}from"../core/accessorSupport/trackingUtils.js";import{create as I}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{cleanupPooledRBush as P}from"../core/libs/rbush/PooledRBush.js";import{owningCollectionProperty as F}from"../core/support/OwningCollection.js";import D from"../geometry/Extent.js";import G from"../geometry/HeightModelInfo.js";import U from"../geometry/Point.js";import{project as W,canProjectWithoutEngine as q}from"../geometry/projectionUtils.js";import z from"../geometry/SpatialReference.js";import{cleanupSpatialReferenceEllipsoidUtils as k}from"../geometry/spatialReferenceEllipsoidUtils.js";import{projectBoundingRect as B}from"../geometry/projection/projectBoundingRect.js";import{projectPointToVector as N}from"../geometry/projection/projectPointToVector.js";import{toExtent as Q,create as Y}from"../geometry/support/aaBoundingRect.js";import{renderSRFromViewSR as Z}from"../geometry/support/coordinateSystem.js";import{getResolutionForScale as $}from"../geometry/support/scaleUtils.js";import{isImageryTileLayer as J,isTiledLayer as K,isVoxelLayer as X,isIntegratedMeshLayer as ee}from"../layers/support/layerUtils.js";import{TilemapCache as te}from"../layers/support/TilemapCache.js";import{clearDefaultPortalInstance as ie}from"../portal/portalDefault.js";import{AnalysesCollection as re}from"../support/AnalysesCollection.js";import{WebSceneTag as se}from"../support/tagSymbols.js";import{BreakpointsOwner as ne}from"./BreakpointsOwner.js";import{DOMContainer as ae}from"./DOMContainer.js";import oe from"./GroundView.js";import{PopupView as le}from"./PopupView.js";import pe from"./View.js";import he from"./ViewAnimation.js";import{stringFromViewingMode as de,viewingModeFromString as ue}from"./ViewingMode.js";import{layerView3DImporter as ce}from"./3d/layerViewModuleImportUtils.js";import ge from"./3d/analysis/AnalysisViewManager3D.js";import{cleanupIntersectionUtils as me}from"./3d/camera/intersectionUtils.js";import{Constraints as ye}from"./3d/constraints/Constraints.js";import{EnvironmentManager as fe}from"./3d/environment/EnvironmentManager.js";import we from"./3d/environment/SceneViewEnvironment.js";import ve from"./3d/input/SceneInputManager.js";import{GraphicsDeconflictor as _e}from"./3d/layers/graphics/GraphicsDeconflictor.js";import{Labeler as be}from"./3d/layers/graphics/Labeler.js";import Me from"./3d/layers/i3s/I3SLodHandling.js";import{cleanupStageLayerElevationProvider as Se}from"./3d/layers/support/StageLayerElevationProvider.js";import Ve from"./3d/state/ViewState.js";import{ViewStateManager as je,cleanupViewStateManager as Ce}from"./3d/state/ViewStateManager.js";import{cleanupPointToPointAnimationController as Te}from"./3d/state/controllers/PointToPointAnimationController.js";import{SceneIntersectionHelper as Re}from"./3d/state/helpers/SceneIntersectionHelper.js";import{cleanupNavigationUtils as xe}from"./3d/state/utils/navigationUtils.js";import{CombinedElevationProvider as Oe}from"./3d/support/CombinedElevationProvider.js";import{debugFlags as Ae}from"./3d/support/debugFlags.js";import Ee from"./3d/support/DisplayQualityProfile.js";import{getElevationAtPoint as He}from"./3d/support/ElevationProvider.js";import{toMap as Le,hitTest as Ie}from"./3d/support/hitTest.js";import{popupHitTest as Pe}from"./3d/support/popupHitTest.js";import Fe from"./3d/support/QualitySettings.js";import{RenderCoordsHelper as De}from"./3d/support/RenderCoordsHelper.js";import{newResourceController as Ge}from"./3d/support/ResourceController.js";import Ue from"./3d/support/SceneViewPerformanceInfo.js";import{SharedSymbolResources as We}from"./3d/support/SharedSymbolResources.js";import{ViewSlice as qe}from"./3d/support/ViewSlice.js";import{PointsOfInterest as ze}from"./3d/support/pointsOfInterest/PointsOfInterest.js";import ke from"./3d/terrain/TerrainSurface.js";import{isSurfaceLayerView as Be,getTiledLayerInfo as Ne,checkIfTileInfoSupportedForView as Qe}from"./3d/terrain/terrainUtils.js";import{clearTilePerLayerInfo as Ye}from"./3d/terrain/TilePerLayerInfo.js";import{cleanupTileRenderer as Ze}from"./3d/terrain/TileRenderer.js";import{Stage as $e}from"./3d/webgl-engine/Stage.js";import{olidEnabled as Je}from"./3d/webgl-engine/effects/geometry/olidUtils.js";import{cleanupRenderOccluded as Ke}from"./3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js";import{defaultTolerance as Xe}from"./3d/webgl-engine/lib/Intersector.js";import{cleanupShadowmap as et}from"./3d/webgl-engine/lib/ShadowMap.js";import{terrainId as tt}from"./3d/webgl-engine/lib/verticalOffsetUtils.js";import{cleanupEdgeProcessing as it}from"./3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js";import{cleanupDrapedUtils as rt}from"./support/drapedUtils.js";import{defaultHighlightName as st}from"./support/HighlightDefaults.js";import nt from"./support/HighlightOptions.js";import{occludeesSupported as at}from"./support/layerViewUtils.js";import{isSupportedScreenPointEvent as ot,createScreenPointFromSupportedEvent as lt}from"./support/screenUtils.js";import{isSpatialReferenceSupported as pt}from"./support/spatialReferenceSupport.js";import{initializeTextureCompressionWorker as ht,destroyTextureCompressionWorker as dt}from"./support/TextureCompressionHelper.js";import{check as ut}from"./support/WebGLRequirements.js";import ct from"./ui/DefaultUI.js";import gt from"./ui/3d/DefaultUI3D.js";import mt from"../webscene/Environment.js";import{clearVNodeCache as yt}from"../widgets/support/vnodeCache.js";const ft=Symbol(),wt=Symbol();let vt=class extends(ne(le(ae(pe)))){constructor(e){super(e),this._userClippingArea=null,this._clippingArea=null,this._initialDefaultSpatialReference=null,this._overrideDefaultEnvironmentOnly=!0,this._resolveWhenReady=[],this._resourceController=Ge(this),this.deconflictor=new _e({view:this}),this.labeler=new be({view:this,deconflictor:this.deconflictor.labels}),this.sharedSymbolResources=null,this.analyses=new re,this.basemapTerrain=null,this.elevationProvider=null,this._canvas=null,this.constraints=new ye,this.environment=new we,this.environmentManager=new fe,this.floors=new r,this.fullOpacity=1,this.graphicsView=null,this.analysisViewManager=new ge({view:this}),this.groundView=null,this.map=null,this._featureTileTreeClients=new g,this._featureTiles=null,this._featureTreeDebugger=null,this.screenSizePerspectiveEnabled=!0,this.state=new Ve({view:this}),this.slice=new qe,this.spatialReference=null,this.alphaCompositingEnabled=!1,this.preserveDrawingBufferEnabled=!1,this.supersampleScreenshotsEnabled=!0,this.type="3d",this.ui=new gt,this._numUpdating=0,this._lastUpdateTime=0,this.updatingProgress=.5,this._importControllers=new Map,T();const t=(e=null)=>{null!=e&&4===e.type||(this._updatingChanged(),this.map?.allLayers.forEach(async e=>{try{await e.when()}catch(t){}this._updatingChanged()}))};this.addHandles([m(()=>this.map?.allLayers,"after-changes",e=>t(e),{onListenerAdd:()=>t(),onListenerRemove:()=>t(),sync:!0}),this.allLayerViews.on("after-changes",e=>this._updateUpdatingMonitors(e)),y(()=>this.scene,e=>e?.load().catch(()=>{}))]),this.inputManager=new ve({view:this}),this.stateManager=new je({view:this})}initialize(){if(has("enable-feature:esri-compress-textures")&&has("wasm-simd")){const e=ht(this,this.resourceController);this.addResolvingPromise(e.promise)}this.groundView=new oe({view:this}),this._updateUpdatingMonitors(),this.updatingHandles.add(()=>this.qualitySettings.memoryLimit,e=>{this.resourceController&&(this.resourceController.memoryController.maxMemory=e)},f),this.updatingHandles.add(()=>this.qualitySettings.additionalCacheMemory,e=>{this.resourceController&&(this.resourceController.memoryController.additionalCacheMemory=e)},f),this.updatingHandles.add(()=>this.qualitySettings.frameRate??0,e=>b(e>0?1e3/Math.ceil(e):0),f),this.addHandles([y(()=>this.spatialReference,()=>this.notifyChange("clippingArea"),w),y(()=>({plane:this.slice.plane,isDecoration:this.slice.isDecoration}),()=>this._updateSlice(),w)])}destroy(){this.destroyed||(dt(this),this.updatingHandles.removeAll(),this.basemapTerrain?.clearHandles(),this.ui.removeAllHandles(),this.layerViewManager.clearHandles(),this.invalidate(),this.activeTool=null,this.layerViewManager.clear(),this._set("analysisViewManager",p(this.analysisViewManager)),this._exitSurface(),this._disposeGraphicsView(),this._disposeFocusAreasView(),this.sharedSymbolResources=p(this.sharedSymbolResources),this._set("labeler",p(this.labeler)),this._set("deconflictor",p(this.deconflictor)),this._resourceController=p(this._resourceController),this._set("stateManager",p(this.stateManager)),this._set("inputManager",p(this.inputManager)),this.state.destroy(),this.highlights.destroy(),this.removeHandles("updatingMonitors"),this._set("environmentManager",p(this.environmentManager)),this._set("environment",p(this.environment)),this.groundView=p(this.groundView),this.slice.destroy(),this._updatingObjectsWithProgress.length=0,this._updatingObjects.length=0,this.ui?.destroy(),this._set("ui",null),this._set("renderCanvas",null),this._set("canvas",null),this._canvas=null)}get stage(){return this._stage}get renderSpatialReference(){return this.renderCoordsHelper?.spatialReference}get basemapSpatialReference(){return this.basemapTerrain?.spatialReference}get animation(){return this.state?.animation}get camera(){return this.stateManager?.camera}set camera(e){this.stateManager&&(this.stateManager.camera=e)}get contentCamera(){return this.stateManager?.contentCamera}set contentCamera(e){this.stateManager&&(this.stateManager.contentCamera=e)}installContentCameraReset(e={sticky:!1}){return this.stateManager.installContentCameraReset(e)}get canvas(){return this._canvas}get center(){return this.stateManager?.center}set center(e){this.stateManager&&(this.stateManager.center=e)}get clippingArea(){if("global"===this.viewingMode)return null;const e=this.map;let t=this._userClippingArea||h(e,"clippingArea");return!this._userClippingArea&&!h(e,"clippingEnabled")||null==t?(this._clippingArea=null,null):t instanceof D?this.spatialReference&&(t=_t(t,this.spatialReference),null==t)?(l.getLogger(this).error("#clippingArea","setting clippingArea with incompatible SpatialReference"),this._clippingArea):(t=t.clone(),null==t.intersection(this._groundAndLayersExtent)&&(t.xmin=t.xmax,t.ymin=t.ymax),t.zmin=void 0,t.zmax=void 0,t.equals(this._clippingArea)||(this._clippingArea=t),this._clippingArea):(l.getLogger(this).error("#clippingArea","only clippingArea geometries of type Extent are supported"),this._clippingArea)}set clippingArea(e){this.ready&&"global"===this.viewingMode&&null!=e?l.getLogger(this).error("#clippingArea=","Clipping area is only supported in local viewingMode"):this._userClippingArea=e}get renderDataExtent(){if(1===this.state.viewingMode)return null;const e=this.renderSpatialReference,t=this.dataExtent;return null==t||null==e||t.spatialReference.equals(e)?t:_t(t,e)}get tileInfo(){return this.basemapTerrain?.tilingScheme?.toTileInfo()}get dataExtent(){let e=this._groundAndLayersExtent;const t=this.spatialReference||z.WGS84,i=_t(this.clippingArea,t);null!=i&&(e=null!=e?e.intersection(i):i);const r=this._get("dataExtent");return null!=e&&e.equals(r)?r:e}get _groundAndLayersExtent(){const e=this.spatialReference||z.WGS84;let t;const i=i=>{const r=_t(i,e);null!=r&&(null!=t?t.union(r):t=r.clone())},{basemapTerrain:r}=this;if(r?.spatialReference){const e=r.groundExtent;i(new D({xmin:e[0],ymin:e[1],zmin:0,xmax:e[2],ymax:e[3],zmax:0,spatialReference:r.spatialReference}))}const s=e=>{null==e.fullExtent||"graphics"===e.type&&e.internal||i(e.fullExtent)};if(this.map?.allLayers.forEach(e=>s(e)),null==t)return null;t.hasZ?(t.zmin=Math.min(0,t.zmin??0),t.zmax=Math.max(0,t.zmax??0)):(t.zmin=0,t.zmax=0);const n=this._get("_groundAndLayersExtent");return t.equals(n)?n:t}castEnvironment(e){return e?e instanceof we?e:e instanceof mt?this.environment?.cloneWithWebsceneEnvironment(e)??we.fromWebsceneEnvironment(e):A(we,e):new we}get extent(){return this.stateManager?.extent}set extent(e){this.stateManager&&(this.stateManager.extent=e)}get screenCenter(){return this.stateManager?.screenCenter}get frustum(){return this.stateManager?.frustum}get initialExtentRequired(){return this.stateManager&&!this.stateManager.hasInitialView}get defaultsFromMapSettings(){return{required:{tileInfo:!1,heightModelInfo:!0,extent:!1}}}get interacting(){return this.navigating||(this.toolViewManager?.interacting??!1)}get stationary(){return!this.animation&&!this.resizing&&(this.state?.stationary??!0)}get navigating(){return this.state?.navigating??!1}get scene(){return this.map&&se in this.map?this.map:null}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}get featureTiles(){return this._featureTiles}set qualityProfile(e){Ee.isValidProfile(e)&&(Ee.apply(e,this.qualitySettings),this.stage?.renderView.updateQualitySettings(this.qualitySettings),this._set("qualityProfile",e))}get qualityProfile(){return this._get("qualityProfile")||Ee.getDefaultProfile()}_updateSlice(){null!=this.stage&&(this.stage.renderer.slice=this.slice)}get typeSpecificPreconditionsReady(){return!!this.viewingMode&&!!this.stateManager?.preinit(this.spatialReference)}get resolution(){return null!=this.spatialReference?$(this.scale,this.spatialReference):0}get scale(){return this.stateManager?.scale}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get heightModelInfo(){const e=this.getDefaultHeightModelInfo();return null!=e?G.deriveUnitFromSR(e,this.spatialReference):null}get updating(){if(this.destroying||this.destroyed)return!1;let e=0,t=this.layerViewManager.updating,i=t?this.layerViewManager.updatingRemaining:0;this.allLayerViews.forEach(r=>{if(r.isFulfilled()){if(r.updating){if(t=!0,r.suspended||Be(r))return;++i,e+=r.updatingProgress}}else++i});for(const s of this._updatingObjects)if(null!=s&&s.updating){const t=.1;i+=t,e+=.5*t}for(const s of this._updatingObjectsWithProgress)null!=s&&s.updating&&(++i,e+=s.updatingProgress);const r=!this.stateManager.test.updatingIgnoreRenderState&&this.state.updating;if(t=!!(t||i>0||this.updatingHandles.updating||!this.ready||!this.stationary||r||this._importControllers.size>0||this.inputManager?.updating||this.map?.allLayers?.some(e=>!e.isFulfilled())),t?(this._numUpdating=Math.max(i,this._numUpdating),e+=this._numUpdating-i):this._numUpdating=0,this._numUpdating>0?e/=this._numUpdating:e=t?0:1,this._get("updatingProgress")!==e){const i=performance.now();if(e<1){const t=Math.min((i-this._lastUpdateTime)/2e3,1);e=this.updatingProgress*(1-t)+e*t}this._set("updatingProgress",e),this._lastUpdateTime=t&&e<1?i:0}return t}get _updatingObjects(){return[this.graphicsView,this.basemapView,this._resourceController,this.stage,this.featureTiles,this.pointsOfInterest,this.environmentManager,this.overlay,this._featureTreeDebugger,this.toolViewManager,this.analysisViewManager]}get _updatingObjectsWithProgress(){return[this.deconflictor,this.labeler,this.basemapTerrain]}get viewingMode(){const e=this._predeterminedViewingMode;if(null!=e)return de(e);const t=this.spatialReference;return t?null!=this.defaultsFromMap?.viewingMode&&t.equals(this.defaultsFromMap.spatialReference)?de(this.defaultsFromMap.viewingMode):pt(t,1)?"global":"local":"global"}set viewingMode(e){this.ready?l.getLogger(this).error("#viewingMode","viewingMode cannot be set once view is ready"):this._overrideIfSome("viewingMode",e)}get viewpoint(){return this.stateManager?.viewpoint}set viewpoint(e){this.stateManager&&(this.stateManager.viewpoint=e)}get visibleArea(){return this.stateManager?.visibleArea}get zoom(){return this.stateManager.zoom}set zoom(e){this.stateManager&&(this.stateManager.zoom=e)}get highlightOptions(){return this.highlights.find(({name:e})=>e===st)??new nt}set highlightOptions(e){for(let t=0;t<this.highlights.length;++t){if(this.highlights.at(t).name===st)return void this.highlights.items[t].assignFrom(e)}}get resourceController(){return this._resourceController}get quality(){return this._resourceController?.memoryController?.memoryFactor??1}get resolutionScale(){return Math.sqrt(Math.min(1,this.quality/.75))}get performanceInfo(){return new Ue(this)}on(e,t,i,r){const s=this.viewEvents.on(e,t,i,r);return s||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}toMap(e,t){if(!this.ready)return l.getLogger(this).error("#toMap()","Scene view cannot be used before it is ready"),null;const i=ot(e)?lt(this,e):e;return Le(this,i,t,this._defaultToMapOptions)}toScreen(e){if(!this.ready)return l.getLogger(this).error("#toScreen()","Scene view cannot be used before it is ready"),null;const t=(null==e.z?He(this.elevationProvider,e):null)??0;return N(e,bt,this.renderSpatialReference,t),this.state.camera.projectToScreen(bt,Mt),V(Mt[0],Mt[1])}pixelSizeAt(e,t){if(!this.ready)return l.getLogger(this).error("#pixelSizeAt()","Scene view cannot be used before it is ready"),null;if(!e)return 0;const i=this.renderSpatialReference;N(e,bt,i);const r=this.state.camera.computeScreenPixelSizeAt(bt);return t&&i!==t?r*C(i)/C(t):r}overlayPixelSizeInMapUnits(e){const t=this.basemapTerrain.overlayManager;return t?t.overlayPixelSizeInMapUnits(e,()=>this.pixelSizeAt(e)):1}hitTest(e,t){if(!this.ready)return l.getLogger(this).error("#hitTest()","Scene view cannot be used before it is ready"),null;const i=ot(e)?lt(this,e):e;return Ie(this,i,t,this._defaultHitTestOptions)}async popupHitTest(e){return Pe(this,e)}goTo(e,t){return this.updatingHandles.addPromise(this.stateManager.goTo(e,t))}async whenAnalysisView(e){if(null==e.parent)throw new n("view:no-analysisview-for-analysis","The analysis has not been added to view.analyses",{analysis:e});switch(e.parent.type){case"line-of-sight":case"dimension":case"viewshed":return(await this.whenLayerView(e.parent)).whenAnalysisView();default:return this.analysisViewManager.whenAnalysisView(e)}}whenLayerView(e){return super.whenLayerView(e)}async takeScreenshot(e){const t=await this._completeSettings(e);await this.whenReady();const i=(await this.stage.renderView.takeScreenshot(t))[0];return(await import("./support/screenshotUtils.js")).encode(i,t,this._pixelFormat())}async _takeScreenshot(e){const t=await this._completeSettings(e);await this.whenReady();const i=(await this.stage.renderView.takeScreenshot(t))[0];return(await import("./support/screenshotUtils.js")).encodeData(i,this._pixelFormat())}async _takeScreenshotWithObjectAndLayerId(e){const t=await this._completeSettings(e);t.olidColor=!0,await this.whenReady();const i=await this.stage.renderView.takeScreenshot(t),{encodeData:r}=await import("./support/screenshotUtils.js");return[r(i[0],this._pixelFormat()),r(i[1],this._pixelFormat())]}async _completeSettings(e){const{toRenderSettings:t,screenshotSuperSampleSettings:i}=await import("./support/screenshotUtils.js"),r=t(e,this);return r.pixelRatio/=this.state.pixelRatio,i(r,this.supersampleScreenshotsEnabled,this.padding)}_pixelFormat(){return{flipY:!0,premultipliedAlpha:this.stage?.renderView.getAlpha()??!1}}get test(){}async takeScreenshotWithObjectAndLayerId(e){if(!Je())throw new n("360vr:objectAndLayerId-rendering-disabled","has enable-feature:objectAndLayerId-rendering must be true");const{encode:t}=await import("./support/screenshotUtils.js"),i=await this._completeSettings(e);i.olidColor=!0,await this.whenReady();const r=await this.stage.renderView.takeScreenshot(i),s=t(r[0],i,this._pixelFormat()),a=await this._completeSettings(e);a.format="png";return[s,t(r[1],a,this._pixelFormat())]}getColorToObjectAndLayerIdMapping(){const e=this.stage.renderView.olidRenderHelper;if(e)return e.getColorToObjectAndLayerIdMapping();throw new n("360vr:objectAndLayerId-rendering-disabled","has enable-feature:objectAndLayerId-rendering must be true")}addUpdatingPromise(e){return this.updatingHandles.addPromise(e)}importLayerView(e){return ce.importLayerView(e)}hasLayerViewModule(e){return ce.hasLayerViewModule(e)}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.scene?.initialViewProperties?.spatialReference||this.defaultsFromMap?.spatialReference||this.defaultsFromMap?.ready&&this._initialDefaultSpatialReference||null}async validate(){let e=ut(this.type);const t=has("safari");if(t&&t<9&&(e=new n("sceneview:browser-not-supported","This browser is not supported by SceneView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:t})),null!=e)throw l.getLogger(this).warn("#validate()",e.message),e}get _predeterminedViewingMode(){const e=this._isOverridden("viewingMode")?this._get("viewingMode"):this.scene?.initialViewProperties?.viewingMode;return null!=e?ue(e):null}getSpatialReferenceSupport(e,t){const i=this._predeterminedViewingMode;if(null!=i)return this._validateSpatialReferenceForViewingMode(e,t,i)?{constraints:this._makeSpatialReferenceConstraints(e,t,i)}:null;const r=this._validateSpatialReferenceForViewingMode(e,t,2),s=this._validateSpatialReferenceForViewingMode(e,t,1);return r||s?r&&s?{constraints:this._makeSpatialReferenceConstraints(e,t,null)}:r?{constraints:this._makeSpatialReferenceConstraints(e,t,2)}:{constraints:this._makeSpatialReferenceConstraints(e,t,1)}:null}_validateSpatialReferenceForViewingMode(e,t,i){return!!pt(e,i)&&(null==t||(!!J(t)||(!K(t)||null!=Ne(t,e,i))&&(!X(t)||1!==i)))}_makeSpatialReferenceConstraints(e,t,i){if(null==t)return[{spatialReference:e,viewingMode:i}];const{isWebMercator:r,isWGS84:s}=e;if(J(t)&&(r||s)){return!s||2===i||null===Qe(t.tileInfo,t.fullExtent,e,1)?[{spatialReference:e,viewingMode:i},{spatialReference:z.WebMercator,viewingMode:i}]:[{spatialReference:r?z.WGS84:z.WebMercator,viewingMode:i}]}return K(t)||X(t)||!r&&!s?K(t)&&r&&1!==i?[{spatialReference:e,viewingMode:i},{spatialReference:z.WGS84,viewingMode:2}]:[{spatialReference:e,viewingMode:i}]:[{spatialReference:e,viewingMode:i},{spatialReference:r?z.WGS84:z.WebMercator,viewingMode:i}]}_validateSpatialReference(e){const t=null!=this.getSpatialReferenceSupport(e),i=this._predeterminedViewingMode;return t||(null!=i?l.getLogger(this).warnOnce(`Spatial reference defined on view not supported in ${de(i)} viewing mode.`):e.isGeographic&&l.getLogger(this).warnOnce("Spatial reference is geographic but not supported.")),t}whenReady(){return new Promise(e=>{this.ready?e(this):this._resolveWhenReady.push(e)})}trackGraphicState(e){if(!e.graphic)return l.getLogger(this).error("trackGraphicState","GraphicState.graphic must not be null or undefined to start tracking"),null;const t=this.getViewForGraphic(e.graphic);let i=null,r=!1;const s=t=>{!r&&null!=t&&"processor"in t&&"graphics-3d"===t.processor?.type&&t.processor.graphicsCore&&(i=t.processor.graphicsCore.trackGraphicState(e))};return null!=t?s(t):this.whenViewForGraphic(e.graphic,{waitForLayer:!0}).then(e=>s(e),()=>{}).catch(()=>{}),o(()=>{r=!0,null!=i&&(i.remove(),i=null)})}maskOccludee(e){if(!e)return l.getLogger(this).error("maskOccludee","GraphicState.graphic must not be null or undefined to mask an occludee"),null;const t=this.getViewForGraphic(e);let i=null,r=!1;const s=t=>{!r&&null!=t&&at(t)&&(i=t.maskOccludee(e))};return null!=t?s(t):this.whenViewForGraphic(e,{waitForLayer:!0}).then(e=>s(e),()=>{}).catch(()=>{}),o(()=>{r=!0,null!=i&&(i.remove(),i=null)})}getViewForGraphic(e){return e.layer===this?this.graphicsView:e.layer?this.allLayerViews.filter(e=>"media-3d"!==e.type).find(t=>t.layer===e.layer):null}graphicChanged(e){null!=this.graphicsView&&this.graphicsView.graphicChanged(e)}async whenViewForGraphic(e,t){return e.layer===this?(await v(()=>this.graphicsView),this.graphicsView):e.layer&&this.map?t&&t.waitForLayer&&!this.map.allLayers.includes(e.layer)?new Promise((t,i)=>{const r=this.map.allLayers.on("change",s=>{s.added.includes(e.layer)&&(r.remove(),this.whenLayerView(e.layer).then(t,i))})}):this.whenLayerView(e.layer):null}enableFeatureTiles(){const e=Symbol();return this._featureTileTreeClients.add(e),o(()=>this._featureTileTreeClients.delete(e))}async _importModule(e,t){const i=new AbortController;this._importControllers.set(e,i),this._updatingChanged();try{const r=await Vt[e]();if(t&&(d(this),u(i.signal),await t(i.signal)),this.destroyed)throw c();return u(i.signal),r}catch{return null}finally{this._importControllers.delete(e),this._updatingChanged()}}_abortImport(e){this._importControllers.get(e)?.abort(),this._importControllers.delete(e),this._updatingChanged()}_initBasemapTerrain(){this._set("basemapTerrain",new ke({view:this})),this._set("elevationProvider",new Oe({view:this})),this.elevationProvider.register("ground",this.basemapTerrain)}_exitBasemapTerrain(){const{basemapTerrain:e,elevationProvider:t}=this;e&&(this._set("basemapTerrain",null),this._set("elevationProvider",null),t.unregister(e),t.destroy(),e.destroy())}_initGlobe(){this._initCoordinateSystem(),this.state.createInitialCamera(),this._initBasemapTerrain(),this._set("pointsOfInterest",new ze({view:this})),this.addHandles([this.updatingHandles.add(()=>Ae.FEATURE_TILE_TREE_SHOW_TILES,e=>{e&&!this._featureTreeDebugger?this.updatingHandles.addPromise(import("./3d/layers/support/FeatureTileTree3DDebugger.js")).then(({FeatureTileTree3DDebugger:e})=>{!this._featureTreeDebugger&&Ae.FEATURE_TILE_TREE_SHOW_TILES&&(this._featureTreeDebugger=new e({view:this}))}):e||(this._featureTreeDebugger=p(this._featureTreeDebugger))},_),this.updatingHandles.add(()=>({basemapExtent:this.basemapTerrain?.extent,basemapSpatialReference:this.basemapTerrain?.spatialReference,clippingArea:this.clippingArea,featureTiles:this._featureTiles}),({basemapExtent:e,basemapSpatialReference:t,clippingArea:i,featureTiles:r})=>{if(!r)return;const s=!!e;if(i||s)if(s&&t){const s=e&&t?W(Q(e,t),this.spatialReference):null;r.filterExtent=i?i.intersection(s):s}else r.filterExtent=i;else r.filterExtent=null},_),this.updatingHandles.add(()=>this._featureTileTreeClients.size>0,e=>{e?this._ensureFeatureTileTree():this._featureTiles=p(this._featureTiles)},w)],ft),this.stateManager.init()}async _ensureFeatureTileTree(){if(this._featureTiles||this._importControllers.has("FeatureTileTree3D"))return;const e=(await this.updatingHandles.addPromise(this._importModule("FeatureTileTree3D")))?.FeatureTileTree3D;e&&(this._featureTiles=new e({renderCoordsHelper:this.renderCoordsHelper,pointsOfInterest:this.pointsOfInterest,viewState:this.state,scheduler:this._resourceController.scheduler,terrain:this.basemapTerrain}),this._updatingChanged())}_exitTerrain(){this.stateManager.exit(),this.removeHandles(wt),this.removeHandles(ft),this._featureTiles=p(this.featureTiles),this._set("pointsOfInterest",p(this.pointsOfInterest)),this._exitBasemapTerrain(),this.state.reset(),this._exitCoordinateSystem()}_initCoordinateSystem(){if(this.spatialReference){const e=this.spatialReference,t=this.state.isGlobal,i=Z(t,e);i!==this.renderSpatialReference&&(this._set("renderCoordsHelper",De.create(this.state.viewingMode,i)),t||this.addHandles(y(()=>this.basemapTerrain?.extent,e=>{const t=this.renderCoordsHelper.spatialReference;null==e||0===e[0]&&0===e[1]&&0===e[2]&&0===e[3]||!B(e,this.basemapTerrain.spatialReference,St,t)||(this.renderCoordsHelper.extent=St)},w),wt),this.sceneIntersectionHelper&&this.sceneIntersectionHelper.setTolerance(Xe/this.renderCoordsHelper.unitInMeters))}else this._set("renderCoordsHelper",null)}_exitCoordinateSystem(){this.removeHandles(wt),this._set("renderCoordsHelper",null)}_updatingChanged(){this.notifyChange("updating")}_updateUpdatingMonitors(e=null){null!=e&&4===e.type||(this.removeHandles("updatingMonitors"),this.allLayerViews.forEach(e=>{e.destroyed||(this.addHandles(y(()=>[e.updating,e.updatingProgress],()=>this._updatingChanged(),w),"updatingMonitors"),e.when(()=>this._updatingChanged(),()=>this._updatingChanged()))}),this._updatingChanged())}async _prepareScreenshotOverlay(){this.overlay&&await this.overlay.prepare()}_renderScreenshotOverlay(e,t,i){if(!this.overlay||!this.overlay.hasVisibleItems)return i;const r=e.getContext("2d",{willReadFrequently:!0});return r.putImageData(i,0,0),this.overlay.renderCanvas(e,{disableDecorations:t}),r.getImageData(0,0,i.width,i.height)}_initStage(){const e={deactivatedWebGLExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions,alpha:this.alphaCompositingEnabled,preserveDrawingBuffer:this.preserveDrawingBufferEnabled,canvas:this.renderCanvas,screenshot:{prepareOverlay:()=>this._prepareScreenshotOverlay(),renderOverlay:(e,t,i)=>this._renderScreenshotOverlay(e,t,i)}},t=new Re(this.state.viewingMode,e=>this.stage.layers.forEach(e),this);this._set("sceneIntersectionHelper",t);const i=s(this.surface);this._stage=new $e({view:this,options:e,container:i}),this.notifyChange("stage"),this._updateSlice(),this.addHandles([this.updatingHandles.add(()=>this.qualitySettings.highQualityTransparency,e=>this.stage.renderer.setParameters({highQualityTransparency:e}),f),this.on("pointer-move",()=>this.stage?.renderer.resetAnimation()),a(this.stage.renderView.canvas,"webglcontextlost",e=>{this.fatalError=new n("webgl-context-lost",e.statusMessage)})],"stage"),this.renderCoordsHelper&&this.sceneIntersectionHelper.setTolerance(Xe/this.renderCoordsHelper.unitInMeters),this._set("canvas",this.stage.renderView.canvas)}_exitStage(){this.sceneIntersectionHelper?.destroy(),this._set("sceneIntersectionHelper",null),this._stage=p(this.stage),this._set("stage",null),this.removeHandles("stage"),this._set("canvas",null)}_initSurface(e){this._exitSurface(),this._initStage(),this._initGlobe(),this.sharedSymbolResources=new We({view:this,viewingMode:e,resourceController:this._resourceController,pointsOfInterest:this.pointsOfInterest,viewState:this.state})}_exitSurface(){this.sharedSymbolResources&&(this.sharedSymbolResources.objectResourceCache.destroy(),this.sharedSymbolResources.destroy(),this.sharedSymbolResources=null,this._exitTerrain(),this._exitStage())}async _ensureGraphicsView(){if(this.graphicsView||this._importControllers.has("GraphicsView3D")||0===this.graphics.length)return;this.removeHandles("GraphicsView3D");const e=(await this.updatingHandles.addPromise(this._importModule("GraphicsView3D",e=>v(()=>this.basemapTerrain?.ready,e))))?.default;e&&this._set("graphicsView",new e({view:this,getGraphics:()=>this.graphics})),this._updatingChanged()}_disposeGraphicsView(){this._abortImport("GraphicsView3D"),this.removeHandles("GraphicsView3D"),this.graphicsView&&(this.removeHandles(this.graphicsView.processor.layer.id),this.graphicsView.destroy(),this._set("graphicsView",null))}_disposeFocusAreasView(){this._abortImport("FocusAreasView"),this.removeHandles("FocusAreasView"),this.focusAreasView=p(this.focusAreasView)}async _ensureFocusAreasView(e){if(this.focusAreasView||this._importControllers.has("FocusAreasView")||0===e)return;this.removeHandles("FocusAreasView");const t=(await this.updatingHandles.addPromise(this._importModule("FocusAreasView")))?.FocusAreasView;t&&(this.focusAreasView=new t({view:this})),this._updatingChanged()}_startup(){const e=ue(this.viewingMode);1===e&&(this._clippingArea=null),this._initSurface(e),this._set("ready",!0),this.addHandles(m(()=>this.graphics,"after-changes",()=>this._ensureGraphicsView()),"GraphicsView3D"),this._ensureGraphicsView(),this.addHandles(y(()=>this.map?.focusAreas?.areas.length??0,e=>this._ensureFocusAreasView(e),{initial:!0}),"FocusAreasView");const t=this.scene?.initialViewProperties??null,i=t?.environment;i&&(this._overrideDefaultEnvironmentOnly?H(this.environment,i):this.environment=this.environment.cloneWithWebsceneEnvironment(i)),this.timeExtent=t?.timeExtent,t?.analyses.applyTo(this),this.labeler.setup(),this.environmentManager.connectView(this),this.inputManager.connect();const r=this._resolveWhenReady;this._resolveWhenReady=[],r.forEach(e=>e(this))}_teardown(){this._initialDefaultSpatialReference=null,this.inputManager.disconnect(),this.environmentManager.disconnectView(),this._overrideDefaultEnvironmentOnly=!1,this.labeler.dispose(),this._disposeGraphicsView(),this._disposeFocusAreasView(),this._exitSurface(),this._set("ready",!1)}get _defaultToMapOptions(){const e={include:new Set};if(!this.map)return e;this.map.ground&&e.include.add(tt);for(const t of this.allLayerViews)ee(t.layer.type)&&e.include.add(t.uid);return e}get _defaultHitTestOptions(){const e={exclude:new Set};if(!this.map)return e;this.map.ground&&this.map.ground.opacity<1&&e.exclude.add(tt);for(const t of this.allLayerViews)ee(t.layer.type)&&t.layer.opacity<1&&e.exclude.add(t.uid);return e}static{this.type="3d"}static clearStatics(){yt(),L(),j(),it(),Ce(),me(),Se(),k(),rt(),ie(),Ze(),et(),Te(),xe(),P(),M(),Ke(),Ye(),Me.cleanupI3SLodHandling(),te.cleanupTilemapCache(),Ve.cleanupViewstate(),ke.cleanupTerrainSurface()}};function _t(e,t){return null!=e&&q(e.spatialReference,t)?W(e,t):null}e([R()],vt.prototype,"_userClippingArea",void 0),e([R()],vt.prototype,"_resourceController",void 0),e([R()],vt.prototype,"stage",null),e([R({readOnly:!0})],vt.prototype,"deconflictor",void 0),e([R({readOnly:!0})],vt.prototype,"labeler",void 0),e([R(F(re,"analyses"))],vt.prototype,"analyses",void 0),e([R({type:he,readOnly:!0})],vt.prototype,"animation",null),e([R({readOnly:!0})],vt.prototype,"basemapTerrain",void 0),e([R({readOnly:!0})],vt.prototype,"elevationProvider",void 0),e([R()],vt.prototype,"camera",null),e([R({type:t})],vt.prototype,"contentCamera",null),e([R({readOnly:!0})],vt.prototype,"canvas",null),e([R({type:U})],vt.prototype,"center",null),e([R({type:D})],vt.prototype,"clippingArea",null),e([R({type:ye})],vt.prototype,"constraints",void 0),e([R({type:D,readOnly:!0})],vt.prototype,"renderDataExtent",null),e([R({readOnly:!0})],vt.prototype,"tileInfo",null),e([R({type:D,readOnly:!0})],vt.prototype,"dataExtent",null),e([R({type:D,readOnly:!0})],vt.prototype,"_groundAndLayersExtent",null),e([R({type:we})],vt.prototype,"environment",void 0),e([x("environment")],vt.prototype,"castEnvironment",null),e([R({readOnly:!0})],vt.prototype,"environmentManager",void 0),e([R({type:D})],vt.prototype,"extent",null),e([R({type:r})],vt.prototype,"floors",void 0),e([R()],vt.prototype,"screenCenter",null),e([R()],vt.prototype,"frustum",null),e([R({type:Number,readOnly:!0})],vt.prototype,"fullOpacity",void 0),e([R({readOnly:!0})],vt.prototype,"graphicsView",void 0),e([R({})],vt.prototype,"analysisViewManager",void 0),e([R()],vt.prototype,"groundView",void 0),e([R({type:Boolean})],vt.prototype,"initialExtentRequired",null),e([R()],vt.prototype,"defaultsFromMapSettings",null),e([R()],vt.prototype,"interacting",null),e([R()],vt.prototype,"stationary",null),e([R()],vt.prototype,"navigating",null),e([R()],vt.prototype,"map",void 0),e([R()],vt.prototype,"padding",null),e([R({type:ze,readOnly:!0})],vt.prototype,"pointsOfInterest",void 0),e([R()],vt.prototype,"_featureTiles",void 0),e([R()],vt.prototype,"featureTiles",null),e([R()],vt.prototype,"_featureTreeDebugger",void 0),e([R({type:Boolean})],vt.prototype,"screenSizePerspectiveEnabled",void 0),e([R({constructOnly:!0})],vt.prototype,"deactivatedWebGLExtensions",void 0),e([R({constructOnly:!0})],vt.prototype,"debugWebGLExtensions",void 0),e([R({constructOnly:!0})],vt.prototype,"renderCanvas",void 0),e([R({constructOnly:!0})],vt.prototype,"state",void 0),e([R({readOnly:!0})],vt.prototype,"inputManager",void 0),e([R({readOnly:!0})],vt.prototype,"stateManager",void 0),e([R({type:["low","medium","high"]})],vt.prototype,"qualityProfile",null),e([R({type:Fe,get(){let e=this._get("qualitySettings");return e||(e=new Fe,Ee.apply(this.qualityProfile,e)),e}})],vt.prototype,"qualitySettings",void 0),e([R()],vt.prototype,"slice",void 0),e([R({readOnly:!0})],vt.prototype,"typeSpecificPreconditionsReady",null),e([R({readOnly:!0})],vt.prototype,"renderCoordsHelper",void 0),e([R({readOnly:!0})],vt.prototype,"sceneIntersectionHelper",void 0),e([R({type:Number,dependsOn:["scale","spatialReference"],readOnly:!0})],vt.prototype,"resolution",null),e([R({type:Number})],vt.prototype,"scale",null),e([R()],vt.prototype,"heightModelInfo",null),e([R()],vt.prototype,"spatialReference",void 0),e([R({type:Boolean,constructOnly:!0})],vt.prototype,"alphaCompositingEnabled",void 0),e([R({constructOnly:!0})],vt.prototype,"preserveDrawingBufferEnabled",void 0),e([R({type:Boolean})],vt.prototype,"supersampleScreenshotsEnabled",void 0),e([R({readOnly:!0})],vt.prototype,"type",void 0),e([R(),x(e=>e instanceof ct?e:E(gt,e))],vt.prototype,"ui",void 0),e([R({type:Boolean,readOnly:!0,dependsOn:["graphicsView.updating","basemapView.updating","basemapTerrain.updating","layerViewManager.updating","layerViewManager.updatingRemaining","_resourceController.updating","stage.updating","featureTiles.updating","pointsOfInterest.updating","environmentManager.updating","overlay.updating","updatingHandles.updating","featureTreeDebugger.updating","labeler.updating","deconflictor.updating","ready","stationary","inputManager.updating","toolViewManager.updating","analysisViewManager.updating","state.updating","textures.updating"]})],vt.prototype,"updating",null),e([R()],vt.prototype,"_updatingObjects",null),e([R()],vt.prototype,"_updatingObjectsWithProgress",null),e([R({type:Number,readOnly:!0,dependsOn:["updating"]})],vt.prototype,"updatingProgress",void 0),e([R({type:["global","local"]})],vt.prototype,"viewingMode",null),e([R({type:i})],vt.prototype,"viewpoint",null),e([R({readOnly:!0})],vt.prototype,"visibleArea",null),e([R({type:Number})],vt.prototype,"zoom",null),e([R({type:nt})],vt.prototype,"highlightOptions",null),e([R({readOnly:!0})],vt.prototype,"quality",null),e([R({readOnly:!0})],vt.prototype,"resolutionScale",null),e([R()],vt.prototype,"focusAreasView",void 0),e([R()],vt.prototype,"_defaultToMapOptions",null),e([R()],vt.prototype,"_defaultHitTestOptions",null),vt=e([O("esri.views.SceneView")],vt);const bt=I(),Mt=S(),St=Y(),Vt={GraphicsView3D:()=>import("./3d/layers/GraphicsView3D.js"),FocusAreasView:()=>import("./3d/FocusAreasView.js"),FeatureTileTree3D:()=>import("./3d/layers/support/FeatureTileTree3D.js")},jt=vt;export{jt as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../Camera.js";import i from"../Viewpoint.js";import r from"../core/Collection.js";import{byId as s}from"../core/domUtils.js";import n from"../core/Error.js";import{on as a}from"../core/events.js";import{makeHandle as o}from"../core/handleUtils.js";import has from"../core/has.js";import l from"../core/Logger.js";import{destroyMaybe as p,maybeProperty as h}from"../core/maybe.js";import{throwIfDestroyed as d,throwIfAborted as u,createAbortError as c}from"../core/promiseUtils.js";import g from"../core/ReactiveSet.js";import{on as m,watch as y,initial as f,sync as w,whenOnce as v,syncAndInitial as _}from"../core/reactiveUtils.js";import{setFrameDuration as b,cleanupScheduling as M}from"../core/scheduling.js";import{createScreenPointArray as S,createScreenPoint as V}from"../core/screenUtils.js";import{cleanupWhereClauseCache as j}from"../core/sql.js";import{getMetersPerUnitForSR as C}from"../core/unitUtils.js";import{initialize as T}from"../core/workers/workers.js";import{property as R}from"../core/accessorSupport/decorators/property.js";import{cast as x}from"../core/accessorSupport/decorators/cast.js";import"../core/RandomLCG.js";import{subclass as O}from"../core/accessorSupport/decorators/subclass.js";import{ensureType as A,ensureClass as E}from"../core/accessorSupport/ensureType.js";import{overrideDefaultsFrom as H}from"../core/accessorSupport/overrideDefaultsFrom.js";import{drainNotificationQueue as L}from"../core/accessorSupport/trackingUtils.js";import{create as I}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{cleanupPooledRBush as P}from"../core/libs/rbush/PooledRBush.js";import{owningCollectionProperty as F}from"../core/support/OwningCollection.js";import D from"../geometry/Extent.js";import U from"../geometry/HeightModelInfo.js";import G from"../geometry/Point.js";import{project as W,canProjectWithoutEngine as q}from"../geometry/projectionUtils.js";import z from"../geometry/SpatialReference.js";import{cleanupSpatialReferenceEllipsoidUtils as k}from"../geometry/spatialReferenceEllipsoidUtils.js";import{projectBoundingRect as B}from"../geometry/projection/projectBoundingRect.js";import{projectPointToVector as N}from"../geometry/projection/projectPointToVector.js";import{toExtent as Q,create as Y}from"../geometry/support/aaBoundingRect.js";import{renderSRFromViewSR as Z}from"../geometry/support/coordinateSystem.js";import{getResolutionForScale as $}from"../geometry/support/scaleUtils.js";import{isImageryTileLayer as J,isTiledLayer as K,isVoxelLayer as X,isIntegratedMeshLayer as ee}from"../layers/support/layerUtils.js";import{TilemapCache as te}from"../layers/support/TilemapCache.js";import{clearDefaultPortalInstance as ie}from"../portal/portalDefault.js";import{AnalysesCollection as re}from"../support/AnalysesCollection.js";import{WebSceneTag as se}from"../support/tagSymbols.js";import{BreakpointsOwner as ne}from"./BreakpointsOwner.js";import{DOMContainer as ae}from"./DOMContainer.js";import oe from"./GroundView.js";import{PopupView as le}from"./PopupView.js";import pe from"./View.js";import he from"./ViewAnimation.js";import{stringFromViewingMode as de,viewingModeFromString as ue}from"./ViewingMode.js";import{importAnalysisViewModule as ce}from"./3d/analysisViewModuleImportUtils.js";import{layerView3DImporter as ge}from"./3d/layerViewModuleImportUtils.js";import{cleanupIntersectionUtils as me}from"./3d/camera/intersectionUtils.js";import{Constraints as ye}from"./3d/constraints/Constraints.js";import{EnvironmentManager as fe}from"./3d/environment/EnvironmentManager.js";import we from"./3d/environment/SceneViewEnvironment.js";import ve from"./3d/input/SceneInputManager.js";import{GraphicsDeconflictor as _e}from"./3d/layers/graphics/GraphicsDeconflictor.js";import{Labeler as be}from"./3d/layers/graphics/Labeler.js";import Me from"./3d/layers/i3s/I3SLodHandling.js";import{cleanupStageLayerElevationProvider as Se}from"./3d/layers/support/StageLayerElevationProvider.js";import Ve from"./3d/state/ViewState.js";import{ViewStateManager as je,cleanupViewStateManager as Ce}from"./3d/state/ViewStateManager.js";import{cleanupPointToPointAnimationController as Te}from"./3d/state/controllers/PointToPointAnimationController.js";import{SceneIntersectionHelper as Re}from"./3d/state/helpers/SceneIntersectionHelper.js";import{cleanupNavigationUtils as xe}from"./3d/state/utils/navigationUtils.js";import{CombinedElevationProvider as Oe}from"./3d/support/CombinedElevationProvider.js";import{debugFlags as Ae}from"./3d/support/debugFlags.js";import Ee from"./3d/support/DisplayQualityProfile.js";import{getElevationAtPoint as He}from"./3d/support/ElevationProvider.js";import{toMap as Le,hitTest as Ie}from"./3d/support/hitTest.js";import{popupHitTest as Pe}from"./3d/support/popupHitTest.js";import Fe from"./3d/support/QualitySettings.js";import{RenderCoordsHelper as De}from"./3d/support/RenderCoordsHelper.js";import{newResourceController as Ue}from"./3d/support/ResourceController.js";import Ge from"./3d/support/SceneViewPerformanceInfo.js";import{SharedSymbolResources as We}from"./3d/support/SharedSymbolResources.js";import{ViewSlice as qe}from"./3d/support/ViewSlice.js";import{PointsOfInterest as ze}from"./3d/support/pointsOfInterest/PointsOfInterest.js";import ke from"./3d/terrain/TerrainSurface.js";import{isSurfaceLayerView as Be,getTiledLayerInfo as Ne,checkIfTileInfoSupportedForView as Qe}from"./3d/terrain/terrainUtils.js";import{clearTilePerLayerInfo as Ye}from"./3d/terrain/TilePerLayerInfo.js";import{cleanupTileRenderer as Ze}from"./3d/terrain/TileRenderer.js";import{Stage as $e}from"./3d/webgl-engine/Stage.js";import{olidEnabled as Je}from"./3d/webgl-engine/effects/geometry/olidUtils.js";import{cleanupRenderOccluded as Ke}from"./3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js";import{defaultTolerance as Xe}from"./3d/webgl-engine/lib/Intersector.js";import{cleanupShadowmap as et}from"./3d/webgl-engine/lib/ShadowMap.js";import{terrainId as tt}from"./3d/webgl-engine/lib/verticalOffsetUtils.js";import{cleanupEdgeProcessing as it}from"./3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js";import rt from"./support/AnalysisViewManager.js";import{cleanupDrapedUtils as st}from"./support/drapedUtils.js";import{defaultHighlightName as nt}from"./support/HighlightDefaults.js";import at from"./support/HighlightOptions.js";import{occludeesSupported as ot}from"./support/layerViewUtils.js";import{isSupportedScreenPointEvent as lt,createScreenPointFromSupportedEvent as pt}from"./support/screenUtils.js";import{isSpatialReferenceSupported as ht}from"./support/spatialReferenceSupport.js";import{initializeTextureCompressionWorker as dt,destroyTextureCompressionWorker as ut}from"./support/TextureCompressionHelper.js";import{check as ct}from"./support/WebGLRequirements.js";import gt from"./ui/DefaultUI.js";import mt from"./ui/3d/DefaultUI3D.js";import yt from"../webscene/Environment.js";import{clearVNodeCache as ft}from"../widgets/support/vnodeCache.js";const wt=Symbol(),vt=Symbol();let _t=class extends(ne(le(ae(pe)))){constructor(e){super(e),this._userClippingArea=null,this._clippingArea=null,this._initialDefaultSpatialReference=null,this._overrideDefaultEnvironmentOnly=!0,this._resolveWhenReady=[],this._resourceController=Ue(this),this.deconflictor=new _e({view:this}),this.labeler=new be({view:this,deconflictor:this.deconflictor.labels}),this.sharedSymbolResources=null,this.analyses=new re,this.basemapTerrain=null,this.elevationProvider=null,this._canvas=null,this.constraints=new ye,this.environment=new we,this.environmentManager=new fe,this.floors=new r,this.fullOpacity=1,this.graphicsView=null,this.analysisViewManager=new rt({importAnalysisViewModule:e=>ce(e),view:this}),this.groundView=null,this.map=null,this._featureTileTreeClients=new g,this._featureTiles=null,this._featureTreeDebugger=null,this.screenSizePerspectiveEnabled=!0,this.state=new Ve({view:this}),this.slice=new qe,this.spatialReference=null,this.alphaCompositingEnabled=!1,this.preserveDrawingBufferEnabled=!1,this.supersampleScreenshotsEnabled=!0,this.type="3d",this.ui=new mt,this._numUpdating=0,this._lastUpdateTime=0,this.updatingProgress=.5,this._importControllers=new Map,T();const t=(e=null)=>{null!=e&&4===e.type||(this._updatingChanged(),this.map?.allLayers.forEach(async e=>{try{await e.when()}catch(t){}this._updatingChanged()}))};this.addHandles([m(()=>this.map?.allLayers,"after-changes",e=>t(e),{onListenerAdd:()=>t(),onListenerRemove:()=>t(),sync:!0}),this.allLayerViews.on("after-changes",e=>this._updateUpdatingMonitors(e)),y(()=>this.scene,e=>e?.load().catch(()=>{}))]),this.inputManager=new ve({view:this}),this.stateManager=new je({view:this})}initialize(){if(has("enable-feature:esri-compress-textures")&&has("wasm-simd")){const e=dt(this,this.resourceController);this.addResolvingPromise(e.promise)}this.groundView=new oe({view:this}),this._updateUpdatingMonitors(),this.updatingHandles.add(()=>this.qualitySettings.memoryLimit,e=>{this.resourceController&&(this.resourceController.memoryController.maxMemory=e)},f),this.updatingHandles.add(()=>this.qualitySettings.additionalCacheMemory,e=>{this.resourceController&&(this.resourceController.memoryController.additionalCacheMemory=e)},f),this.updatingHandles.add(()=>this.qualitySettings.frameRate??0,e=>b(e>0?1e3/Math.ceil(e):0),f),this.addHandles([y(()=>this.spatialReference,()=>this.notifyChange("clippingArea"),w),y(()=>({plane:this.slice.plane,isDecoration:this.slice.isDecoration}),()=>this._updateSlice(),w)])}destroy(){this.destroyed||(ut(this),this.updatingHandles.removeAll(),this.basemapTerrain?.clearHandles(),this.ui.removeAllHandles(),this.layerViewManager.clearHandles(),this.invalidate(),this.activeTool=null,this.layerViewManager.clear(),this._set("analysisViewManager",p(this.analysisViewManager)),this._exitSurface(),this._disposeGraphicsView(),this._disposeFocusAreasView(),this.sharedSymbolResources=p(this.sharedSymbolResources),this._set("labeler",p(this.labeler)),this._set("deconflictor",p(this.deconflictor)),this._resourceController=p(this._resourceController),this._set("stateManager",p(this.stateManager)),this._set("inputManager",p(this.inputManager)),this.state.destroy(),this.highlights.destroy(),this.removeHandles("updatingMonitors"),this._set("environmentManager",p(this.environmentManager)),this._set("environment",p(this.environment)),this.groundView=p(this.groundView),this.slice.destroy(),this._updatingObjectsWithProgress.length=0,this._updatingObjects.length=0,this.ui?.destroy(),this._set("ui",null),this._set("renderCanvas",null),this._set("canvas",null),this._canvas=null)}get stage(){return this._stage}get renderSpatialReference(){return this.renderCoordsHelper?.spatialReference}get basemapSpatialReference(){return this.basemapTerrain?.spatialReference}get animation(){return this.state?.animation}get camera(){return this.stateManager?.camera}set camera(e){this.stateManager&&(this.stateManager.camera=e)}get contentCamera(){return this.stateManager?.contentCamera}set contentCamera(e){this.stateManager&&(this.stateManager.contentCamera=e)}installContentCameraReset(e={sticky:!1}){return this.stateManager.installContentCameraReset(e)}get canvas(){return this._canvas}get center(){return this.stateManager?.center}set center(e){this.stateManager&&(this.stateManager.center=e)}get clippingArea(){if("global"===this.viewingMode)return null;const e=this.map;let t=this._userClippingArea||h(e,"clippingArea");return!this._userClippingArea&&!h(e,"clippingEnabled")||null==t?(this._clippingArea=null,null):t instanceof D?this.spatialReference&&(t=bt(t,this.spatialReference),null==t)?(l.getLogger(this).error("#clippingArea","setting clippingArea with incompatible SpatialReference"),this._clippingArea):(t=t.clone(),null==t.intersection(this._groundAndLayersExtent)&&(t.xmin=t.xmax,t.ymin=t.ymax),t.zmin=void 0,t.zmax=void 0,t.equals(this._clippingArea)||(this._clippingArea=t),this._clippingArea):(l.getLogger(this).error("#clippingArea","only clippingArea geometries of type Extent are supported"),this._clippingArea)}set clippingArea(e){this.ready&&"global"===this.viewingMode&&null!=e?l.getLogger(this).error("#clippingArea=","Clipping area is only supported in local viewingMode"):this._userClippingArea=e}get renderDataExtent(){if(1===this.state.viewingMode)return null;const e=this.renderSpatialReference,t=this.dataExtent;return null==t||null==e||t.spatialReference.equals(e)?t:bt(t,e)}get tileInfo(){return this.basemapTerrain?.tilingScheme?.toTileInfo()}get dataExtent(){let e=this._groundAndLayersExtent;const t=this.spatialReference||z.WGS84,i=bt(this.clippingArea,t);null!=i&&(e=null!=e?e.intersection(i):i);const r=this._get("dataExtent");return null!=e&&e.equals(r)?r:e}get _groundAndLayersExtent(){const e=this.spatialReference||z.WGS84;let t;const i=i=>{const r=bt(i,e);null!=r&&(null!=t?t.union(r):t=r.clone())},{basemapTerrain:r}=this;if(r?.spatialReference){const e=r.groundExtent;i(new D({xmin:e[0],ymin:e[1],zmin:0,xmax:e[2],ymax:e[3],zmax:0,spatialReference:r.spatialReference}))}const s=e=>{null==e.fullExtent||"graphics"===e.type&&e.internal||i(e.fullExtent)};if(this.map?.allLayers.forEach(e=>s(e)),null==t)return null;t.hasZ?(t.zmin=Math.min(0,t.zmin??0),t.zmax=Math.max(0,t.zmax??0)):(t.zmin=0,t.zmax=0);const n=this._get("_groundAndLayersExtent");return t.equals(n)?n:t}castEnvironment(e){return e?e instanceof we?e:e instanceof yt?this.environment?.cloneWithWebsceneEnvironment(e)??we.fromWebsceneEnvironment(e):A(we,e):new we}get extent(){return this.stateManager?.extent}set extent(e){this.stateManager&&(this.stateManager.extent=e)}get screenCenter(){return this.stateManager?.screenCenter}get frustum(){return this.stateManager?.frustum}get initialExtentRequired(){return this.stateManager&&!this.stateManager.hasInitialView}get defaultsFromMapSettings(){return{required:{tileInfo:!1,heightModelInfo:!0,extent:!1}}}get interacting(){return this.navigating||(this.toolViewManager?.interacting??!1)}get stationary(){return!this.animation&&!this.resizing&&(this.state?.stationary??!0)}get navigating(){return this.state?.navigating??!1}get scene(){return this.map&&se in this.map?this.map:null}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}get featureTiles(){return this._featureTiles}set qualityProfile(e){Ee.isValidProfile(e)&&(Ee.apply(e,this.qualitySettings),this.stage?.renderView.updateQualitySettings(this.qualitySettings),this._set("qualityProfile",e))}get qualityProfile(){return this._get("qualityProfile")||Ee.getDefaultProfile()}_updateSlice(){null!=this.stage&&(this.stage.renderer.slice=this.slice)}get typeSpecificPreconditionsReady(){return!!this.viewingMode&&!!this.stateManager?.preinit(this.spatialReference)}get resolution(){return null!=this.spatialReference?$(this.scale,this.spatialReference):0}get scale(){return this.stateManager?.scale}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get heightModelInfo(){const e=this.getDefaultHeightModelInfo();return null!=e?U.deriveUnitFromSR(e,this.spatialReference):null}get updating(){if(this.destroying||this.destroyed)return!1;let e=0,t=this.layerViewManager.updating,i=t?this.layerViewManager.updatingRemaining:0;this.allLayerViews.forEach(r=>{if(r.isFulfilled()){if(r.updating){if(t=!0,r.suspended||Be(r))return;++i,e+=r.updatingProgress}}else++i});for(const s of this._updatingObjects)if(null!=s&&s.updating){const t=.1;i+=t,e+=.5*t}for(const s of this._updatingObjectsWithProgress)null!=s&&s.updating&&(++i,e+=s.updatingProgress);const r=!this.stateManager.test.updatingIgnoreRenderState&&this.state.updating;if(t=!!(t||i>0||this.updatingHandles.updating||!this.ready||!this.stationary||r||this._importControllers.size>0||this.inputManager?.updating||this.map?.allLayers?.some(e=>!e.isFulfilled())),t?(this._numUpdating=Math.max(i,this._numUpdating),e+=this._numUpdating-i):this._numUpdating=0,this._numUpdating>0?e/=this._numUpdating:e=t?0:1,this._get("updatingProgress")!==e){const i=performance.now();if(e<1){const t=Math.min((i-this._lastUpdateTime)/2e3,1);e=this.updatingProgress*(1-t)+e*t}this._set("updatingProgress",e),this._lastUpdateTime=t&&e<1?i:0}return t}get _updatingObjects(){return[this.graphicsView,this.basemapView,this._resourceController,this.stage,this.featureTiles,this.pointsOfInterest,this.environmentManager,this.overlay,this._featureTreeDebugger,this.toolViewManager,this.analysisViewManager]}get _updatingObjectsWithProgress(){return[this.deconflictor,this.labeler,this.basemapTerrain]}get viewingMode(){const e=this._predeterminedViewingMode;if(null!=e)return de(e);const t=this.spatialReference;return t?null!=this.defaultsFromMap?.viewingMode&&t.equals(this.defaultsFromMap.spatialReference)?de(this.defaultsFromMap.viewingMode):ht(t,1)?"global":"local":"global"}set viewingMode(e){this.ready?l.getLogger(this).error("#viewingMode","viewingMode cannot be set once view is ready"):this._overrideIfSome("viewingMode",e)}get viewpoint(){return this.stateManager?.viewpoint}set viewpoint(e){this.stateManager&&(this.stateManager.viewpoint=e)}get visibleArea(){return this.stateManager?.visibleArea}get zoom(){return this.stateManager.zoom}set zoom(e){this.stateManager&&(this.stateManager.zoom=e)}get highlightOptions(){return this.highlights.find(({name:e})=>e===nt)??new at}set highlightOptions(e){for(let t=0;t<this.highlights.length;++t){if(this.highlights.at(t).name===nt)return void this.highlights.items[t].assignFrom(e)}}get resourceController(){return this._resourceController}get quality(){return this._resourceController?.memoryController?.memoryFactor??1}get resolutionScale(){return Math.sqrt(Math.min(1,this.quality/.75))}get performanceInfo(){return new Ge(this)}on(e,t,i,r){const s=this.viewEvents.on(e,t,i,r);return s||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}toMap(e,t){if(!this.ready)return l.getLogger(this).error("#toMap()","Scene view cannot be used before it is ready"),null;const i=lt(e)?pt(this,e):e;return Le(this,i,t,this._defaultToMapOptions)}toScreen(e){if(!this.ready)return l.getLogger(this).error("#toScreen()","Scene view cannot be used before it is ready"),null;const t=(null==e.z?He(this.elevationProvider,e):null)??0;return N(e,Mt,this.renderSpatialReference,t),this.state.camera.projectToScreen(Mt,St),V(St[0],St[1])}pixelSizeAt(e,t){if(!this.ready)return l.getLogger(this).error("#pixelSizeAt()","Scene view cannot be used before it is ready"),null;if(!e)return 0;const i=this.renderSpatialReference;N(e,Mt,i);const r=this.state.camera.computeScreenPixelSizeAt(Mt);return t&&i!==t?r*C(i)/C(t):r}overlayPixelSizeInMapUnits(e){const t=this.basemapTerrain.overlayManager;return t?t.overlayPixelSizeInMapUnits(e,()=>this.pixelSizeAt(e)):1}hitTest(e,t){if(!this.ready)return l.getLogger(this).error("#hitTest()","Scene view cannot be used before it is ready"),null;const i=lt(e)?pt(this,e):e;return Ie(this,i,t,this._defaultHitTestOptions)}async popupHitTest(e){return Pe(this,e)}goTo(e,t){return this.updatingHandles.addPromise(this.stateManager.goTo(e,t))}async whenAnalysisView(e){if(null==e.parent)throw new n("view:no-analysisview-for-analysis","The analysis has not been added to view.analyses",{analysis:e});switch(e.parent.type){case"line-of-sight":case"dimension":case"viewshed":return(await this.whenLayerView(e.parent)).whenAnalysisView();default:return this.analysisViewManager.whenAnalysisView(e)}}whenLayerView(e){return super.whenLayerView(e)}async takeScreenshot(e){const t=await this._completeSettings(e);await this.whenReady();const i=(await this.stage.renderView.takeScreenshot(t))[0];return(await import("./support/screenshotUtils.js")).encode(i,t,this._pixelFormat())}async _takeScreenshot(e){const t=await this._completeSettings(e);await this.whenReady();const i=(await this.stage.renderView.takeScreenshot(t))[0];return(await import("./support/screenshotUtils.js")).encodeData(i,this._pixelFormat())}async _takeScreenshotWithObjectAndLayerId(e){const t=await this._completeSettings(e);t.olidColor=!0,await this.whenReady();const i=await this.stage.renderView.takeScreenshot(t),{encodeData:r}=await import("./support/screenshotUtils.js");return[r(i[0],this._pixelFormat()),r(i[1],this._pixelFormat())]}async _completeSettings(e){const{toRenderSettings:t,screenshotSuperSampleSettings:i}=await import("./support/screenshotUtils.js"),r=t(e,this);return r.pixelRatio/=this.state.pixelRatio,i(r,this.supersampleScreenshotsEnabled,this.padding)}_pixelFormat(){return{flipY:!0,premultipliedAlpha:this.stage?.renderView.getAlpha()??!1}}get test(){}async takeScreenshotWithObjectAndLayerId(e){if(!Je())throw new n("360vr:objectAndLayerId-rendering-disabled","has enable-feature:objectAndLayerId-rendering must be true");const{encode:t}=await import("./support/screenshotUtils.js"),i=await this._completeSettings(e);i.olidColor=!0,await this.whenReady();const r=await this.stage.renderView.takeScreenshot(i),s=t(r[0],i,this._pixelFormat()),a=await this._completeSettings(e);a.format="png";return[s,t(r[1],a,this._pixelFormat())]}getColorToObjectAndLayerIdMapping(){const e=this.stage.renderView.olidRenderHelper;if(e)return e.getColorToObjectAndLayerIdMapping();throw new n("360vr:objectAndLayerId-rendering-disabled","has enable-feature:objectAndLayerId-rendering must be true")}addUpdatingPromise(e){return this.updatingHandles.addPromise(e)}importLayerView(e){return ge.importLayerView(e)}hasLayerViewModule(e){return ge.hasLayerViewModule(e)}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.scene?.initialViewProperties?.spatialReference||this.defaultsFromMap?.spatialReference||this.defaultsFromMap?.ready&&this._initialDefaultSpatialReference||null}async validate(){let e=ct(this.type);const t=has("safari");if(t&&t<9&&(e=new n("sceneview:browser-not-supported","This browser is not supported by SceneView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:t})),null!=e)throw l.getLogger(this).warn("#validate()",e.message),e}get _predeterminedViewingMode(){const e=this._isOverridden("viewingMode")?this._get("viewingMode"):this.scene?.initialViewProperties?.viewingMode;return null!=e?ue(e):null}getSpatialReferenceSupport(e,t){const i=this._predeterminedViewingMode;if(null!=i)return this._validateSpatialReferenceForViewingMode(e,t,i)?{constraints:this._makeSpatialReferenceConstraints(e,t,i)}:null;const r=this._validateSpatialReferenceForViewingMode(e,t,2),s=this._validateSpatialReferenceForViewingMode(e,t,1);return r||s?r&&s?{constraints:this._makeSpatialReferenceConstraints(e,t,null)}:r?{constraints:this._makeSpatialReferenceConstraints(e,t,2)}:{constraints:this._makeSpatialReferenceConstraints(e,t,1)}:null}_validateSpatialReferenceForViewingMode(e,t,i){return!!ht(e,i)&&(null==t||(!!J(t)||(!K(t)||null!=Ne(t,e,i))&&(!X(t)||1!==i)))}_makeSpatialReferenceConstraints(e,t,i){if(null==t)return[{spatialReference:e,viewingMode:i}];const{isWebMercator:r,isWGS84:s}=e;if(J(t)&&(r||s)){return!s||2===i||null===Qe(t.tileInfo,t.fullExtent,e,1)?[{spatialReference:e,viewingMode:i},{spatialReference:z.WebMercator,viewingMode:i}]:[{spatialReference:r?z.WGS84:z.WebMercator,viewingMode:i}]}return K(t)||X(t)||!r&&!s?K(t)&&r&&1!==i?[{spatialReference:e,viewingMode:i},{spatialReference:z.WGS84,viewingMode:2}]:[{spatialReference:e,viewingMode:i}]:[{spatialReference:e,viewingMode:i},{spatialReference:r?z.WGS84:z.WebMercator,viewingMode:i}]}_validateSpatialReference(e){const t=null!=this.getSpatialReferenceSupport(e),i=this._predeterminedViewingMode;return t||(null!=i?l.getLogger(this).warnOnce(`Spatial reference defined on view not supported in ${de(i)} viewing mode.`):e.isGeographic&&l.getLogger(this).warnOnce("Spatial reference is geographic but not supported.")),t}whenReady(){return new Promise(e=>{this.ready?e(this):this._resolveWhenReady.push(e)})}trackGraphicState(e){if(!e.graphic)return l.getLogger(this).error("trackGraphicState","GraphicState.graphic must not be null or undefined to start tracking"),null;const t=this.getViewForGraphic(e.graphic);let i=null,r=!1;const s=t=>{!r&&null!=t&&"processor"in t&&"graphics-3d"===t.processor?.type&&t.processor.graphicsCore&&(i=t.processor.graphicsCore.trackGraphicState(e))};return null!=t?s(t):this.whenViewForGraphic(e.graphic,{waitForLayer:!0}).then(e=>s(e),()=>{}).catch(()=>{}),o(()=>{r=!0,null!=i&&(i.remove(),i=null)})}maskOccludee(e){if(!e)return l.getLogger(this).error("maskOccludee","GraphicState.graphic must not be null or undefined to mask an occludee"),null;const t=this.getViewForGraphic(e);let i=null,r=!1;const s=t=>{!r&&null!=t&&ot(t)&&(i=t.maskOccludee(e))};return null!=t?s(t):this.whenViewForGraphic(e,{waitForLayer:!0}).then(e=>s(e),()=>{}).catch(()=>{}),o(()=>{r=!0,null!=i&&(i.remove(),i=null)})}getViewForGraphic(e){return e.layer===this?this.graphicsView:e.layer?this.allLayerViews.filter(e=>"media-3d"!==e.type).find(t=>t.layer===e.layer):null}graphicChanged(e){null!=this.graphicsView&&this.graphicsView.graphicChanged(e)}async whenViewForGraphic(e,t){return e.layer===this?(await v(()=>this.graphicsView),this.graphicsView):e.layer&&this.map?t&&t.waitForLayer&&!this.map.allLayers.includes(e.layer)?new Promise((t,i)=>{const r=this.map.allLayers.on("change",s=>{s.added.includes(e.layer)&&(r.remove(),this.whenLayerView(e.layer).then(t,i))})}):this.whenLayerView(e.layer):null}enableFeatureTiles(){const e=Symbol();return this._featureTileTreeClients.add(e),o(()=>this._featureTileTreeClients.delete(e))}async _importModule(e,t){const i=new AbortController;this._importControllers.set(e,i),this._updatingChanged();try{const r=await jt[e]();if(t&&(d(this),u(i.signal),await t(i.signal)),this.destroyed)throw c();return u(i.signal),r}catch{return null}finally{this._importControllers.delete(e),this._updatingChanged()}}_abortImport(e){this._importControllers.get(e)?.abort(),this._importControllers.delete(e),this._updatingChanged()}_initBasemapTerrain(){this._set("basemapTerrain",new ke({view:this})),this._set("elevationProvider",new Oe({view:this})),this.elevationProvider.register("ground",this.basemapTerrain)}_exitBasemapTerrain(){const{basemapTerrain:e,elevationProvider:t}=this;e&&(this._set("basemapTerrain",null),this._set("elevationProvider",null),t.unregister(e),t.destroy(),e.destroy())}_initGlobe(){this._initCoordinateSystem(),this.state.createInitialCamera(),this._initBasemapTerrain(),this._set("pointsOfInterest",new ze({view:this})),this.addHandles([this.updatingHandles.add(()=>Ae.FEATURE_TILE_TREE_SHOW_TILES,e=>{e&&!this._featureTreeDebugger?this.updatingHandles.addPromise(import("./3d/layers/support/FeatureTileTree3DDebugger.js")).then(({FeatureTileTree3DDebugger:e})=>{!this._featureTreeDebugger&&Ae.FEATURE_TILE_TREE_SHOW_TILES&&(this._featureTreeDebugger=new e({view:this}))}):e||(this._featureTreeDebugger=p(this._featureTreeDebugger))},_),this.updatingHandles.add(()=>({basemapExtent:this.basemapTerrain?.extent,basemapSpatialReference:this.basemapTerrain?.spatialReference,clippingArea:this.clippingArea,featureTiles:this._featureTiles}),({basemapExtent:e,basemapSpatialReference:t,clippingArea:i,featureTiles:r})=>{if(!r)return;const s=!!e;if(i||s)if(s&&t){const s=e&&t?W(Q(e,t),this.spatialReference):null;r.filterExtent=i?i.intersection(s):s}else r.filterExtent=i;else r.filterExtent=null},_),this.updatingHandles.add(()=>this._featureTileTreeClients.size>0,e=>{e?this._ensureFeatureTileTree():this._featureTiles=p(this._featureTiles)},w)],wt),this.stateManager.init()}async _ensureFeatureTileTree(){if(this._featureTiles||this._importControllers.has("FeatureTileTree3D"))return;const e=(await this.updatingHandles.addPromise(this._importModule("FeatureTileTree3D")))?.FeatureTileTree3D;e&&(this._featureTiles=new e({renderCoordsHelper:this.renderCoordsHelper,pointsOfInterest:this.pointsOfInterest,viewState:this.state,scheduler:this._resourceController.scheduler,terrain:this.basemapTerrain}),this._updatingChanged())}_exitTerrain(){this.stateManager.exit(),this.removeHandles(vt),this.removeHandles(wt),this._featureTiles=p(this.featureTiles),this._set("pointsOfInterest",p(this.pointsOfInterest)),this._exitBasemapTerrain(),this.state.reset(),this._exitCoordinateSystem()}_initCoordinateSystem(){if(this.spatialReference){const e=this.spatialReference,t=this.state.isGlobal,i=Z(t,e);i!==this.renderSpatialReference&&(this._set("renderCoordsHelper",De.create(this.state.viewingMode,i)),t||this.addHandles(y(()=>this.basemapTerrain?.extent,e=>{const t=this.renderCoordsHelper.spatialReference;null==e||0===e[0]&&0===e[1]&&0===e[2]&&0===e[3]||!B(e,this.basemapTerrain.spatialReference,Vt,t)||(this.renderCoordsHelper.extent=Vt)},w),vt),this.sceneIntersectionHelper&&this.sceneIntersectionHelper.setTolerance(Xe/this.renderCoordsHelper.unitInMeters))}else this._set("renderCoordsHelper",null)}_exitCoordinateSystem(){this.removeHandles(vt),this._set("renderCoordsHelper",null)}_updatingChanged(){this.notifyChange("updating")}_updateUpdatingMonitors(e=null){null!=e&&4===e.type||(this.removeHandles("updatingMonitors"),this.allLayerViews.forEach(e=>{e.destroyed||(this.addHandles(y(()=>[e.updating,e.updatingProgress],()=>this._updatingChanged(),w),"updatingMonitors"),e.when(()=>this._updatingChanged(),()=>this._updatingChanged()))}),this._updatingChanged())}async _prepareScreenshotOverlay(){this.overlay&&await this.overlay.prepare()}_renderScreenshotOverlay(e,t,i){if(!this.overlay||!this.overlay.hasVisibleItems)return i;const r=e.getContext("2d",{willReadFrequently:!0});return r.putImageData(i,0,0),this.overlay.renderCanvas(e,{disableDecorations:t}),r.getImageData(0,0,i.width,i.height)}_initStage(){const e={deactivatedWebGLExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions,alpha:this.alphaCompositingEnabled,preserveDrawingBuffer:this.preserveDrawingBufferEnabled,canvas:this.renderCanvas,screenshot:{prepareOverlay:()=>this._prepareScreenshotOverlay(),renderOverlay:(e,t,i)=>this._renderScreenshotOverlay(e,t,i)}},t=new Re(this.state.viewingMode,e=>this.stage.layers.forEach(e),this);this._set("sceneIntersectionHelper",t);const i=s(this.surface);this._stage=new $e({view:this,options:e,container:i}),this.notifyChange("stage"),this._updateSlice(),this.addHandles([this.updatingHandles.add(()=>this.qualitySettings.highQualityTransparency,e=>this.stage.renderer.setParameters({highQualityTransparency:e}),f),this.on("pointer-move",()=>this.stage?.renderer.resetAnimation()),a(this.stage.renderView.canvas,"webglcontextlost",e=>{this.fatalError=new n("webgl-context-lost",e.statusMessage)})],"stage"),this.renderCoordsHelper&&this.sceneIntersectionHelper.setTolerance(Xe/this.renderCoordsHelper.unitInMeters),this._set("canvas",this.stage.renderView.canvas)}_exitStage(){this.sceneIntersectionHelper?.destroy(),this._set("sceneIntersectionHelper",null),this._stage=p(this.stage),this._set("stage",null),this.removeHandles("stage"),this._set("canvas",null)}_initSurface(e){this._exitSurface(),this._initStage(),this._initGlobe(),this.sharedSymbolResources=new We({view:this,viewingMode:e,resourceController:this._resourceController,pointsOfInterest:this.pointsOfInterest,viewState:this.state})}_exitSurface(){this.sharedSymbolResources&&(this.sharedSymbolResources.objectResourceCache.destroy(),this.sharedSymbolResources.destroy(),this.sharedSymbolResources=null,this._exitTerrain(),this._exitStage())}async _ensureGraphicsView(){if(this.graphicsView||this._importControllers.has("GraphicsView3D")||0===this.graphics.length)return;this.removeHandles("GraphicsView3D");const e=(await this.updatingHandles.addPromise(this._importModule("GraphicsView3D",e=>v(()=>this.basemapTerrain?.ready,e))))?.default;e&&this._set("graphicsView",new e({view:this,getGraphics:()=>this.graphics})),this._updatingChanged()}_disposeGraphicsView(){this._abortImport("GraphicsView3D"),this.removeHandles("GraphicsView3D"),this.graphicsView&&(this.removeHandles(this.graphicsView.processor.layer.id),this.graphicsView.destroy(),this._set("graphicsView",null))}_disposeFocusAreasView(){this._abortImport("FocusAreasView"),this.removeHandles("FocusAreasView"),this.focusAreasView=p(this.focusAreasView)}async _ensureFocusAreasView(e){if(this.focusAreasView||this._importControllers.has("FocusAreasView")||0===e)return;this.removeHandles("FocusAreasView");const t=(await this.updatingHandles.addPromise(this._importModule("FocusAreasView")))?.FocusAreasView;t&&(this.focusAreasView=new t({view:this})),this._updatingChanged()}_startup(){const e=ue(this.viewingMode);1===e&&(this._clippingArea=null),this._initSurface(e),this._set("ready",!0),this.addHandles(m(()=>this.graphics,"after-changes",()=>this._ensureGraphicsView()),"GraphicsView3D"),this._ensureGraphicsView(),this.addHandles(y(()=>this.map?.focusAreas?.areas.length??0,e=>this._ensureFocusAreasView(e),{initial:!0}),"FocusAreasView");const t=this.scene?.initialViewProperties??null,i=t?.environment;i&&(this._overrideDefaultEnvironmentOnly?H(this.environment,i):this.environment=this.environment.cloneWithWebsceneEnvironment(i)),this.timeExtent=t?.timeExtent,t?.analyses.applyTo(this),this.labeler.setup(),this.environmentManager.connectView(this),this.inputManager.connect();const r=this._resolveWhenReady;this._resolveWhenReady=[],r.forEach(e=>e(this))}_teardown(){this._initialDefaultSpatialReference=null,this.inputManager.disconnect(),this.environmentManager.disconnectView(),this._overrideDefaultEnvironmentOnly=!1,this.labeler.dispose(),this._disposeGraphicsView(),this._disposeFocusAreasView(),this._exitSurface(),this._set("ready",!1)}get _defaultToMapOptions(){const e={include:new Set};if(!this.map)return e;this.map.ground&&e.include.add(tt);for(const t of this.allLayerViews)ee(t.layer.type)&&e.include.add(t.uid);return e}get _defaultHitTestOptions(){const e={exclude:new Set};if(!this.map)return e;this.map.ground&&this.map.ground.opacity<1&&e.exclude.add(tt);for(const t of this.allLayerViews)ee(t.layer.type)&&t.layer.opacity<1&&e.exclude.add(t.uid);return e}static{this.type="3d"}static clearStatics(){ft(),L(),j(),it(),Ce(),me(),Se(),k(),st(),ie(),Ze(),et(),Te(),xe(),P(),M(),Ke(),Ye(),Me.cleanupI3SLodHandling(),te.cleanupTilemapCache(),Ve.cleanupViewstate(),ke.cleanupTerrainSurface()}};function bt(e,t){return null!=e&&q(e.spatialReference,t)?W(e,t):null}e([R()],_t.prototype,"_userClippingArea",void 0),e([R()],_t.prototype,"_resourceController",void 0),e([R()],_t.prototype,"stage",null),e([R({readOnly:!0})],_t.prototype,"deconflictor",void 0),e([R({readOnly:!0})],_t.prototype,"labeler",void 0),e([R(F(re,"analyses"))],_t.prototype,"analyses",void 0),e([R({type:he,readOnly:!0})],_t.prototype,"animation",null),e([R({readOnly:!0})],_t.prototype,"basemapTerrain",void 0),e([R({readOnly:!0})],_t.prototype,"elevationProvider",void 0),e([R()],_t.prototype,"camera",null),e([R({type:t})],_t.prototype,"contentCamera",null),e([R({readOnly:!0})],_t.prototype,"canvas",null),e([R({type:G})],_t.prototype,"center",null),e([R({type:D})],_t.prototype,"clippingArea",null),e([R({type:ye})],_t.prototype,"constraints",void 0),e([R({type:D,readOnly:!0})],_t.prototype,"renderDataExtent",null),e([R({readOnly:!0})],_t.prototype,"tileInfo",null),e([R({type:D,readOnly:!0})],_t.prototype,"dataExtent",null),e([R({type:D,readOnly:!0})],_t.prototype,"_groundAndLayersExtent",null),e([R({type:we})],_t.prototype,"environment",void 0),e([x("environment")],_t.prototype,"castEnvironment",null),e([R({readOnly:!0})],_t.prototype,"environmentManager",void 0),e([R({type:D})],_t.prototype,"extent",null),e([R({type:r})],_t.prototype,"floors",void 0),e([R()],_t.prototype,"screenCenter",null),e([R()],_t.prototype,"frustum",null),e([R({type:Number,readOnly:!0})],_t.prototype,"fullOpacity",void 0),e([R({readOnly:!0})],_t.prototype,"graphicsView",void 0),e([R()],_t.prototype,"analysisViewManager",void 0),e([R()],_t.prototype,"groundView",void 0),e([R({type:Boolean})],_t.prototype,"initialExtentRequired",null),e([R()],_t.prototype,"defaultsFromMapSettings",null),e([R()],_t.prototype,"interacting",null),e([R()],_t.prototype,"stationary",null),e([R()],_t.prototype,"navigating",null),e([R()],_t.prototype,"map",void 0),e([R()],_t.prototype,"padding",null),e([R({type:ze,readOnly:!0})],_t.prototype,"pointsOfInterest",void 0),e([R()],_t.prototype,"_featureTiles",void 0),e([R()],_t.prototype,"featureTiles",null),e([R()],_t.prototype,"_featureTreeDebugger",void 0),e([R({type:Boolean})],_t.prototype,"screenSizePerspectiveEnabled",void 0),e([R({constructOnly:!0})],_t.prototype,"deactivatedWebGLExtensions",void 0),e([R({constructOnly:!0})],_t.prototype,"debugWebGLExtensions",void 0),e([R({constructOnly:!0})],_t.prototype,"renderCanvas",void 0),e([R({constructOnly:!0})],_t.prototype,"state",void 0),e([R({readOnly:!0})],_t.prototype,"inputManager",void 0),e([R({readOnly:!0})],_t.prototype,"stateManager",void 0),e([R({type:["low","medium","high"]})],_t.prototype,"qualityProfile",null),e([R({type:Fe,get(){let e=this._get("qualitySettings");return e||(e=new Fe,Ee.apply(this.qualityProfile,e)),e}})],_t.prototype,"qualitySettings",void 0),e([R()],_t.prototype,"slice",void 0),e([R({readOnly:!0})],_t.prototype,"typeSpecificPreconditionsReady",null),e([R({readOnly:!0})],_t.prototype,"renderCoordsHelper",void 0),e([R({readOnly:!0})],_t.prototype,"sceneIntersectionHelper",void 0),e([R({type:Number,dependsOn:["scale","spatialReference"],readOnly:!0})],_t.prototype,"resolution",null),e([R({type:Number})],_t.prototype,"scale",null),e([R()],_t.prototype,"heightModelInfo",null),e([R()],_t.prototype,"spatialReference",void 0),e([R({type:Boolean,constructOnly:!0})],_t.prototype,"alphaCompositingEnabled",void 0),e([R({constructOnly:!0})],_t.prototype,"preserveDrawingBufferEnabled",void 0),e([R({type:Boolean})],_t.prototype,"supersampleScreenshotsEnabled",void 0),e([R({readOnly:!0})],_t.prototype,"type",void 0),e([R(),x(e=>e instanceof gt?e:E(mt,e))],_t.prototype,"ui",void 0),e([R({type:Boolean,readOnly:!0,dependsOn:["graphicsView.updating","basemapView.updating","basemapTerrain.updating","layerViewManager.updating","layerViewManager.updatingRemaining","_resourceController.updating","stage.updating","featureTiles.updating","pointsOfInterest.updating","environmentManager.updating","overlay.updating","updatingHandles.updating","featureTreeDebugger.updating","labeler.updating","deconflictor.updating","ready","stationary","inputManager.updating","toolViewManager.updating","analysisViewManager.updating","state.updating","textures.updating"]})],_t.prototype,"updating",null),e([R()],_t.prototype,"_updatingObjects",null),e([R()],_t.prototype,"_updatingObjectsWithProgress",null),e([R({type:Number,readOnly:!0,dependsOn:["updating"]})],_t.prototype,"updatingProgress",void 0),e([R({type:["global","local"]})],_t.prototype,"viewingMode",null),e([R({type:i})],_t.prototype,"viewpoint",null),e([R({readOnly:!0})],_t.prototype,"visibleArea",null),e([R({type:Number})],_t.prototype,"zoom",null),e([R({type:at})],_t.prototype,"highlightOptions",null),e([R({readOnly:!0})],_t.prototype,"quality",null),e([R({readOnly:!0})],_t.prototype,"resolutionScale",null),e([R()],_t.prototype,"focusAreasView",void 0),e([R()],_t.prototype,"_defaultToMapOptions",null),e([R()],_t.prototype,"_defaultHitTestOptions",null),_t=e([O("esri.views.SceneView")],_t);const Mt=I(),St=S(),Vt=Y(),jt={GraphicsView3D:()=>import("./3d/layers/GraphicsView3D.js"),FocusAreasView:()=>import("./3d/FocusAreasView.js"),FeatureTileTree3D:()=>import("./3d/layers/support/FeatureTileTree3D.js")},Ct=_t;export{Ct as default};
|
package/views/ToolViewManager.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 o from"../core/Accessor.js";import{clock as e}from"../core/clock.js";import i from"../core/Collection.js";import"../core/has.js";import a from"../core/Logger.js";import{removeMaybe as
|
|
5
|
+
import{__decorate as t}from"tslib";import o from"../core/Accessor.js";import{clock as e}from"../core/clock.js";import i from"../core/Collection.js";import"../core/has.js";import a from"../core/Logger.js";import{removeMaybe as s}from"../core/maybe.js";import{watch as n}from"../core/reactiveUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/RandomLCG.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as c}from"../core/support/UpdatingHandles.js";import{ViewEventPriorities as h}from"./input/InputManager.js";import{eventTypes as u}from"./input/ViewEvents.js";import{getToolCollectionHandles as p,areToolManipulatorsEditable as m,isCancelEvent as v}from"./interactive/interactiveToolUtils.js";import{ToolViewManagerManipulatorState as d}from"./interactive/ToolViewManagerManipulatorState.js";const g="attached",_="tools",T=1e3;let f=class extends o{constructor(t){super(t),this._updatingHandles=new c,this._clock=e,this._manipulatorState=new d,this.tools=new i,this._interacting=!1,this._interactingTimeout=T,this._interactingTimeoutHandle=null}initialize(){this.addHandles([this.view.on(u,t=>{this._handleInputEvent(t)},h.TOOL),...p(this.tools),this.tools.on("before-add",({item:t})=>{this._updateToolEditableFlag(t)}),this.tools.on("before-remove",({item:t})=>{this._manipulatorState.clearPointers(t,this._manipulatorStateEventArgs)}),this.tools.on("change",()=>{this._refreshToolWatchers()})])}destroy(){this.activeTool=null,this.tools.drain(t=>t.destroy()),this._clearInteractingTimeout(),this._interacting=!1,this._updatingHandles.destroy(),this._manipulatorState.destroy()}get _manipulatorStateEventArgs(){return{tools:this.tools,activeTool:this.activeTool,setActiveTool:t=>{this.activeTool=t},view:this.view}}set activeTool(t){if(null!=t&&!this.view.ready)return void a.getLogger(this).error("Cannot set active tool while view is not ready.");if(t===this.activeTool)return;const o=this.activeTool;this._set("activeTool",t),null!=o&&o.deactivate(),null!=t&&t.activate(),this._removeIncompleteTools(t);for(const e of this.tools){this._updateToolEditableFlag(e);const t=m(e);null!=this.activeTool&&t||this._manipulatorState.clearPointers(e,this._manipulatorStateEventArgs,!t)}}get cursor(){const t=this._manipulatorState.cursor;if(null!=t)return t;for(const o of this.tools)if(o.visible&&null!=o.cursor)return o.cursor;return null}get updating(){return this._updatingHandles.updating||this.tools.some(t=>t.updating)}get interacting(){return this._interacting}_clearInteractingTimeout(){this._interactingTimeoutHandle=s(this._interactingTimeoutHandle)}_startInteractingTimeout(){this._clearInteractingTimeout(),this._interactingTimeoutHandle=this._clock.setTimeout(()=>this._interacting=!1,this._interactingTimeout)}attach(){"3d"===this.view.type?this.addHandles([n(()=>{const{state:t}=this.view;return"camera"in t&&t.camera},()=>this._forEachManipulator(t=>t.onViewChange())),this.view.elevationProvider?.on("elevation-change",t=>this._forEachManipulator(o=>o.onElevationChange(t)))],g):this.addHandles(n(()=>this.view.extent,()=>this._forEachManipulator(t=>t.onViewChange())))}detach(){this.activeTool=null,this.tools.removeAll(),this.removeHandles(g),this._clearInteractingTimeout(),this._interacting=!1}_forEachManipulator(t){for(const o of this.tools)o.manipulators&&o.manipulators.forEach(({manipulator:e})=>t(e,o))}_handleInputEvent(t){let o=!1;const e={...t,stopPropagation:()=>{o=!0,t.stopPropagation()}};if(null!=this.activeTool)this.activeTool.handleInputEvent&&this.activeTool.handleInputEvent(e);else for(const i of this.tools)!o&&i.visible&&i.handleInputEvent(e);!o&&v(t)&&this.activeTool&&(t.stopPropagation(),t.preventDefault(),this.activeTool.cancel(),this.activeTool=null),this._manipulatorState.handleInputEvent(e,this._manipulatorStateEventArgs),o||null==this.activeTool||this.activeTool.handleInputEventAfter(e),this._manipulatorState.handleHoverEvent(e,this.tools),"pointer-move"===t.type&&(this._manipulatorState.hasFocusedManipulators||this.activeTool)&&(this._interacting=!0,this._startInteractingTimeout())}_refreshToolWatchers(){this.removeHandles(_);for(const t of this.tools){if(t instanceof o){const o=n(()=>[t.cursor,t.visible,t.editable],()=>{m(t)||this._manipulatorState.clearPointers(t,this._manipulatorStateEventArgs)});this.addHandles(o,_)}t.manipulators&&this.addHandles([t.manipulators.on("after-remove",o=>{this._manipulatorState.clearPointers(t,this._manipulatorStateEventArgs,!0,o.item.manipulator)}),t.manipulators.on("change",()=>{this._manipulatorState.updateHoveredStateFromKnownPointers(this.tools)})],_)}this._manipulatorState.updateHoveredStateFromKnownPointers(this.tools)}_updateToolEditableFlag(t){t.setEditableFlag?.(1,null==this.activeTool||t===this.activeTool)}_removeIncompleteTools(t){this.tools.filter(o=>(null==t||o!==t)&&!o.created&&o.removeIncompleteOnCancel).forEach(t=>{this.tools.remove(t)})}get test(){}};t([r({constructOnly:!0,nonNullable:!0})],f.prototype,"view",void 0),t([r({value:null})],f.prototype,"activeTool",null),t([r({readOnly:!0,type:i})],f.prototype,"tools",void 0),t([r()],f.prototype,"cursor",null),t([r({readOnly:!0})],f.prototype,"updating",null),t([r()],f.prototype,"_interacting",void 0),t([r({readOnly:!0})],f.prototype,"interacting",null),f=t([l("esri.views.ToolViewManager")],f);export{f as ToolViewManager,T as interactingTimeout};
|
package/views/View.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 e}from"tslib";import t from"../Map.js";import{createTask as i}from"../core/asyncUtils.js";import r from"../core/Collection.js";import s from"../core/CollectionFlattener.js";import{referenceSetter as a}from"../core/collectionUtils.js";import o from"../core/Error.js";import{EventedMixin as n}from"../core/Evented.js";import l from"../core/Handles.js";import{makeHandle as p}from"../core/handleUtils.js";import has from"../core/has.js";import{isLoadable as h}from"../core/Loadable.js";import d from"../core/Logger.js";import{destroyMaybe as y,abortMaybe as u}from"../core/maybe.js";import{EsriPromise as m}from"../core/Promise.js";import{after as c}from"../core/promiseUtils.js";import{watch as g,sync as f,whenOnce as w,when as v,syncAndInitial as _}from"../core/reactiveUtils.js";import{property as V}from"../core/accessorSupport/decorators/property.js";import"../core/RandomLCG.js";import{subclass as M}from"../core/accessorSupport/decorators/subclass.js";import{owningCollectionProperty as R}from"../core/support/OwningCollection.js";import{UpdatingHandles as S}from"../core/support/UpdatingHandles.js";import T from"../geometry/Extent.js";import j from"../geometry/HeightModelInfo.js";import F from"../geometry/SpatialReference.js";import{equals as E}from"../geometry/support/spatialReferenceUtils.js";import{AnalysesCollection as k}from"../support/AnalysesCollection.js";import{GraphicsCollection as x}from"../support/GraphicsCollection.js";import{system as b}from"../time/constants.js";import{T as O}from"../chunks/TimeExtent.js";import{isTimeZoneValid as C}from"../time/timeZoneUtils.js";import L from"./BasemapView.js";import H from"./Magnifier.js";import P from"./SelectionManager.js";import Z from"./Theme.js";import{ToolViewManager as I}from"./ToolViewManager.js";import{makeDefaultHighlightOptions as W}from"./3d/support/DefaultHighlights.js";import q from"./input/Input.js";import{ViewEvents as D}from"./input/ViewEvents.js";import U from"./navigation/Navigation.js";import{DefaultsFromMap as z}from"./support/DefaultsFromMap.js";import A from"./support/HighlightOptions.js";import G from"./support/LayerViewManager.js";import N from"./support/RequiredFieldsOptions.js";var $;let B=class extends(n(m)){static{$=this}constructor(e){super(e),this._userSpatialReference=null,this.handles=new l,this.updatingHandles=new S,this.allLayerViews=new s({getCollections:()=>[this.basemapView?.baseLayerViews,this.basemapView?.groundLayerViews,this.groundView?.layerViews,this.layerViews,this.basemapView?.referenceLayerViews],getChildrenFunction:Q}),this.analyses=new k,this.basemapView=null,this.displayFilterEnabled=!0,this.fatalError=null,this.graphics=new x,this.groundView=null,this.typeSpecificPreconditionsReady=!0,this.layerViews=new r,this.magnifier=new H,this.padding={left:0,top:0,right:0,bottom:0},this.ready=!1,this._readyStateWaitingTask=null,this.supportsGround=!0,this.type=null,this.scale=null,this.updating=!1,this.initialExtentRequired=!0,this._lowPriorityCursorHandles=new r,this._highPriorityCursorHandles=new r,this.input=new q,this.navigation=new U,this.layerViewManager=null,this.analysisViewManager=null,this.isHeightModelInfoRequired=!1,this.width=null,this.height=null,this.resizing=!1,this.suspended=!1,this.viewEvents=new D(this),this.persistableViewModels=new r,this.requiredFieldsOptions=new N,this._isValid=!1,this._readyCycleForced=!1,this._lockedSpatialReference=null,this._userTimeZone=null,this._lockedTimeZone=null,this._userTimeExtent=null,this._lockedTimeExtent=null,this.theme=null,this.handles.add(g(()=>this.preconditionsReady,e=>{const t=this.ready;if(e?(this._lockedSpatialReference=this.spatialReference,this._lockedTimeZone=this.timeZone,this._lockedTimeExtent=this.timeExtent,$.views.add(this)):(this._lockedSpatialReference=null,$.views.remove(this)),this.notifyChange("spatialReference"),!e&&t)this.toolViewManager?.detach(),null!=this.analysisViewManager&&this.analysisViewManager.detach(),this.layerViewManager?.clear(),this._teardown();else if(e&&!t){try{this._startup()}catch(i){return void queueMicrotask(()=>{this.fatalError=new o("view:startup-error","View._startup failed",i)})}null!=this.analysisViewManager&&this.analysisViewManager.attach(),this.toolViewManager.attach()}},f))}initialize(){this.addResolvingPromise(Promise.all([this.loadAsyncDependencies(),this.validate()]).then(()=>(this._isValid=!0,w(()=>this.ready)))),this.basemapView=new L({view:this}),this.layerViewManager=new G({view:this,layerViewFilter:e=>this.layerViewFilter?.(e)??!0,layerViewImporter:{importLayerView:e=>this.importLayerView(e),hasLayerViewModule:e=>this.hasLayerViewModule(e)},supportsGround:this.supportsGround}),this.toolViewManager=new I({view:this}),this.selectionManager=new P({view:this}),this.addHandles([v(()=>"map-content-error"===this.readyState&&!this.spatialReference,()=>{d.getLogger(this).warn("#spatialReference","no spatial reference could be derived from the currently added map layers")}),g(()=>this.initialExtentRequired,e=>this.defaultsFromMap.required={...this.defaultsFromMap.required,extent:e},_),g(()=>this.ready,e=>{this.defaultsFromMap&&(this.defaultsFromMap.suspended=e,this.defaultsFromMap.userSpatialReference=e?this.spatialReference:this._userSpatialReference)},f),g(()=>this._userSpatialReference,e=>{this.defaultsFromMap&&(this.defaultsFromMap.userSpatialReference=e)},_)])}destroy(){this.destroyed||($.views.remove(this),this.viewEvents.destroy(),this.allLayerViews.destroy(),this.navigation&&(this.navigation.destroy(),this._set("navigation",null)),this.graphics=y(this.graphics),this.analyses=y(this.analyses),this.defaultsFromMap.destroy(),this._set("defaultsFromMap",null),y(this.analysisViewManager),this.toolViewManager=y(this.toolViewManager),this.layerViewManager=y(this.layerViewManager),this.selectionManager=y(this.selectionManager),this.basemapView=y(this.basemapView),this.groundView?.destroy(),this.layerViews?.forEach(e=>e.destroy()),this.layerViews.length=0,this.invalidate(),this.handles.destroy(),this.map=y(this.map),this.updatingHandles.destroy())}_startup(){this._set("ready",!0)}_teardown(){this._set("ready",!1)}whenReady(){return Promise.resolve(this)}toMap(){return d.getLogger(this).error("#toMap()","Not implemented on this instance of View"),null}get activeTool(){return this.toolViewManager?.activeTool}set activeTool(e){this.toolViewManager&&(this.toolViewManager.activeTool=e)}get animation(){return this._get("animation")}set animation(e){this._set("animation",e)}get center(){return null}get defaultsFromMapSettings(){return{}}get defaultsFromMap(){return new z({required:{tileInfo:!1,heightModelInfo:!1,extent:!1},map:()=>this.map,getSpatialReferenceSupport:(e,t)=>this.getSpatialReferenceSupport(e,t),...this.defaultsFromMapSettings})}get extent(){return this._get("extent")}set extent(e){this._set("extent",e)}get heightModelInfo(){return this.getDefaultHeightModelInfo()}get highlights(){return this._get("highlights")??W()}set highlights(e){this._set("highlights",a(e,this._get("highlights"),r.ofType(A)))}get interacting(){return this.navigating}get navigating(){return!1}get preconditionsReady(){return!this.destroying&&!this.destroyed&&!(this.fatalError||!this._isValid||this._readyCycleForced||!this.map||h(this.map)&&!this.map.loaded||0===this.width||0===this.height||!this.spatialReference||!this._validateSpatialReference(this.spatialReference)||!this._lockedSpatialReference&&!this.defaultsFromMap?.ready||!this.typeSpecificPreconditionsReady)}get resolution(){return 0}set map(e){e!==this._get("map")&&(e?.destroyed&&(d.getLogger(this).warn("#map","The provided map is already destroyed",{map:e}),e=null),h(e)&&e.load().catch(()=>{}),this.constructed&&!this.destroyed&&(this.forceReadyCycle(),this._lockedSpatialReference=null),this._set("map",e))}get readyState(){if(this.destroyed)return this._get("readyState");if(!this.map)return"missing-map";if("container"in this&&!this.container)return"missing-container";if(this.fatalError)return"rendering-error";if((this.defaultsFromMap?.ready??!1)&&!this.spatialReference){const e=!("loaded"in this.map)||this.map.loaded,t=this.map.ground.loaded,r=this.map.basemap?.loaded??!0;return e&&r&&t&&!this.map?.allLayers.length?"empty-map":(this._readyStateWaitingTask||(this._readyStateWaitingTask=i(e=>c(has("view-readyState-waiting-delay"),null,e)),this.addHandles(this._readyStateWaitingTask),this.addHandles(this._readyStateWaitingTask,"ready-state-task")),this._readyStateWaitingTask?.finished?"map-content-error":"loading")}return this._readyStateWaitingTask=u(this._readyStateWaitingTask),this.removeHandles("ready-state-task"),this.ready?"ready":"loading"}get spatialReference(){const e=this._userSpatialReference||this._lockedSpatialReference||this.getDefaultSpatialReference()||null;if(e&&this.defaultsFromMap?.required?.heightModelInfo){const t=e.clone();return t.vcsWkid=this.defaultsFromMap.vcsWkid,t.latestVcsWkid=this.defaultsFromMap.latestVcsWkid,t}return e}set spatialReference(e){const t=!E(e,this._get("spatialReference"));this._set("_userSpatialReference",e),t&&(this._set("spatialReference",e),this._spatialReferenceChanged(e))}_spatialReferenceChanged(e){}get stationary(){return!this.animation&&!this.navigating&&!this.resizing}get timeExtent(){return this._userTimeExtent??this._lockedTimeExtent??this.getDefaultTimeExtent()??null}set timeExtent(e){this._userTimeExtent=e}get timeZone(){return this._userTimeZone??this._lockedTimeZone??this.getDefaultTimeZone()??b}set timeZone(e){this._userTimeZone=e,C(e)||d.getLogger(this).warn("#timeZone",`the parsed value '${e}' may not be a valid IANA time zone`)}get tools(){return this.toolViewManager?.tools}get initialExtent(){return this.defaultsFromMap?.extent}get cursor(){return this.toolViewManager?.cursor??this._highPriorityCursorHandles.at(-1)?.cursor??this._lowPriorityCursorHandles.at(-1)?.cursor??"default"}acquireCursor(e,t="low"){const i="high"===t?this._highPriorityCursorHandles:this._lowPriorityCursorHandles,r={cursor:e},s=p(()=>i.remove(r));return i.add(r),this.addHandles(s),s}get size(){return[this.width,this.height]}get effectiveTheme(){return this.theme??new Z}whenLayerView(e){return this.layerViewManager?.whenLayerView(e)??Promise.reject()}getDefaultSpatialReference(){return this.defaultsFromMap?.spatialReference}getDefaultHeightModelInfo(){return(this.map&&"heightModelInfo"in this.map?this.map.heightModelInfo:void 0)??this.defaultsFromMap?.heightModelInfo??null}getDefaultTimeZone(){return null}getDefaultTimeExtent(){return null}importLayerView(e){throw new o("view:importLayerView-missing","importLayerView() not implemented")}hasLayerViewModule(e){return!1}async validate(){}async loadAsyncDependencies(){}invalidate(){this._isValid=!1}getSpatialReferenceSupport(){return{constraints:null}}_validateSpatialReference(e){return null!=this.getSpatialReferenceSupport(e)}when(e,t){return this.isResolved()&&!this.ready&&d.getLogger(this).warn("#when()","Calling view.when() while the view is no longer ready but was already resolved once will resolve immediately. Use reactiveUtils.whenOnce(() => view.ready).then(...) instead."),super.when(e,t)}forceReadyCycle(){this.ready&&(v(()=>this.destroyed||!1===this.preconditionsReady,()=>this._readyCycleForced=!1,{once:!0}),this._readyCycleForced=!0)}on(e,t){return super.on(e,t)}addAndActivateTool(e){this.toolViewManager.tools.add(e),this.activeTool=e}tryFatalErrorRecovery(){this.fatalError=null}static{this.views=new r}};e([V()],B.prototype,"_userSpatialReference",void 0),e([V()],B.prototype,"activeTool",null),e([V({readOnly:!0})],B.prototype,"allLayerViews",void 0),e([V(R(k,"analyses"))],B.prototype,"analyses",void 0),e([V()],B.prototype,"animation",null),e([V()],B.prototype,"basemapView",void 0),e([V()],B.prototype,"center",null),e([V()],B.prototype,"defaultsFromMapSettings",null),e([V()],B.prototype,"defaultsFromMap",null),e([V()],B.prototype,"displayFilterEnabled",void 0),e([V({type:T})],B.prototype,"extent",null),e([V()],B.prototype,"fatalError",void 0),e([V(R(x,"graphics"))],B.prototype,"graphics",void 0),e([V()],B.prototype,"groundView",void 0),e([V({readOnly:!0,type:j})],B.prototype,"heightModelInfo",null),e([V({type:r.ofType(A)})],B.prototype,"highlights",null),e([V({readOnly:!0})],B.prototype,"interacting",null),e([V({constructOnly:!0})],B.prototype,"layerViewFilter",void 0),e([V({readOnly:!0})],B.prototype,"navigating",null),e([V({readOnly:!0,dependsOn:["fatalError","_isValid","_readyCycleForced","map","map.loaded?","width","height","spatialReference","_lockedSpatialReference","defaultsFromMap.ready","typeSpecificPreconditionsReady"]})],B.prototype,"preconditionsReady",null),e([V({readOnly:!0})],B.prototype,"typeSpecificPreconditionsReady",void 0),e([V({type:r,readOnly:!0})],B.prototype,"layerViews",void 0),e([V()],B.prototype,"resolution",null),e([V({type:H})],B.prototype,"magnifier",void 0),e([V({value:null,type:t})],B.prototype,"map",null),e([V()],B.prototype,"padding",void 0),e([V({readOnly:!0})],B.prototype,"ready",void 0),e([V()],B.prototype,"_readyStateWaitingTask",void 0),e([V({readOnly:!0})],B.prototype,"readyState",null),e([V({type:F})],B.prototype,"spatialReference",null),e([V()],B.prototype,"stationary",null),e([V({readOnly:!0})],B.prototype,"supportsGround",void 0),e([V({type:O})],B.prototype,"timeExtent",null),e([V({type:String,nonNullable:!0})],B.prototype,"timeZone",null),e([V()],B.prototype,"tools",null),e([V()],B.prototype,"toolViewManager",void 0),e([V({readOnly:!0})],B.prototype,"type",void 0),e([V({type:Number})],B.prototype,"scale",void 0),e([V({readOnly:!0})],B.prototype,"updating",void 0),e([V({readOnly:!0})],B.prototype,"initialExtentRequired",void 0),e([V({readOnly:!0})],B.prototype,"initialExtent",null),e([V()],B.prototype,"cursor",null),e([V({readOnly:!0})],B.prototype,"input",void 0),e([V({type:U,nonNullable:!0})],B.prototype,"navigation",void 0),e([V()],B.prototype,"layerViewManager",void 0),e([V()],B.prototype,"analysisViewManager",void 0),e([V()],B.prototype,"selectionManager",void 0),e([V()],B.prototype,"width",void 0),e([V()],B.prototype,"height",void 0),e([V({readOnly:!0})],B.prototype,"resizing",void 0),e([V({value:null,readOnly:!0})],B.prototype,"size",null),e([V({readOnly:!0})],B.prototype,"suspended",void 0),e([V({readOnly:!0})],B.prototype,"viewEvents",void 0),e([V({readOnly:!0})],B.prototype,"persistableViewModels",void 0),e([V()],B.prototype,"_isValid",void 0),e([V()],B.prototype,"_readyCycleForced",void 0),e([V()],B.prototype,"_lockedSpatialReference",void 0),e([V()],B.prototype,"_userTimeZone",void 0),e([V()],B.prototype,"_lockedTimeZone",void 0),e([V()],B.prototype,"_userTimeExtent",void 0),e([V()],B.prototype,"_lockedTimeExtent",void 0),e([V({type:Z})],B.prototype,"theme",void 0),e([V({readOnly:!0,type:Z})],B.prototype,"effectiveTheme",null),B=$=e([M("esri.views.View")],B);const J=globalThis.$arcgis;J&&!J.views&&Object.defineProperty(J,"views",{configurable:!1,enumerable:!0,writable:!1,value:B.views});const K=B;function Q(e){return e.layerViews}export{K as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../Map.js";import{createTask as i}from"../core/asyncUtils.js";import r from"../core/Collection.js";import s from"../core/CollectionFlattener.js";import{referenceSetter as a}from"../core/collectionUtils.js";import o from"../core/Error.js";import{EventedMixin as n}from"../core/Evented.js";import l from"../core/Handles.js";import{makeHandle as p}from"../core/handleUtils.js";import has from"../core/has.js";import{isLoadable as h}from"../core/Loadable.js";import d from"../core/Logger.js";import{destroyMaybe as y,abortMaybe as u}from"../core/maybe.js";import{EsriPromise as m}from"../core/Promise.js";import{after as c}from"../core/promiseUtils.js";import{watch as g,sync as f,whenOnce as w,when as v,syncAndInitial as _}from"../core/reactiveUtils.js";import{property as V}from"../core/accessorSupport/decorators/property.js";import"../core/RandomLCG.js";import{subclass as M}from"../core/accessorSupport/decorators/subclass.js";import{owningCollectionProperty as R}from"../core/support/OwningCollection.js";import{UpdatingHandles as S}from"../core/support/UpdatingHandles.js";import T from"../geometry/Extent.js";import j from"../geometry/HeightModelInfo.js";import F from"../geometry/SpatialReference.js";import{equals as E}from"../geometry/support/spatialReferenceUtils.js";import{AnalysesCollection as k}from"../support/AnalysesCollection.js";import{GraphicsCollection as x}from"../support/GraphicsCollection.js";import{system as b}from"../time/constants.js";import{T as O}from"../chunks/TimeExtent.js";import{isTimeZoneValid as C}from"../time/timeZoneUtils.js";import L from"./BasemapView.js";import H from"./Magnifier.js";import P from"./SelectionManager.js";import Z from"./Theme.js";import{ToolViewManager as I}from"./ToolViewManager.js";import{makeDefaultHighlightOptions as W}from"./3d/support/DefaultHighlights.js";import q from"./input/Input.js";import{ViewEvents as D}from"./input/ViewEvents.js";import U from"./navigation/Navigation.js";import{DefaultsFromMap as z}from"./support/DefaultsFromMap.js";import A from"./support/HighlightOptions.js";import G from"./support/LayerViewManager.js";import N from"./support/RequiredFieldsOptions.js";var $;let B=class extends(n(m)){static{$=this}constructor(e){super(e),this._userSpatialReference=null,this.handles=new l,this.updatingHandles=new S,this.allLayerViews=new s({getCollections:()=>[this.basemapView?.baseLayerViews,this.basemapView?.groundLayerViews,this.groundView?.layerViews,this.layerViews,this.basemapView?.referenceLayerViews],getChildrenFunction:Q}),this.analyses=new k,this.basemapView=null,this.displayFilterEnabled=!0,this.fatalError=null,this.graphics=new x,this.groundView=null,this.typeSpecificPreconditionsReady=!0,this.layerViews=new r,this.magnifier=new H,this.padding={left:0,top:0,right:0,bottom:0},this.ready=!1,this._readyStateWaitingTask=null,this.supportsGround=!0,this.type=null,this.scale=null,this.updating=!1,this.initialExtentRequired=!0,this._lowPriorityCursorHandles=new r,this._highPriorityCursorHandles=new r,this.input=new q,this.navigation=new U,this.layerViewManager=null,this.analysisViewManager=null,this.isHeightModelInfoRequired=!1,this.width=null,this.height=null,this.resizing=!1,this.suspended=!1,this.viewEvents=new D(this),this.persistableViewModels=new r,this.requiredFieldsOptions=new N,this._isValid=!1,this._readyCycleForced=!1,this._lockedSpatialReference=null,this._userTimeZone=null,this._lockedTimeZone=null,this._userTimeExtent=null,this._lockedTimeExtent=null,this.theme=null,this.handles.add(g(()=>this.preconditionsReady,e=>{const t=this.ready;if(e?(this._lockedSpatialReference=this.spatialReference,this._lockedTimeZone=this.timeZone,this._lockedTimeExtent=this.timeExtent,$.views.add(this)):(this._lockedSpatialReference=null,$.views.remove(this)),this.notifyChange("spatialReference"),!e&&t)this.toolViewManager?.detach(),this.analysisViewManager?.detach(),this.layerViewManager?.clear(),this._teardown();else if(e&&!t){try{this._startup()}catch(i){return void queueMicrotask(()=>{this.fatalError=new o("view:startup-error","View._startup failed",i)})}this.analysisViewManager?.attach(),this.toolViewManager.attach()}},f))}initialize(){this.addResolvingPromise(Promise.all([this.loadAsyncDependencies(),this.validate()]).then(()=>(this._isValid=!0,w(()=>this.ready)))),this.basemapView=new L({view:this}),this.layerViewManager=new G({view:this,layerViewFilter:e=>this.layerViewFilter?.(e)??!0,layerViewImporter:{importLayerView:e=>this.importLayerView(e),hasLayerViewModule:e=>this.hasLayerViewModule(e)},supportsGround:this.supportsGround}),this.toolViewManager=new I({view:this}),this.selectionManager=new P({view:this}),this.addHandles([v(()=>"map-content-error"===this.readyState&&!this.spatialReference,()=>{d.getLogger(this).warn("#spatialReference","no spatial reference could be derived from the currently added map layers")}),g(()=>this.initialExtentRequired,e=>this.defaultsFromMap.required={...this.defaultsFromMap.required,extent:e},_),g(()=>this.ready,e=>{this.defaultsFromMap&&(this.defaultsFromMap.suspended=e,this.defaultsFromMap.userSpatialReference=e?this.spatialReference:this._userSpatialReference)},f),g(()=>this._userSpatialReference,e=>{this.defaultsFromMap&&(this.defaultsFromMap.userSpatialReference=e)},_)])}destroy(){this.destroyed||($.views.remove(this),this.viewEvents.destroy(),this.allLayerViews.destroy(),this.navigation&&(this.navigation.destroy(),this._set("navigation",null)),this.graphics=y(this.graphics),this.analyses=y(this.analyses),this.defaultsFromMap.destroy(),this._set("defaultsFromMap",null),this.analysisViewManager=y(this.analysisViewManager),this.toolViewManager=y(this.toolViewManager),this.layerViewManager=y(this.layerViewManager),this.selectionManager=y(this.selectionManager),this.basemapView=y(this.basemapView),this.groundView?.destroy(),this.layerViews?.forEach(e=>e.destroy()),this.layerViews.length=0,this.invalidate(),this.handles.destroy(),this.map=y(this.map),this.updatingHandles.destroy())}_startup(){this._set("ready",!0)}_teardown(){this._set("ready",!1)}whenReady(){return Promise.resolve(this)}toMap(){return d.getLogger(this).error("#toMap()","Not implemented on this instance of View"),null}get activeTool(){return this.toolViewManager?.activeTool}set activeTool(e){this.toolViewManager&&(this.toolViewManager.activeTool=e)}get animation(){return this._get("animation")}set animation(e){this._set("animation",e)}get center(){return null}get defaultsFromMapSettings(){return{}}get defaultsFromMap(){return new z({required:{tileInfo:!1,heightModelInfo:!1,extent:!1},map:()=>this.map,getSpatialReferenceSupport:(e,t)=>this.getSpatialReferenceSupport(e,t),...this.defaultsFromMapSettings})}get extent(){return this._get("extent")}set extent(e){this._set("extent",e)}get heightModelInfo(){return this.getDefaultHeightModelInfo()}get highlights(){return this._get("highlights")??W()}set highlights(e){this._set("highlights",a(e,this._get("highlights"),r.ofType(A)))}get interacting(){return this.navigating}get navigating(){return!1}get preconditionsReady(){return!this.destroying&&!this.destroyed&&!(this.fatalError||!this._isValid||this._readyCycleForced||!this.map||h(this.map)&&!this.map.loaded||0===this.width||0===this.height||!this.spatialReference||!this._validateSpatialReference(this.spatialReference)||!this._lockedSpatialReference&&!this.defaultsFromMap?.ready||!this.typeSpecificPreconditionsReady)}get resolution(){return 0}set map(e){e!==this._get("map")&&(e?.destroyed&&(d.getLogger(this).warn("#map","The provided map is already destroyed",{map:e}),e=null),h(e)&&e.load().catch(()=>{}),this.constructed&&!this.destroyed&&(this.forceReadyCycle(),this._lockedSpatialReference=null),this._set("map",e))}get readyState(){if(this.destroyed)return this._get("readyState");if(!this.map)return"missing-map";if("container"in this&&!this.container)return"missing-container";if(this.fatalError)return"rendering-error";if((this.defaultsFromMap?.ready??!1)&&!this.spatialReference){const e=!("loaded"in this.map)||this.map.loaded,t=this.map.ground.loaded,r=this.map.basemap?.loaded??!0;return e&&r&&t&&!this.map?.allLayers.length?"empty-map":(this._readyStateWaitingTask||(this._readyStateWaitingTask=i(e=>c(has("view-readyState-waiting-delay"),null,e)),this.addHandles(this._readyStateWaitingTask),this.addHandles(this._readyStateWaitingTask,"ready-state-task")),this._readyStateWaitingTask?.finished?"map-content-error":"loading")}return this._readyStateWaitingTask=u(this._readyStateWaitingTask),this.removeHandles("ready-state-task"),this.ready?"ready":"loading"}get spatialReference(){const e=this._userSpatialReference||this._lockedSpatialReference||this.getDefaultSpatialReference()||null;if(e&&this.defaultsFromMap?.required?.heightModelInfo){const t=e.clone();return t.vcsWkid=this.defaultsFromMap.vcsWkid,t.latestVcsWkid=this.defaultsFromMap.latestVcsWkid,t}return e}set spatialReference(e){const t=!E(e,this._get("spatialReference"));this._set("_userSpatialReference",e),t&&(this._set("spatialReference",e),this._spatialReferenceChanged(e))}_spatialReferenceChanged(e){}get stationary(){return!this.animation&&!this.navigating&&!this.resizing}get timeExtent(){return this._userTimeExtent??this._lockedTimeExtent??this.getDefaultTimeExtent()??null}set timeExtent(e){this._userTimeExtent=e}get timeZone(){return this._userTimeZone??this._lockedTimeZone??this.getDefaultTimeZone()??b}set timeZone(e){this._userTimeZone=e,C(e)||d.getLogger(this).warn("#timeZone",`the parsed value '${e}' may not be a valid IANA time zone`)}get tools(){return this.toolViewManager?.tools}get initialExtent(){return this.defaultsFromMap?.extent}get cursor(){return this.toolViewManager?.cursor??this._highPriorityCursorHandles.at(-1)?.cursor??this._lowPriorityCursorHandles.at(-1)?.cursor??"default"}acquireCursor(e,t="low"){const i="high"===t?this._highPriorityCursorHandles:this._lowPriorityCursorHandles,r={cursor:e},s=p(()=>i.remove(r));return i.add(r),this.addHandles(s),s}get size(){return[this.width,this.height]}get effectiveTheme(){return this.theme??new Z}whenLayerView(e){return this.layerViewManager?.whenLayerView(e)??Promise.reject()}getDefaultSpatialReference(){return this.defaultsFromMap?.spatialReference}getDefaultHeightModelInfo(){return(this.map&&"heightModelInfo"in this.map?this.map.heightModelInfo:void 0)??this.defaultsFromMap?.heightModelInfo??null}getDefaultTimeZone(){return null}getDefaultTimeExtent(){return null}importLayerView(e){throw new o("view:importLayerView-missing","importLayerView() not implemented")}hasLayerViewModule(e){return!1}async validate(){}async loadAsyncDependencies(){}invalidate(){this._isValid=!1}getSpatialReferenceSupport(){return{constraints:null}}_validateSpatialReference(e){return null!=this.getSpatialReferenceSupport(e)}when(e,t){return this.isResolved()&&!this.ready&&d.getLogger(this).warn("#when()","Calling view.when() while the view is no longer ready but was already resolved once will resolve immediately. Use reactiveUtils.whenOnce(() => view.ready).then(...) instead."),super.when(e,t)}forceReadyCycle(){this.ready&&(v(()=>this.destroyed||!1===this.preconditionsReady,()=>this._readyCycleForced=!1,{once:!0}),this._readyCycleForced=!0)}on(e,t){return super.on(e,t)}addAndActivateTool(e){this.toolViewManager.tools.add(e),this.activeTool=e}tryFatalErrorRecovery(){this.fatalError=null}static{this.views=new r}};e([V()],B.prototype,"_userSpatialReference",void 0),e([V()],B.prototype,"activeTool",null),e([V({readOnly:!0})],B.prototype,"allLayerViews",void 0),e([V(R(k,"analyses"))],B.prototype,"analyses",void 0),e([V()],B.prototype,"animation",null),e([V()],B.prototype,"basemapView",void 0),e([V()],B.prototype,"center",null),e([V()],B.prototype,"defaultsFromMapSettings",null),e([V()],B.prototype,"defaultsFromMap",null),e([V()],B.prototype,"displayFilterEnabled",void 0),e([V({type:T})],B.prototype,"extent",null),e([V()],B.prototype,"fatalError",void 0),e([V(R(x,"graphics"))],B.prototype,"graphics",void 0),e([V()],B.prototype,"groundView",void 0),e([V({readOnly:!0,type:j})],B.prototype,"heightModelInfo",null),e([V({type:r.ofType(A)})],B.prototype,"highlights",null),e([V({readOnly:!0})],B.prototype,"interacting",null),e([V({constructOnly:!0})],B.prototype,"layerViewFilter",void 0),e([V({readOnly:!0})],B.prototype,"navigating",null),e([V({readOnly:!0,dependsOn:["fatalError","_isValid","_readyCycleForced","map","map.loaded?","width","height","spatialReference","_lockedSpatialReference","defaultsFromMap.ready","typeSpecificPreconditionsReady"]})],B.prototype,"preconditionsReady",null),e([V({readOnly:!0})],B.prototype,"typeSpecificPreconditionsReady",void 0),e([V({type:r,readOnly:!0})],B.prototype,"layerViews",void 0),e([V()],B.prototype,"resolution",null),e([V({type:H})],B.prototype,"magnifier",void 0),e([V({value:null,type:t})],B.prototype,"map",null),e([V()],B.prototype,"padding",void 0),e([V({readOnly:!0})],B.prototype,"ready",void 0),e([V()],B.prototype,"_readyStateWaitingTask",void 0),e([V({readOnly:!0})],B.prototype,"readyState",null),e([V({type:F})],B.prototype,"spatialReference",null),e([V()],B.prototype,"stationary",null),e([V({readOnly:!0})],B.prototype,"supportsGround",void 0),e([V({type:O})],B.prototype,"timeExtent",null),e([V({type:String,nonNullable:!0})],B.prototype,"timeZone",null),e([V()],B.prototype,"tools",null),e([V()],B.prototype,"toolViewManager",void 0),e([V({readOnly:!0})],B.prototype,"type",void 0),e([V({type:Number})],B.prototype,"scale",void 0),e([V({readOnly:!0})],B.prototype,"updating",void 0),e([V({readOnly:!0})],B.prototype,"initialExtentRequired",void 0),e([V({readOnly:!0})],B.prototype,"initialExtent",null),e([V()],B.prototype,"cursor",null),e([V({readOnly:!0})],B.prototype,"input",void 0),e([V({type:U,nonNullable:!0})],B.prototype,"navigation",void 0),e([V()],B.prototype,"layerViewManager",void 0),e([V()],B.prototype,"analysisViewManager",void 0),e([V()],B.prototype,"selectionManager",void 0),e([V()],B.prototype,"width",void 0),e([V()],B.prototype,"height",void 0),e([V({readOnly:!0})],B.prototype,"resizing",void 0),e([V({value:null,readOnly:!0})],B.prototype,"size",null),e([V({readOnly:!0})],B.prototype,"suspended",void 0),e([V({readOnly:!0})],B.prototype,"viewEvents",void 0),e([V({readOnly:!0})],B.prototype,"persistableViewModels",void 0),e([V()],B.prototype,"_isValid",void 0),e([V()],B.prototype,"_readyCycleForced",void 0),e([V()],B.prototype,"_lockedSpatialReference",void 0),e([V()],B.prototype,"_userTimeZone",void 0),e([V()],B.prototype,"_lockedTimeZone",void 0),e([V()],B.prototype,"_userTimeExtent",void 0),e([V()],B.prototype,"_lockedTimeExtent",void 0),e([V({type:Z})],B.prototype,"theme",void 0),e([V({readOnly:!0,type:Z})],B.prototype,"effectiveTheme",null),B=$=e([M("esri.views.View")],B);const J=globalThis.$arcgis;J&&!J.views&&Object.defineProperty(J,"views",{configurable:!1,enumerable:!0,writable:!1,value:B.views});const K=B;function Q(e){return e.layerViews}export{K as default};
|
package/views/View2D.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 e}from"tslib";import t from"../Viewpoint.js";import i from"../core/Collection.js";import r from"../core/CollectionFlattener.js";import s from"../core/Error.js";import has from"../core/has.js";import a from"../core/Logger.js";import{destroyMaybe as n}from"../core/maybe.js";import{watch as o,syncAndInitial as l}from"../core/reactiveUtils.js";import{initialize as p}from"../core/workers/workers.js";import{property as h}from"../core/accessorSupport/decorators/property.js";import{cast as g}from"../core/accessorSupport/decorators/cast.js";import"../core/RandomLCG.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import{ensureClass as u}from"../core/accessorSupport/ensureType.js";import c from"../geometry/Polygon.js";import{isLoadedOrLoadFor as m}from"../geometry/projectionUtils.js";import y from"../layers/support/TileInfo.js";import{BreakpointsOwner as f}from"./BreakpointsOwner.js";import{DOMContainer as w}from"./DOMContainer.js";import{PopupView as V}from"./PopupView.js";import v from"./View.js";import{Viewport2DBaseMixin as M}from"./Viewport2DBaseMixin.js";import{Viewport2DMixin as b}from"./Viewport2DMixin.js";import _ from"./2d/AnimationManager.js";import{layerView2DImporter as j}from"./2d/layerViewModuleImportUtils.js";import R from"./2d/tiling/TileInfoView.js";import"./2d/tiling/TileKey.js";import"./2d/tiling/TileQueue.js";import"./2d/tiling/TileStrategy.js";import{extentToScale as S}from"./2d/viewpointUtils.js";import{ManagedCanvas as L}from"./2d/engine/ManagedCanvas.js";import O from"./2d/layers/features/support/TileStore.js";import{createOrReuseHighlightGradient as T}from"./2d/layers/support/util.js";import{clipContainsPoint as C}from"./2d/support/clippingUtils.js";import{getDefaultHighlightOptions as k,setDefaultHighlightOptions as x}from"./2d/support/highlightOptionsUtils.js";import{hitTest as D}from"./2d/support/hitTestUtils.js";import{takeRawScreenshot as P,takeScreenshot as E}from"./2d/support/screenshotUtils.js";import{Timeline as z}from"./2d/support/Timeline.js";import A from"./navigation/Navigation.js";import G from"./navigation/NavigationActionMap.js";import U from"./support/HighlightOptions.js";import{check as q}from"./support/WebGLRequirements.js";import I from"./ui/DefaultUI.js";import N from"./ui/2d/DefaultUI2D.js";import{RenderingContextOptions as W}from"./webgl/RenderingContextOptions.js";import{isWebMap as $}from"../webmap/utils.js";import F from"../webmap/background/ColorBackground.js";let H,B,Z,J,K,Q,X;async function Y(){const[,{GraphicsView2D:e,GraphicContainer:t,LabelManager:i,MapViewNavigation:r,MagnifierView2D:s,GridView2D:a,Stage:n}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);B=e,Z=t,J=i,K=r,Q=s,X=a,H=n}let ee=class extends(b(M(f(V(w(v)))))){get timeZone(){return super.timeZone}set timeZone(e){super.timeZone=e}constructor(e){super(e),this._magnifierView=null,this._gridView=null,this.stage=null,this._resolveWhenReady=[],this.rootLayerViews=new r({getCollections:()=>[this.basemapView?.baseLayerViews,this.layerViews,this.basemapView?.referenceLayerViews],getChildrenFunction:()=>null}),this.featuresTilingScheme=null,this.graphicsView=null,this.labelManager=null,this.navigation=new A({actionMap:new G({dragTertiary:"none"})}),this.renderingOptions={samplingMode:"dynamic",edgeLabelsVisible:!0,labelsAnimationTime:125,labelCollisionsEnabled:!0},this.supersampleScreenshotsEnabled=!0,this.supportsGround=!1,this.floors=new i,this.grid=null,this.map=null,this.spatialReferenceLocked=!1,this.timeline=new z,this.type="2d",this.view2dType=null,this.ui=new N,this.test={takeScreenshot:async e=>P(this._getScreenshotView(e),e)},this.padding={top:0,right:0,bottom:0,left:0},p()}destroy(){this.layerViewManager.clear(),this._set("preconditionsReady",!1),this.frameTask=n(this.frameTask),this.goToManager.destroy(),this.rootLayerViews.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get graphicsTileStore(){return new O(this.featuresTilingScheme)}get constraintsInfo(){const e=this.defaultsFromMap?.tileInfo,t=this.spatialReference;return{lods:e?.spatialReference?.equals(t)?e.lods:null,spatialReference:t}}get initialExtentRequired(){if(!this.stateManager)return!1;const{scale:e,constraints:t,center:i,viewpoint:r,extent:s}=this;let a=this.zoom;return!(this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties?.viewpoint)&&(!s&&(t?.effectiveLODs||(a=-1),(!i||0===e&&-1===a)&&(null==r?.targetGeometry||"extent"!==r.targetGeometry.type&&!r.scale)))}get defaultsFromMapSettings(){return{required:{extent:!1,heightModelInfo:!1,tileInfo:!0},requiresExtentInSpatialReference:this.spatialReferenceLocked}}get scheduler(){return this.frameTask.scheduler}get typeSpecificPreconditionsReady(){const e=this._getDefaultViewpoint();if(!e)return!1;const t=e.targetGeometry,i=this.spatialReference;return m(t.spatialReference,i)}get background(){return $(this.map)?this.map.initialViewProperties.background:null}set background(e){this._override("background",e)}get center(){return this.stateManager?.center??null}set center(e){this.stateManager.center=e}get constraints(){return super.constraints}set constraints(e){super.constraints=e}get highlightOptions(){return k(this)}set highlightOptions(e){x(this,e)}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}get rendering(){return this.stage?.renderRequested??!1}get resizeAlign(){return super.resizeAlign}set resizeAlign(e){super.resizeAlign=e}get resolution(){return this.stateManager.resolution??0}get rotation(){return super.rotation}set rotation(e){super.rotation=e}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get spatialReference(){return super.spatialReference}set spatialReference(e){super.spatialReference=e}get tileInfo(){return this.featuresTilingScheme?.tileInfo}get updating(){const e=!(!this.magnifier.visible||null===this.magnifier.position||!this._magnifierView?.updatingHandles.updating),t=!this.destroyed&&(!this.layerViewManager||!this.labelManager||!this.graphicsView||!0===this.layerViewManager.updating||!0===this.labelManager.updating||!0===this.graphicsView.updating||this.allLayerViews.some(e=>!e.destroyed&&!("layerViews"in e)&&!0===e.updating)||e);if(has("esri-2d-log-updating")){const i=this.allLayerViews.reduce((e,t)=>({...e,[`${t.layer.id}(${t.layer.type})`]:!t.destroyed&&!("layerViews"in t)&&t.updating}),{});console.log(`Updating MapView: ${t}\n-> Null LayerViewManager: ${!this.layerViewManager}\n-> Null LabelManager: ${!this.labelManager}\n-> Null GraphicsView: ${!this.graphicsView}\n-> layerViewManager.updating: ${this.layerViewManager?.updating}\n-> labelManager.updating: ${this.labelManager?.updating}\n-> graphicsView.updating: ${this.graphicsView?.updating}\n-> allLayerViews: ${JSON.stringify(i)}\n-> updatingMagnifier: ${e}\n`)}return t}get viewpoint(){return super.viewpoint}set viewpoint(e){super.viewpoint=e}get visibleArea(){const e=this.stateManager.visibleArea;return e?new c({rings:[e.map(e=>[e[0],e[1]])],spatialReference:this.spatialReference}):e}get zoom(){return this.stateManager.zoom??-1}set zoom(e){this.stateManager.zoom=e}get navigating(){return this.mapViewNavigation?.interacting??!1}async hitTest(e,t){return D(this,e,t)}async takeScreenshot(e){return E(this._getScreenshotView(e),e)}toScreen(e,t){return this.stateManager.toScreen(e,t)}whenLayerView(e){return super.whenLayerView(e)}graphicChanged(e){if(this.graphicsView){this.graphicsView.graphicUpdateHandler(e)}}whenReady(){return new Promise(e=>{this.ready?e(this):this._resolveWhenReady.push(e)})}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties.spatialReference||this.defaultsFromMap?.spatialReference||null}getDefaultTimeZone(){return $(this.map)?this.map.initialViewProperties.timeZone:null}getDefaultTimeExtent(){return $(this.map)?this.map.initialViewProperties.timeExtent:null}hasLayerViewModule(e){return j.hasLayerViewModule(e)}importLayerView(e){return j.importLayerView(e)}pixelSizeAt(){return this.ready?this.resolution:(a.getLogger(this).error("#pixelSizeAt()","Map view cannot be used before it is ready"),null)}async popupHitTest(e){const t=this.toMap(e),i=await this.hitTest(e),r=this.allLayerViews.toArray().filter(i=>i.clips.every(i=>C(this,i,e,t))).reverse(),s=new globalThis.Map(r.map(e=>[e.layer.uid,e])),a=[];let n=0,o=0;for(;n<i.results.length||o<r.length;){const e=i.results.at(n);if(e&&"graphic"!==e.type){++n;continue}const l=s.get((e?.layer??e?.graphic.layer)?.uid);if((!e||l)&&o<r.length&&r.at(o)!==l){const e=r.at(o);"fetchPopupFeaturesAtLocation"in e&&a.push({mapPoint:t,layerView:e}),++o}else e&&(a.push({graphic:e.graphic,layerView:l}),++n)}return{hits:a,location:t}}requestUpdate(){this.ready&&this.frameTask.requestUpdate()}async validate(){let e=q(this.type);if(has("safari")&&has("safari")<9&&(e=new s("mapview:browser-not-supported","This browser is not supported by MapView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:has("safari")})),null!=e){a.getLogger(this).warn("#validate()",e.message);const t=document.createElement("div");t.setAttribute("style","display: flex; flex-direction: column; gap: 8px; padding: 20px; height: 100%; justify-content: center; color: black; background: white; font-family: sans-serif;");const i=document.createElement("div");i.innerHTML="Unable to display map. WebGL2 support is required.",i.setAttribute("style","font-size: 24px; font-weight: bold;");const r=document.createElement("div");r.innerHTML="Ensure that your browser and hardware meet the minimum requirements.",r.setAttribute("style","font-size: 18px;");const s=document.createElement("a");throw s.innerHTML="https://esriurl.com/systemRequirements",s.target="_blank",s.setAttribute("style","font-size: 18px;"),s.href="https://esriurl.com/systemRequirements",t.appendChild(i),t.appendChild(r),t.appendChild(s),this.surface.appendChild(t),e}}loadAsyncDependencies(){return Y()}_getDefaultViewpoint(){const{constraints:e,initialExtent:i,map:r,padding:s,size:a}=this;if(!e)return null;const n=r&&"initialViewProperties"in r?r.initialViewProperties:void 0,o=this.stateManager.getUserStartupOptions(this.size),l=n?.viewpoint,p=l?.targetGeometry?.extent??i,h=p?.center,g=l?.rotation??0,d=l?.scale||p&&S(p,[a[0]-s.left-s.right,a[1]-s.top-s.bottom]),u=o.center??h,c=o.rotation??g,m=o.scale??d;return u&&m?new t({targetGeometry:u,scale:m,rotation:c}):null}_startup(){this.timeline.begin("MapView Startup");const e=this._getDefaultViewpoint();this.stateManager.startup(e,this.size,this.spatialReference,this.defaultsFromMap.extent?.center),this.graphics.owner=this;const t=new L(this.surface),i=new H(this.surface,{canvas:this.renderCanvas,contextOptions:new W(this.deactivatedWebGLExtensions,this.debugWebGLExtensions),renderingOptions:this.renderingOptions,timeline:this.timeline},t);this.stage=i,this._magnifierView=new Q,this._magnifierView.magnifier=this.magnifier,this._gridView=new X;const r=new J({view:this});this._set("labelManager",r);const s=new _({view:this});this._set("animationManager",s);const a=new K({view:this,animationManager:s});this._set("mapViewNavigation",a),this._setupSpatialReferenceDependentProperties(),this.addHandles([this.rootLayerViews.on("change",()=>this._updateStageChildren()),i.on("webgl-error",e=>this.fatalError=e.error),o(()=>this.stationary,e=>i.stationary=e,l),o(()=>this.background,e=>{i.backgroundColor=e?.color,this._magnifierView.backgroundColor=e?.color},l),o(()=>this.magnifier,e=>this._magnifierView.magnifier=e,l),o(()=>this.grid,e=>this._gridView.grid=e,l),o(()=>this.renderingOptions,e=>i.renderingOptions=e,l),o(()=>this.highlights.items.map(e=>({name:e.name,options:{fillColor:e.color,haloColor:e.haloColor,fillOpacity:e.fillOpacity,haloOpacity:e.haloOpacity,haloWidth:e.haloWidth,haloBlur:e.haloBlur}})),()=>{i.highlightGradient=T(i.highlightGradient,this.highlights.items)},l),o(()=>this.state.id,()=>i.state=this.state,l)],"map-view"),this._updateStageChildren();const n=this._resolveWhenReady;this._resolveWhenReady=[],n.forEach(e=>e(this)),this.timeline.end("MapView Startup"),this.frameTask.start(),this._set("ready",!0)}_teardown(){this._destroySpatialReferenceDependentProperties(),this.removeHandles("map-view"),this.mapViewNavigation.destroy(),this._set("mapViewNavigation",null),this.animation=null,this.animationManager.destroy(),this._set("animationManager",null),this.layerViewManager.clear(),this.labelManager.destroy(),this._magnifierView.destroy(),this._gridView.destroy(),this.stage.destroy(),this.stage=null,this._set("graphicsView",null),this._magnifierView=null,this._gridView=null,this._set("labelManager",null),this._set("mapViewNavigation",null),this.graphics.owner=null,this.frameTask.stop(),this.stationaryManager.clear(),this._set("ready",!1),this.stateManager.teardown()}_updateStageChildren(){this.stage.removeAllChildren(),this.rootLayerViews.forEach(e=>{this.stage.addChild(e.container)});const e=this.graphicsView;this.stage.addChild(e.container),this.stage.addChild(this._magnifierView),this.stage.addChild(this._gridView)}_setupSpatialReferenceDependentProperties(){const e=new R(y.create({spatialReference:this.spatialReference,size:512,numLODs:36}));this._set("featuresTilingScheme",e);const t=new B({view:this,graphics:this.graphics,requestUpdateCallback:()=>this.requestUpdate(),container:new Z(e)});this._set("graphicsView",t)}_destroySpatialReferenceDependentProperties(){const e=this.graphicsView;this._set("graphicsView",null),e.destroy(),this._set("featuresTilingScheme",null)}_getScreenshotView(e){const{allLayerViews:t,padding:i,size:r,stage:s}=this;return{allLayerViews:t,backgroundColor:e?.ignoreBackground?null:this.background?.color,padding:i,size:r,stage:s}}_spatialReferenceChanged(e){if(this.ready){this.frameTask.stop();for(const e of this.allLayerViews)e.processDetach();this._destroySpatialReferenceDependentProperties(),this.stateManager.changeSpatialReference(e),this.stage.state=this.state,this._setupSpatialReferenceDependentProperties();for(const e of this.allLayerViews)e.processAttach();this.frameTask.requestFrame(),this.frameTask.start(),this._updateStageChildren()}}static{this.type="2d"}};e([h({constructOnly:!0})],ee.prototype,"deactivatedWebGLExtensions",void 0),e([h({constructOnly:!0})],ee.prototype,"debugWebGLExtensions",void 0),e([h({readOnly:!0})],ee.prototype,"featuresTilingScheme",void 0),e([h({readOnly:!0})],ee.prototype,"graphicsTileStore",null),e([h()],ee.prototype,"graphicsView",void 0),e([h()],ee.prototype,"constraintsInfo",null),e([h()],ee.prototype,"initialExtentRequired",null),e([h()],ee.prototype,"labelManager",void 0),e([h({type:A,nonNullable:!0})],ee.prototype,"navigation",void 0),e([h({constructOnly:!0})],ee.prototype,"renderCanvas",void 0),e([h()],ee.prototype,"renderingOptions",void 0),e([h({constructOnly:!0})],ee.prototype,"supersampleScreenshotsEnabled",void 0),e([h({readOnly:!0})],ee.prototype,"supportsGround",void 0),e([h()],ee.prototype,"defaultsFromMapSettings",null),e([h({readOnly:!0})],ee.prototype,"typeSpecificPreconditionsReady",null),e([h({type:F})],ee.prototype,"background",null),e([h()],ee.prototype,"center",null),e([h({type:i})],ee.prototype,"floors",void 0),e([h()],ee.prototype,"grid",void 0),e([h({type:U})],ee.prototype,"highlightOptions",null),e([h()],ee.prototype,"map",void 0),e([h()],ee.prototype,"padding",null),e([h({readOnly:!0})],ee.prototype,"rendering",null),e([h({readOnly:!0})],ee.prototype,"resolution",null),e([h()],ee.prototype,"scale",null),e([h({constructOnly:!0})],ee.prototype,"spatialReferenceLocked",void 0),e([h({readOnly:!0})],ee.prototype,"tileInfo",null),e([h({type:z,readOnly:!0})],ee.prototype,"timeline",void 0),e([h({readOnly:!0})],ee.prototype,"type",void 0),e([h({readOnly:!0})],ee.prototype,"updating",null),e([h({readOnly:!0})],ee.prototype,"view2dType",void 0),e([h({readOnly:!0})],ee.prototype,"visibleArea",null),e([h()],ee.prototype,"zoom",null),e([h({readOnly:!0})],ee.prototype,"navigating",null),e([h(),g(e=>e instanceof I?e:u(N,e))],ee.prototype,"ui",void 0),ee=e([d("esri.views.View2D")],ee);const te=ee;export{te as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../Viewpoint.js";import i from"../core/Collection.js";import r from"../core/CollectionFlattener.js";import s from"../core/Error.js";import has from"../core/has.js";import a from"../core/Logger.js";import{destroyMaybe as n}from"../core/maybe.js";import{watch as o,syncAndInitial as l}from"../core/reactiveUtils.js";import{initialize as p}from"../core/workers/workers.js";import{property as h}from"../core/accessorSupport/decorators/property.js";import{cast as g}from"../core/accessorSupport/decorators/cast.js";import"../core/RandomLCG.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import{ensureClass as u}from"../core/accessorSupport/ensureType.js";import c from"../geometry/Polygon.js";import{isLoadedOrLoadFor as m}from"../geometry/projectionUtils.js";import y from"../layers/support/TileInfo.js";import{BreakpointsOwner as f}from"./BreakpointsOwner.js";import{DOMContainer as w}from"./DOMContainer.js";import{PopupView as V}from"./PopupView.js";import M from"./View.js";import{Viewport2DBaseMixin as v}from"./Viewport2DBaseMixin.js";import{Viewport2DMixin as b}from"./Viewport2DMixin.js";import{importAnalysisViewModule as _}from"./2d/analysisViewModuleImportUtils.js";import j from"./2d/AnimationManager.js";import{layerView2DImporter as R}from"./2d/layerViewModuleImportUtils.js";import S from"./2d/tiling/TileInfoView.js";import"./2d/tiling/TileKey.js";import"./2d/tiling/TileQueue.js";import"./2d/tiling/TileStrategy.js";import{extentToScale as L}from"./2d/viewpointUtils.js";import{ManagedCanvas as O}from"./2d/engine/ManagedCanvas.js";import T from"./2d/layers/features/support/TileStore.js";import{createOrReuseHighlightGradient as C}from"./2d/layers/support/util.js";import{clipContainsPoint as k}from"./2d/support/clippingUtils.js";import{getDefaultHighlightOptions as x,setDefaultHighlightOptions as D}from"./2d/support/highlightOptionsUtils.js";import{hitTest as A}from"./2d/support/hitTestUtils.js";import{takeRawScreenshot as P,takeScreenshot as E}from"./2d/support/screenshotUtils.js";import{Timeline as z}from"./2d/support/Timeline.js";import G from"./navigation/Navigation.js";import U from"./navigation/NavigationActionMap.js";import q from"./support/AnalysisViewManager.js";import I from"./support/HighlightOptions.js";import{check as N}from"./support/WebGLRequirements.js";import W from"./ui/DefaultUI.js";import $ from"./ui/2d/DefaultUI2D.js";import{RenderingContextOptions as F}from"./webgl/RenderingContextOptions.js";import{isWebMap as H}from"../webmap/utils.js";import B from"../webmap/background/ColorBackground.js";let Z,J,K,Q,X,Y,ee;async function te(){const[,{GraphicsView2D:e,GraphicContainer:t,LabelManager:i,MapViewNavigation:r,MagnifierView2D:s,GridView2D:a,Stage:n}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);J=e,K=t,Q=i,X=r,Y=s,ee=a,Z=n}let ie=class extends(b(v(f(V(w(M)))))){get timeZone(){return super.timeZone}set timeZone(e){super.timeZone=e}constructor(e){super(e),this._magnifierView=null,this._gridView=null,this.stage=null,this._resolveWhenReady=[],this.rootLayerViews=new r({getCollections:()=>[this.basemapView?.baseLayerViews,this.layerViews,this.basemapView?.referenceLayerViews],getChildrenFunction:()=>null}),this.featuresTilingScheme=null,this.graphicsView=null,this.labelManager=null,this.navigation=new G({actionMap:new U({dragTertiary:"none"})}),this.renderingOptions={samplingMode:"dynamic",edgeLabelsVisible:!0,labelsAnimationTime:125,labelCollisionsEnabled:!0},this.supersampleScreenshotsEnabled=!0,this.supportsGround=!1,this.analysisViewManager=new q({importAnalysisViewModule:e=>_(e),view:this}),this.floors=new i,this.grid=null,this.map=null,this.spatialReferenceLocked=!1,this.timeline=new z,this.type="2d",this.view2dType=null,this.ui=new $,this.test={takeScreenshot:async e=>P(this._getScreenshotView(e),e)},this.padding={top:0,right:0,bottom:0,left:0},p()}destroy(){this.layerViewManager.clear(),this._set("preconditionsReady",!1),this.frameTask=n(this.frameTask),this.goToManager.destroy(),this.rootLayerViews.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get graphicsTileStore(){return new T(this.featuresTilingScheme)}get constraintsInfo(){const e=this.defaultsFromMap?.tileInfo,t=this.spatialReference;return{lods:e?.spatialReference?.equals(t)?e.lods:null,spatialReference:t}}get initialExtentRequired(){if(!this.stateManager)return!1;const{scale:e,constraints:t,center:i,viewpoint:r,extent:s}=this;let a=this.zoom;return!(this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties?.viewpoint)&&(!s&&(t?.effectiveLODs||(a=-1),(!i||0===e&&-1===a)&&(null==r?.targetGeometry||"extent"!==r.targetGeometry.type&&!r.scale)))}get defaultsFromMapSettings(){return{required:{extent:!1,heightModelInfo:!1,tileInfo:!0},requiresExtentInSpatialReference:this.spatialReferenceLocked}}get scheduler(){return this.frameTask.scheduler}get typeSpecificPreconditionsReady(){const e=this._getDefaultViewpoint();if(!e)return!1;const t=e.targetGeometry,i=this.spatialReference;return m(t.spatialReference,i)}get background(){return H(this.map)?this.map.initialViewProperties.background:null}set background(e){this._override("background",e)}get center(){return this.stateManager?.center??null}set center(e){this.stateManager.center=e}get constraints(){return super.constraints}set constraints(e){super.constraints=e}get highlightOptions(){return x(this)}set highlightOptions(e){D(this,e)}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}get rendering(){return this.stage?.renderRequested??!1}get resizeAlign(){return super.resizeAlign}set resizeAlign(e){super.resizeAlign=e}get resolution(){return this.stateManager.resolution??0}get rotation(){return super.rotation}set rotation(e){super.rotation=e}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get spatialReference(){return super.spatialReference}set spatialReference(e){super.spatialReference=e}get tileInfo(){return this.featuresTilingScheme?.tileInfo}get updating(){const e=!(!this.magnifier.visible||null===this.magnifier.position||!this._magnifierView?.updatingHandles.updating),t=!this.destroyed&&(!this.layerViewManager||!this.labelManager||!this.graphicsView||!0===this.layerViewManager.updating||!0===this.labelManager.updating||!0===this.graphicsView.updating||this.allLayerViews.some(e=>!e.destroyed&&!("layerViews"in e)&&!0===e.updating)||e);if(has("esri-2d-log-updating")){const i=this.allLayerViews.reduce((e,t)=>({...e,[`${t.layer.id}(${t.layer.type})`]:!t.destroyed&&!("layerViews"in t)&&t.updating}),{});console.log(`Updating MapView: ${t}\n-> Null LayerViewManager: ${!this.layerViewManager}\n-> Null LabelManager: ${!this.labelManager}\n-> Null GraphicsView: ${!this.graphicsView}\n-> layerViewManager.updating: ${this.layerViewManager?.updating}\n-> labelManager.updating: ${this.labelManager?.updating}\n-> graphicsView.updating: ${this.graphicsView?.updating}\n-> allLayerViews: ${JSON.stringify(i)}\n-> updatingMagnifier: ${e}\n`)}return t}get viewpoint(){return super.viewpoint}set viewpoint(e){super.viewpoint=e}get visibleArea(){const e=this.stateManager.visibleArea;return e?new c({rings:[e.map(e=>[e[0],e[1]])],spatialReference:this.spatialReference}):e}get zoom(){return this.stateManager.zoom??-1}set zoom(e){this.stateManager.zoom=e}get navigating(){return this.mapViewNavigation?.interacting??!1}async hitTest(e,t){return A(this,e,t)}async takeScreenshot(e){return E(this._getScreenshotView(e),e)}toScreen(e,t){return this.stateManager.toScreen(e,t)}whenLayerView(e){return super.whenLayerView(e)}graphicChanged(e){if(this.graphicsView){this.graphicsView.graphicUpdateHandler(e)}}whenReady(){return new Promise(e=>{this.ready?e(this):this._resolveWhenReady.push(e)})}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties.spatialReference||this.defaultsFromMap?.spatialReference||null}getDefaultTimeZone(){return H(this.map)?this.map.initialViewProperties.timeZone:null}getDefaultTimeExtent(){return H(this.map)?this.map.initialViewProperties.timeExtent:null}hasLayerViewModule(e){return R.hasLayerViewModule(e)}importLayerView(e){return R.importLayerView(e)}pixelSizeAt(){return this.ready?this.resolution:(a.getLogger(this).error("#pixelSizeAt()","Map view cannot be used before it is ready"),null)}async popupHitTest(e){const t=this.toMap(e),i=await this.hitTest(e),r=this.allLayerViews.toArray().filter(i=>i.clips.every(i=>k(this,i,e,t))).reverse(),s=new globalThis.Map(r.map(e=>[e.layer.uid,e])),a=[];let n=0,o=0;for(;n<i.results.length||o<r.length;){const e=i.results.at(n);if(e&&"graphic"!==e.type){++n;continue}const l=s.get((e?.layer??e?.graphic.layer)?.uid);if((!e||l)&&o<r.length&&r.at(o)!==l){const e=r.at(o);"fetchPopupFeaturesAtLocation"in e&&a.push({mapPoint:t,layerView:e}),++o}else e&&(a.push({graphic:e.graphic,layerView:l}),++n)}return{hits:a,location:t}}requestUpdate(){this.ready&&this.frameTask.requestUpdate()}async validate(){let e=N(this.type);if(has("safari")&&has("safari")<9&&(e=new s("mapview:browser-not-supported","This browser is not supported by MapView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:has("safari")})),null!=e){a.getLogger(this).warn("#validate()",e.message);const t=document.createElement("div");t.setAttribute("style","display: flex; flex-direction: column; gap: 8px; padding: 20px; height: 100%; justify-content: center; color: black; background: white; font-family: sans-serif;");const i=document.createElement("div");i.innerHTML="Unable to display map. WebGL2 support is required.",i.setAttribute("style","font-size: 24px; font-weight: bold;");const r=document.createElement("div");r.innerHTML="Ensure that your browser and hardware meet the minimum requirements.",r.setAttribute("style","font-size: 18px;");const s=document.createElement("a");throw s.innerHTML="https://esriurl.com/systemRequirements",s.target="_blank",s.setAttribute("style","font-size: 18px;"),s.href="https://esriurl.com/systemRequirements",t.appendChild(i),t.appendChild(r),t.appendChild(s),this.surface.appendChild(t),e}}loadAsyncDependencies(){return te()}_getDefaultViewpoint(){const{constraints:e,initialExtent:i,map:r,padding:s,size:a}=this;if(!e)return null;const n=r&&"initialViewProperties"in r?r.initialViewProperties:void 0,o=this.stateManager.getUserStartupOptions(this.size),l=n?.viewpoint,p=l?.targetGeometry?.extent??i,h=p?.center,g=l?.rotation??0,d=l?.scale||p&&L(p,[a[0]-s.left-s.right,a[1]-s.top-s.bottom]),u=o.center??h,c=o.rotation??g,m=o.scale??d;return u&&m?new t({targetGeometry:u,scale:m,rotation:c}):null}_startup(){this.timeline.begin("MapView Startup");const e=this._getDefaultViewpoint();this.stateManager.startup(e,this.size,this.spatialReference,this.defaultsFromMap.extent?.center),this.graphics.owner=this;const t=new O(this.surface),i=new Z(this.surface,{canvas:this.renderCanvas,contextOptions:new F(this.deactivatedWebGLExtensions,this.debugWebGLExtensions),renderingOptions:this.renderingOptions,timeline:this.timeline},t);this.stage=i,this._magnifierView=new Y,this._magnifierView.magnifier=this.magnifier,this._gridView=new ee;const r=new Q({view:this});this._set("labelManager",r);const s=new j({view:this});this._set("animationManager",s);const a=new X({view:this,animationManager:s});this._set("mapViewNavigation",a),this._setupSpatialReferenceDependentProperties(),this.addHandles([this.rootLayerViews.on("change",()=>this._updateStageChildren()),i.on("webgl-error",e=>this.fatalError=e.error),o(()=>this.stationary,e=>i.stationary=e,l),o(()=>this.background,e=>{i.backgroundColor=e?.color,this._magnifierView.backgroundColor=e?.color},l),o(()=>this.magnifier,e=>this._magnifierView.magnifier=e,l),o(()=>this.grid,e=>this._gridView.grid=e,l),o(()=>this.renderingOptions,e=>i.renderingOptions=e,l),o(()=>this.highlights.items.map(e=>({name:e.name,options:{fillColor:e.color,haloColor:e.haloColor,fillOpacity:e.fillOpacity,haloOpacity:e.haloOpacity,haloWidth:e.haloWidth,haloBlur:e.haloBlur}})),()=>{i.highlightGradient=C(i.highlightGradient,this.highlights.items)},l),o(()=>this.state.id,()=>i.state=this.state,l)],"map-view"),this._updateStageChildren();const n=this._resolveWhenReady;this._resolveWhenReady=[],n.forEach(e=>e(this)),this.timeline.end("MapView Startup"),this.frameTask.start(),this._set("ready",!0)}_teardown(){this._destroySpatialReferenceDependentProperties(),this.removeHandles("map-view"),this.mapViewNavigation.destroy(),this._set("mapViewNavigation",null),this.animation=null,this.animationManager.destroy(),this._set("animationManager",null),this.layerViewManager.clear(),this.labelManager.destroy(),this._magnifierView.destroy(),this._gridView.destroy(),this.stage.destroy(),this.stage=null,this._set("graphicsView",null),this._magnifierView=null,this._gridView=null,this._set("labelManager",null),this._set("mapViewNavigation",null),this.graphics.owner=null,this.frameTask.stop(),this.stationaryManager.clear(),this._set("ready",!1),this.stateManager.teardown()}_updateStageChildren(){this.stage.removeAllChildren(),this.rootLayerViews.forEach(e=>{this.stage.addChild(e.container)});const e=this.graphicsView;this.stage.addChild(e.container),this.stage.addChild(this._magnifierView),this.stage.addChild(this._gridView)}_setupSpatialReferenceDependentProperties(){const e=new S(y.create({spatialReference:this.spatialReference,size:512,numLODs:36}));this._set("featuresTilingScheme",e);const t=new J({view:this,graphics:this.graphics,requestUpdateCallback:()=>this.requestUpdate(),container:new K(e)});this._set("graphicsView",t)}_destroySpatialReferenceDependentProperties(){const e=this.graphicsView;this._set("graphicsView",null),e.destroy(),this._set("featuresTilingScheme",null)}_getScreenshotView(e){const{allLayerViews:t,padding:i,size:r,stage:s}=this;return{allLayerViews:t,backgroundColor:e?.ignoreBackground?null:this.background?.color,padding:i,size:r,stage:s}}_spatialReferenceChanged(e){if(this.ready){this.frameTask.stop();for(const e of this.allLayerViews)e.processDetach();this._destroySpatialReferenceDependentProperties(),this.stateManager.changeSpatialReference(e),this.stage.state=this.state,this._setupSpatialReferenceDependentProperties();for(const e of this.allLayerViews)e.processAttach();this.frameTask.requestFrame(),this.frameTask.start(),this._updateStageChildren()}}static{this.type="2d"}};e([h({constructOnly:!0})],ie.prototype,"deactivatedWebGLExtensions",void 0),e([h({constructOnly:!0})],ie.prototype,"debugWebGLExtensions",void 0),e([h({readOnly:!0})],ie.prototype,"featuresTilingScheme",void 0),e([h({readOnly:!0})],ie.prototype,"graphicsTileStore",null),e([h()],ie.prototype,"graphicsView",void 0),e([h()],ie.prototype,"constraintsInfo",null),e([h()],ie.prototype,"initialExtentRequired",null),e([h()],ie.prototype,"labelManager",void 0),e([h({type:G,nonNullable:!0})],ie.prototype,"navigation",void 0),e([h({constructOnly:!0})],ie.prototype,"renderCanvas",void 0),e([h()],ie.prototype,"renderingOptions",void 0),e([h({constructOnly:!0})],ie.prototype,"supersampleScreenshotsEnabled",void 0),e([h({readOnly:!0})],ie.prototype,"supportsGround",void 0),e([h()],ie.prototype,"defaultsFromMapSettings",null),e([h({readOnly:!0})],ie.prototype,"typeSpecificPreconditionsReady",null),e([h()],ie.prototype,"analysisViewManager",void 0),e([h({type:B})],ie.prototype,"background",null),e([h()],ie.prototype,"center",null),e([h({type:i})],ie.prototype,"floors",void 0),e([h()],ie.prototype,"grid",void 0),e([h({type:I})],ie.prototype,"highlightOptions",null),e([h()],ie.prototype,"map",void 0),e([h()],ie.prototype,"padding",null),e([h({readOnly:!0})],ie.prototype,"rendering",null),e([h({readOnly:!0})],ie.prototype,"resolution",null),e([h()],ie.prototype,"scale",null),e([h({constructOnly:!0})],ie.prototype,"spatialReferenceLocked",void 0),e([h({readOnly:!0})],ie.prototype,"tileInfo",null),e([h({type:z,readOnly:!0})],ie.prototype,"timeline",void 0),e([h({readOnly:!0})],ie.prototype,"type",void 0),e([h({readOnly:!0})],ie.prototype,"updating",null),e([h({readOnly:!0})],ie.prototype,"view2dType",void 0),e([h({readOnly:!0})],ie.prototype,"visibleArea",null),e([h()],ie.prototype,"zoom",null),e([h({readOnly:!0})],ie.prototype,"navigating",null),e([h(),g(e=>e instanceof W?e:u($,e))],ie.prototype,"ui",void 0),ie=e([d("esri.views.View2D")],ie);const re=ie;export{re as default};
|
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{UndoRedo as o}from"../../UndoRedo.js";import{createTask as r}from"../../core/asyncUtils.js";import{makeHandle as i}from"../../core/handleUtils.js";import{destroyMaybe as s}from"../../core/maybe.js";import{watch as a,syncAndInitial as n,sync as l}from"../../core/reactiveUtils.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import{load as d}from"../../geometry/coordinateFormatter.js";import h from"../../layers/GraphicsLayer.js";import{pointEquals as u}from"../../layers/graphics/dehydratedFeatureComparison.js";import{CreateOperationGeometry as m}from"./support/CreateOperationGeometry.js";import{createCircle as y,createEllipse as g,createSquare as v,createRectangle as f,createPolygon as O,createPolyline as _,createMultipoint as w}from"./support/createUtils.js";import{createViewAlignedCoordinateSystem as C}from"./support/surfaceCoordinateSystems.js";import{createTooltipInfos as G,initializeConstraints as x,updateTooltipInfo as V,getConstraintZ as U,unlockConstraintsOnVertexAddOrRemove as b,lockElevationOnVertexAdd as k,getActiveTooltipInfo as S}from"./support/tooltipUtils.js";import{InteractiveToolBase as T}from"../interactive/InteractiveToolBase.js";import j from"../interactive/sketch/SketchOptions.js";import{makeTooltip as L,pasteLocation as H,enterInputModeIfAvailable as R}from"../interactive/tooltip/tooltipCommonUtils.js";import{autorun as z}from"../../core/accessorSupport/trackingUtils.js";let A=class extends T{constructor(t){super(t),this._graphic=null,this._coordinateFormatterLoadTask=null,this._createOperationGeometry=null,this.defaultZ=0,this.directionOptions=null,this.elevationLockOnVertexAddDisabled=!1,this.geometryType=null,this.hasZ=!0,this.geometryToPlace=null,this.snappingManager=null,this.snapToScene=!1,this.sketchOptions=new j}initialize(){const{view:t}=this;this.internalGraphicsLayer=new h({listMode:"hide",internal:!0,title:"DrawGraphicTool layer"}),this.view.map.layers.add(this.internalGraphicsLayer);const e=this.drawOperation=this.makeDrawOperation();this.tooltipInfos=G(t.type,this.sketchOptions);const o=L(()=>({view:t,options:this.sketchOptions.tooltips}));this.tooltip=o,x(this._tooltipsContext),this._coordinateFormatterLoadTask=r(()=>d()),this.addHandles([e.on("vertex-add",t=>this.onVertexAdd(t)),e.on("vertex-remove",t=>this.onVertexRemove(t)),e.on("vertex-update",t=>this.onVertexUpdate(t)),e.on("cursor-update",t=>this.onCursorUpdate(t)),e.on("cursor-remove",()=>this._updateGraphic()),e.on("complete",t=>this.onComplete(t)),this._coordinateFormatterLoadTask,o.on("paste",t=>H(t,this.activeTooltipInfo)),a(()=>this.cursor,t=>{e.cursor=t},n),z(()=>{const{activeTooltipInfo:t,sketchOptions:e}=this;V(t,this._tooltipsContext),o.info=e.tooltips.effectiveEnabled?t:null}),z(()=>{e.constraintZ=U(this._tooltipsContext)},l)]),this.finishToolCreation()}destroy(){this.drawOperation=s(this.drawOperation),this.tooltip=s(this.tooltip),this._destroyAllVisualizations(),this.view.map.remove(this.internalGraphicsLayer),this.internalGraphicsLayer=s(this.internalGraphicsLayer),this._set("view",null)}get _drawSpatialReference(){return this.drawOperation.coordinateHelper.spatialReference}get _tooltipsContext(){const{defaultZ:t,directionOptions:e,drawOperation:o,forceUniformSize:r,geometryType:i,graphic:s,sketchOptions:a,tooltipInfos:n,view:l,automaticAreaMeasurementUtils:p,automaticLengthMeasurementUtils:c}=this;return{createOperationGeometry:this._createOperationGeometry,defaultZ:t,directionOptions:e,drawOperation:o,forceUniformSize:r,geometryType:i,graphic:s,sketchOptions:a,tooltipInfos:n,view:l,automaticAreaMeasurementUtils:p,automaticLengthMeasurementUtils:c}}get canRedo(){return this.drawOperation.canRedo}get canUndo(){return this.drawOperation.canUndo}set centered(t){this._set("centered",t),this._updateGraphic()}get cursor(){return this._get("cursor")}set cursor(t){this._set("cursor",t)}set enabled(t){this.drawOperation.interactive=t,this._set("enabled",t)}set forceUniformSize(t){this._set("forceUniformSize",t),this._updateGraphic()}get graphic(){return this._graphic}set graphicSymbol(t){this._set("graphicSymbol",t),null!=this._graphic&&(this._graphic.symbol=t)}set mode(t){const e=this.drawOperation;e&&(e.drawingMode=t),this._set("mode",t)}get updating(){return this.drawOperation?.updating??!1}get undoRedo(){const{view:{type:t,map:e}}=this;return"2d"===t&&e&&"undoRedo"in e&&e.undoRedo instanceof o?e.undoRedo:null}set undoRedo(t){this._override("undoRedo",t)}completeCreateOperation(){this.drawOperation.complete()}onInputEvent(t){this.destroyed||R(t,this.tooltip)||this.drawOperation.onInputEvent(t)}redo(){this.drawOperation.redo()}reset(){}undo(){this.drawOperation.undo(),0===this.drawOperation.numCommittedVertices&&x(this._tooltipsContext)}_destroyAllVisualizations(){this.removeHandles(I.outline),this.removeHandles(I.regularVertices),this.removeHandles(I.activeVertex),this.removeHandles(I.activeEdge),this.removeHandles(E)}_createOrUpdateGraphic(t){if(null!=this._graphic)return this.updateGraphicGeometry(t),this._graphic;const o=new e({...this.graphicProperties,symbol:this.graphicSymbol});return this._graphic=o,this.updateGraphicGeometry(t),this.internalGraphicsLayer.add(o),this.addHandles(this.initializeGraphic(o)),this.notifyChange("graphic"),this.addHandles(i(()=>{this.internalGraphicsLayer.remove(o),this._graphic===o&&(this._graphic=null)}),E),o}updateGraphicGeometry(t){this._graphic.geometry=t}_getCreateOperationGeometry(t={operationComplete:!1}){if(null==this.drawOperation)return;const{coordinateHelper:e,view:o,visualizationCursorVertex:r,lastVertex:i,committedVertices:s,geometryIncludingUncommittedVertices:a,numCommittedVertices:n}=this.drawOperation;if(!(n>0||null!=r))return;const l=t.operationComplete?s:a,p=l.length,c=null!=r?e.pointToArray(r):null,d=this._drawSpatialReference,h="3d"===o.type&&"global"===o.viewingMode,G=new m;G.committedVertices=s,G.cursorVertex=c;const{geometryType:x}=this;switch(x){case"point":case"mesh":G.full=e.arrayToPoint(l[0]);break;case"multipoint":G.full=p>0?w(l,d):null;break;case"polyline":case"polygon":p>0&&(G.full="polygon"===x?O([l],d,h,!0):_([l],d,h),G.cursorEdge=null!=c&&i&&!u(r,i)?_([[c,e.pointToArray(i)]],d,h):null,G.outline=p>1?G.full:null);break;case"circle":case"rectangle":{if(G.committedVertices=G.cursorVertex=null,!p)break;const e=C(o,l[0]),r=l[0],i=e.makeMapPoint(r[0]+D*o.resolution,r[1]);"circle"===x?1===p&&t.operationComplete?G.circle=y([r,i],e,!0):2===p&&(this.forceUniformSize?G.circle=y(l,e,this.centered):G.rectangle=g(l,e,this.centered)):1===p&&t.operationComplete?G.rectangle=v([r,i],e,!0):2===p&&(G.rectangle=this.forceUniformSize?v(l,e,this.centered):f(l,e,this.centered)),G.full=null!=G.circle?G.circle.geometry:G.rectangle?.geometry,G.outline="polygon"===G.full?.type?G.full:null;break}default:return null}return G}initializeGraphic(t){return i()}onComplete(t){if(!this.drawOperation)return;this._updateGraphic();let e=null;if(this.drawOperation.isCompleted){const t=this._getCreateOperationGeometry({operationComplete:!0});null!=t&&(e=this._createOrUpdateGraphic(t.full))}this._createOperationGeometry=null,this.emit("complete",{graphic:e,...t})}onCursorUpdate(t){this._updateGraphic(),this.emit("cursor-update",t)}onDeactivate(){const{drawOperation:t}=this;t&&(t.isCompleted||t.cancel())}onOutlineChanged(t){return i()}onCursorEdgeChanged(t){return i()}onVertexAdd(t){b(this._tooltipsContext),this._updateGraphic(),this.elevationLockOnVertexAddDisabled||k(t.vertices.at(0)?.coordinates,this._tooltipsContext),this.emit("vertex-add",t)}onVertexRemove(t){b(this._tooltipsContext),this._updateGraphic(),this.emit("vertex-remove",t)}onVertexUpdate(t){this._updateGraphic(),this.emit("vertex-update",t)}_updateGraphic(){const t=this._getCreateOperationGeometry();this._createOperationGeometry=t,null!=t?(null!=t.cursorEdge?this.addHandles(this.onCursorEdgeChanged(t.cursorEdge),I.activeEdge):this.removeHandles(I.activeEdge),null!=t.outline?this.addHandles(this.onOutlineChanged(t.outline),I.outline):this.removeHandles(I.outline),null!=t.committedVertices?this.addHandles(this.onRegularVerticesChanged(t.committedVertices),I.regularVertices):this.removeHandles(I.regularVertices),null!=t.cursorVertex?this.addHandles(this.onActiveVertexChanged(t.cursorVertex),I.activeVertex):this.removeHandles(I.activeVertex),null!=t.full?this._createOrUpdateGraphic(t.full):this.removeHandles(E)):this._destroyAllVisualizations()}get activeTooltipInfo(){return this._coordinateFormatterLoadTask?.finished?S(this._tooltipsContext):null}};t([p()],A.prototype,"_coordinateFormatterLoadTask",void 0),t([p()],A.prototype,"_createOperationGeometry",void 0),t([p()],A.prototype,"_tooltipsContext",null),t([p({value:!0})],A.prototype,"centered",null),t([p()],A.prototype,"cursor",null),t([p({nonNullable:!0})],A.prototype,"defaultZ",void 0),t([p({constructOnly:!0})],A.prototype,"directionOptions",void 0),t([p()],A.prototype,"drawOperation",void 0),t([p()],A.prototype,"elevationLockOnVertexAddDisabled",void 0),t([p({value:!0})],A.prototype,"enabled",null),t([p({value:!0})],A.prototype,"forceUniformSize",null),t([p({constructOnly:!0})],A.prototype,"geometryType",void 0),t([p()],A.prototype,"graphic",null),t([p({constructOnly:!0})],A.prototype,"graphicProperties",void 0),t([p()],A.prototype,"graphicSymbol",null),t([p({constructOnly:!0})],A.prototype,"hasZ",void 0),t([p({constructOnly:!0})],A.prototype,"geometryToPlace",void 0),t([p()],A.prototype,"mode",null),t([p()],A.prototype,"snappingManager",void 0),t([p()],A.prototype,"snapToScene",void 0),t([p()],A.prototype,"tooltip",void 0),t([p()],A.prototype,"tooltipInfos",void 0),t([p({constructOnly:!0,type:j})],A.prototype,"sketchOptions",void 0),t([p()],A.prototype,"updating",null),t([p({constructOnly:!0,nonNullable:!0})],A.prototype,"view",void 0),t([p({constructOnly:!0})],A.prototype,"automaticAreaMeasurementUtils",void 0),t([p({constructOnly:!0})],A.prototype,"automaticLengthMeasurementUtils",void 0),t([p({constructOnly:!0})],A.prototype,"undoRedo",null),t([p()],A.prototype,"activeTooltipInfo",null),A=t([c("esri.views.draw.DrawGraphicTool")],A);const E=Symbol("create-operation-graphic"),I={outline:Symbol("outline-visual"),regularVertices:Symbol("regular-vertices-visual"),activeVertex:Symbol("active-vertex-visual"),activeEdge:Symbol("active-edge-visual")};function M(t){switch(t){case"point":case"polyline":case"polygon":case"multipoint":return t;case"circle":case"rectangle":return"segment";case"mesh":return"point"}}const D=48;export{A as DrawGraphicTool,M as geometryTypeToDrawOperationGeometryType};
|
|
5
|
+
import{__decorate as t}from"tslib";import e from"../../Graphic.js";import{UndoRedo as o}from"../../UndoRedo.js";import{createTask as r}from"../../core/asyncUtils.js";import{makeHandle as i}from"../../core/handleUtils.js";import{destroyMaybe as s}from"../../core/maybe.js";import{watch as a,syncAndInitial as n,sync as l}from"../../core/reactiveUtils.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import{load as d}from"../../geometry/coordinateFormatter.js";import h from"../../layers/GraphicsLayer.js";import{pointEquals as u}from"../../layers/graphics/dehydratedFeatureComparison.js";import{CreateOperationGeometry as m}from"./support/CreateOperationGeometry.js";import{createCircle as y,createEllipse as g,createSquare as v,createRectangle as f,createPolygon as O,createPolyline as _,createMultipoint as w}from"./support/createUtils.js";import{createViewAlignedCoordinateSystem as C}from"./support/surfaceCoordinateSystems.js";import{createTooltipInfos as G,initializeConstraints as x,updateTooltipInfo as V,getConstraintZ as U,unlockConstraintsOnVertexAddOrRemove as b,lockElevationOnVertexAdd as k,getActiveTooltipInfo as S}from"./support/tooltipUtils.js";import{InteractiveToolBase as T}from"../interactive/InteractiveToolBase.js";import j from"../interactive/sketch/SketchOptions.js";import{makeTooltip as L,pasteLocation as H,enterInputModeIfAvailable as R}from"../interactive/tooltip/tooltipCommonUtils.js";import{autorun as z}from"../../core/accessorSupport/trackingUtils.js";let A=class extends T{constructor(t){super(t),this._graphic=null,this._coordinateFormatterLoadTask=null,this._createOperationGeometry=null,this.defaultZ=0,this.directionOptions=null,this.elevationLockOnVertexAddDisabled=!1,this.geometryType=null,this.hasZ=!0,this.geometryToPlace=null,this.snappingManager=null,this.snapToScene=!1,this.sketchOptions=new j}initialize(){const{view:t}=this;this.internalGraphicsLayer=new h({listMode:"hide",internal:!0,title:"DrawGraphicTool layer"}),this.view.map.layers.add(this.internalGraphicsLayer);const e=this.drawOperation=this.makeDrawOperation();this.tooltipInfos=G(t.type,this.sketchOptions);const o=L(()=>({view:t,options:this.sketchOptions.tooltips}));this.tooltip=o,x(this._tooltipsContext),this._coordinateFormatterLoadTask=r(()=>d()),this.addHandles([e.on("vertex-add",t=>this.onVertexAdd(t)),e.on("vertex-remove",t=>this.onVertexRemove(t)),e.on("vertex-update",t=>this.onVertexUpdate(t)),e.on("cursor-update",t=>this.onCursorUpdate(t)),e.on("cursor-remove",()=>this._updateGraphic()),e.on("complete",t=>this.onComplete(t)),this._coordinateFormatterLoadTask,o.on("paste",t=>H(t,this.activeTooltipInfo)),a(()=>this.cursor,t=>{e.cursor=t},n),z(()=>{const{activeTooltipInfo:t,sketchOptions:e}=this;V(t,this._tooltipsContext),o.info=e.tooltips.effectiveEnabled?t:null}),z(()=>{e.constraintZ=U(this._tooltipsContext)},l)]),this.finishToolCreation(),e.initializePointer()}destroy(){this.drawOperation=s(this.drawOperation),this.tooltip=s(this.tooltip),this._destroyAllVisualizations(),this.view.map.remove(this.internalGraphicsLayer),this.internalGraphicsLayer=s(this.internalGraphicsLayer),this._set("view",null)}get _drawSpatialReference(){return this.drawOperation.coordinateHelper.spatialReference}get _tooltipsContext(){const{defaultZ:t,directionOptions:e,drawOperation:o,forceUniformSize:r,geometryType:i,graphic:s,sketchOptions:a,tooltipInfos:n,view:l,automaticAreaMeasurementUtils:p,automaticLengthMeasurementUtils:c}=this;return{createOperationGeometry:this._createOperationGeometry,defaultZ:t,directionOptions:e,drawOperation:o,forceUniformSize:r,geometryType:i,graphic:s,sketchOptions:a,tooltipInfos:n,view:l,automaticAreaMeasurementUtils:p,automaticLengthMeasurementUtils:c}}get canRedo(){return this.drawOperation.canRedo}get canUndo(){return this.drawOperation.canUndo}set centered(t){this._set("centered",t),this._updateGraphic()}get cursor(){return this._get("cursor")}set cursor(t){this._set("cursor",t)}set enabled(t){this.drawOperation.interactive=t,this._set("enabled",t)}set forceUniformSize(t){this._set("forceUniformSize",t),this._updateGraphic()}get graphic(){return this._graphic}set graphicSymbol(t){this._set("graphicSymbol",t),null!=this._graphic&&(this._graphic.symbol=t)}set mode(t){const e=this.drawOperation;e&&(e.drawingMode=t),this._set("mode",t)}get updating(){return this.drawOperation?.updating??!1}get undoRedo(){const{view:{type:t,map:e}}=this;return"2d"===t&&e&&"undoRedo"in e&&e.undoRedo instanceof o?e.undoRedo:null}set undoRedo(t){this._override("undoRedo",t)}completeCreateOperation(){this.drawOperation.complete()}onInputEvent(t){this.destroyed||R(t,this.tooltip)||this.drawOperation.onInputEvent(t)}redo(){this.drawOperation.redo()}reset(){}undo(){this.drawOperation.undo(),0===this.drawOperation.numCommittedVertices&&x(this._tooltipsContext)}_destroyAllVisualizations(){this.removeHandles(I.outline),this.removeHandles(I.regularVertices),this.removeHandles(I.activeVertex),this.removeHandles(I.activeEdge),this.removeHandles(E)}_createOrUpdateGraphic(t){if(null!=this._graphic)return this.updateGraphicGeometry(t),this._graphic;const o=new e({...this.graphicProperties,symbol:this.graphicSymbol});return this._graphic=o,this.updateGraphicGeometry(t),this.internalGraphicsLayer.add(o),this.addHandles(this.initializeGraphic(o)),this.notifyChange("graphic"),this.addHandles(i(()=>{this.internalGraphicsLayer.remove(o),this._graphic===o&&(this._graphic=null)}),E),o}updateGraphicGeometry(t){this._graphic.geometry=t}_getCreateOperationGeometry(t={operationComplete:!1}){if(null==this.drawOperation)return;const{coordinateHelper:e,view:o,visualizationCursorVertex:r,lastVertex:i,committedVertices:s,geometryIncludingUncommittedVertices:a,numCommittedVertices:n}=this.drawOperation;if(!(n>0||null!=r))return;const l=t.operationComplete?s:a,p=l.length,c=null!=r?e.pointToArray(r):null,d=this._drawSpatialReference,h="3d"===o.type&&"global"===o.viewingMode,G=new m;G.committedVertices=s,G.cursorVertex=c;const{geometryType:x}=this;switch(x){case"point":case"mesh":G.full=e.arrayToPoint(l[0]);break;case"multipoint":G.full=p>0?w(l,d):null;break;case"polyline":case"polygon":p>0&&(G.full="polygon"===x?O([l],d,h,!0):_([l],d,h),G.cursorEdge=null!=c&&i&&!u(r,i)?_([[c,e.pointToArray(i)]],d,h):null,G.outline=p>1?G.full:null);break;case"circle":case"rectangle":{if(G.committedVertices=G.cursorVertex=null,!p)break;const e=C(o,l[0]),r=l[0],i=e.makeMapPoint(r[0]+D*o.resolution,r[1]);"circle"===x?1===p&&t.operationComplete?G.circle=y([r,i],e,!0):2===p&&(this.forceUniformSize?G.circle=y(l,e,this.centered):G.rectangle=g(l,e,this.centered)):1===p&&t.operationComplete?G.rectangle=v([r,i],e,!0):2===p&&(G.rectangle=this.forceUniformSize?v(l,e,this.centered):f(l,e,this.centered)),G.full=null!=G.circle?G.circle.geometry:G.rectangle?.geometry,G.outline="polygon"===G.full?.type?G.full:null;break}default:return null}return G}initializeGraphic(t){return i()}onComplete(t){if(!this.drawOperation)return;this._updateGraphic();let e=null;if(this.drawOperation.isCompleted){const t=this._getCreateOperationGeometry({operationComplete:!0});null!=t&&(e=this._createOrUpdateGraphic(t.full))}this._createOperationGeometry=null,this.emit("complete",{graphic:e,...t})}onCursorUpdate(t){this._updateGraphic(),this.emit("cursor-update",t)}onDeactivate(){const{drawOperation:t}=this;t&&(t.isCompleted||t.cancel())}onOutlineChanged(t){return i()}onCursorEdgeChanged(t){return i()}onVertexAdd(t){b(this._tooltipsContext),this._updateGraphic(),this.elevationLockOnVertexAddDisabled||k(t.vertices.at(0)?.coordinates,this._tooltipsContext),this.emit("vertex-add",t)}onVertexRemove(t){b(this._tooltipsContext),this._updateGraphic(),this.emit("vertex-remove",t)}onVertexUpdate(t){this._updateGraphic(),this.emit("vertex-update",t)}_updateGraphic(){const t=this._getCreateOperationGeometry();this._createOperationGeometry=t,null!=t?(null!=t.cursorEdge?this.addHandles(this.onCursorEdgeChanged(t.cursorEdge),I.activeEdge):this.removeHandles(I.activeEdge),null!=t.outline?this.addHandles(this.onOutlineChanged(t.outline),I.outline):this.removeHandles(I.outline),null!=t.committedVertices?this.addHandles(this.onRegularVerticesChanged(t.committedVertices),I.regularVertices):this.removeHandles(I.regularVertices),null!=t.cursorVertex?this.addHandles(this.onActiveVertexChanged(t.cursorVertex),I.activeVertex):this.removeHandles(I.activeVertex),null!=t.full?this._createOrUpdateGraphic(t.full):this.removeHandles(E)):this._destroyAllVisualizations()}get activeTooltipInfo(){return this._coordinateFormatterLoadTask?.finished?S(this._tooltipsContext):null}};t([p()],A.prototype,"_coordinateFormatterLoadTask",void 0),t([p()],A.prototype,"_createOperationGeometry",void 0),t([p()],A.prototype,"_tooltipsContext",null),t([p({value:!0})],A.prototype,"centered",null),t([p()],A.prototype,"cursor",null),t([p({nonNullable:!0})],A.prototype,"defaultZ",void 0),t([p({constructOnly:!0})],A.prototype,"directionOptions",void 0),t([p()],A.prototype,"drawOperation",void 0),t([p()],A.prototype,"elevationLockOnVertexAddDisabled",void 0),t([p({value:!0})],A.prototype,"enabled",null),t([p({value:!0})],A.prototype,"forceUniformSize",null),t([p({constructOnly:!0})],A.prototype,"geometryType",void 0),t([p()],A.prototype,"graphic",null),t([p({constructOnly:!0})],A.prototype,"graphicProperties",void 0),t([p()],A.prototype,"graphicSymbol",null),t([p({constructOnly:!0})],A.prototype,"hasZ",void 0),t([p({constructOnly:!0})],A.prototype,"geometryToPlace",void 0),t([p()],A.prototype,"mode",null),t([p()],A.prototype,"snappingManager",void 0),t([p()],A.prototype,"snapToScene",void 0),t([p()],A.prototype,"tooltip",void 0),t([p()],A.prototype,"tooltipInfos",void 0),t([p({constructOnly:!0,type:j})],A.prototype,"sketchOptions",void 0),t([p()],A.prototype,"updating",null),t([p({constructOnly:!0,nonNullable:!0})],A.prototype,"view",void 0),t([p({constructOnly:!0})],A.prototype,"automaticAreaMeasurementUtils",void 0),t([p({constructOnly:!0})],A.prototype,"automaticLengthMeasurementUtils",void 0),t([p({constructOnly:!0})],A.prototype,"undoRedo",null),t([p()],A.prototype,"activeTooltipInfo",null),A=t([c("esri.views.draw.DrawGraphicTool")],A);const E=Symbol("create-operation-graphic"),I={outline:Symbol("outline-visual"),regularVertices:Symbol("regular-vertices-visual"),activeVertex:Symbol("active-vertex-visual"),activeEdge:Symbol("active-edge-visual")};function M(t){switch(t){case"point":case"polyline":case"polygon":case"multipoint":return t;case"circle":case"rectangle":return"segment";case"mesh":return"point"}}const D=48;export{A as DrawGraphicTool,M as geometryTypeToDrawOperationGeometryType};
|