@arcgis/core 4.32.0-next.20250104 → 4.32.0-next.20250106
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/13720b1d97fb7d80e972.js +1 -0
- package/assets/esri/core/workers/chunks/{00c0fbe19c12691cf2c3.js → 368a36be515e60e35154.js} +1 -1
- package/core/MemCachePool.js +1 -1
- package/interfaces.d.ts +90 -0
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/webgl/Painter.js +1 -1
- package/views/2d/engine/webgl/meshing/Mesh.js +1 -1
- package/views/2d/engine/webgl/meshing/SimpleMesh.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/GLSLShaderModule.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/GraphShaderModule.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityResources.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/overlay/OverlayTechnique.js +1 -1
- package/views/2d/input/MapViewInputManager.js +1 -1
- package/views/2d/input/handlers/DragPan.js +1 -1
- package/views/2d/input/handlers/DragRotate.js +1 -1
- package/views/2d/input/handlers/MouseWheelZoom.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
- package/views/3d/input/SceneInputManager.js +1 -1
- package/views/3d/input/handlers/DragRotate.js +1 -1
- package/views/3d/input/handlers/DragZoom.js +1 -1
- package/views/3d/input/handlers/MouseWheelZoom.js +1 -1
- package/views/3d/input/handlers/PinchAndPanNavigation.js +1 -1
- package/views/3d/layerViewModuleImportUtils.js +1 -1
- package/views/3d/layers/GroupLayerView3D.js +5 -0
- package/views/3d/terrain/OverlayManager.js +1 -1
- package/views/3d/webgl-engine/lib/Intersector.js +1 -1
- package/views/View2D.js +1 -1
- package/views/input/handlers/support.js +1 -1
- package/views/navigation/Navigation.js +1 -1
- package/views/navigation/NavigationActionMap.d.ts +4 -0
- package/views/navigation/NavigationActionMap.js +5 -0
- package/widgets/ElevationProfile/ElevationProfileLineView.js +1 -1
- package/widgets/NavigationToggle/NavigationToggleViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/3582836342fa78873fe4.js +0 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{_ as r}from"../../../chunks/tslib.es6.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import e from"../../layers/GroupLayerView.js";let t=class extends e{constructor(){super(...arguments),this.type="group"}};r([o()],t.prototype,"view",void 0),t=r([s("esri.views.3d.layers.GroupLayerView3D")],t);const p=t;export{p 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.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{Cyclical as r,cyclicalPI as s}from"../../../core/Cyclical.js";import has from"../../../core/has.js";import{clamp as i,deg2rad as a}from"../../../core/mathUtils.js";import{destroyMaybe as n}from"../../../core/maybe.js";import{watch as o,sync as l}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{subtract as d}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{g as u,d as p,y as _,c as m,j as y}from"../../../chunks/vec32.js";import{create as g}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{t as f,b as v,g as R}from"../../../chunks/vec42.js";import{create as O,fromValues as w}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as x}from"../../../geometry/ellipsoidUtils.js";import{projectVectorToVector as T}from"../../../geometry/projection/projectVectorToVector.js";import{create as D,width as S,copy as E,center as P,height as M,intersection as b,contains as j,intersects as I,offset as C}from"../../../geometry/support/aaBoundingRect.js";import{create as N,wrap as U}from"../../../geometry/support/ray.js";import{k as A,b as G,t as V}from"../../../chunks/sphere.js";import{angleAroundAxis as F}from"../../../geometry/support/vector.js";import{y2lat as L}from"../../../geometry/support/webMercatorUtils.js";import{viewAngle as q}from"../state/utils/viewUtils.js";import{debugFlags as B}from"../support/debugFlags.js";import{PointGraphics as H}from"../support/debugUtils.js";import{OverlayIndex as k}from"./interfaces.js";import{OverlayRenderer as Y}from"./OverlayRenderer.js";import{RenderRequestType as z}from"../webgl-engine/lib/basicInterfaces.js";import{newIntersector as W}from"../webgl-engine/lib/Intersector.js";import{fromValues as X}from"../webgl-engine/lib/LocalOriginFactory.js";import{SortedRenderGeometryRenderer as K}from"../webgl-engine/lib/SortedRenderGeometryRenderer.js";import{applyTextureResizeModulo as Z}from"../webgl-engine/lib/textureUtils.js";import{removeLoadedShaderModules as J}from"../webgl-engine/parts/renderUtils.js";import{TaskPriority as Q,noBudget as $}from"../../support/Scheduler.js";import{Yield as ee}from"../../support/Yield.js";const te=1.3,re=[[-.1,-2,3.9,2],[-.1,-3.9,3.9,.1],[-2,-3.9,2,.1],[-3.9,-3.9,.1,.1],[-3.9,-2,.1,2],[-3.9,-.1,.1,3.9],[-2,-.1,2,3.9],[-.1,-.1,3.9,3.9]];let se,ie=class extends t{constructor(e){super(e),this._spatialReference=null,this._renderSR=null,this._overlaySREqualsRenderSR=!0,this._drapeSources=new Set,this._drapeTargets=new Set,this._placementDirty=!1,this._contentUpdated=!1,this._drawTexturesDirty=!1,this._drawTexturesAnimateDirty=!1,this._longitudeCyclical=null,this._latestOriginId=0,this._maxResolution=has("esri-mobile")?2048:4096}initialize(){const e=this.view;this.renderer=new Y({view:e,worldToPCSRatio:this._worldToPCSRatio,spatialReference:this._spatialReference}),e._stage.renderer.plugins.add(this.renderer);const t=()=>this.setDrawTexturesDirty();this._groundIntersector=W(this.view.state.viewingMode),this._groundIntersector.options.backfacesTerrain=!0,this._groundIntersector.options.invisibleTerrain=!0,this._groundIntersector.options.hud=!1,this.addHandles([o((()=>this.renderer.hasHighlights),t),this.renderer.events.on("has-water",(()=>e._stage?.renderer.updateHasFlags())),this.renderer.events.on("content-changed",t),o((()=>e.state.camera.pixelRatio),t),o((()=>e.state.alignPixelEnabled),t),this.renderer.events.on("textures-disposed",(()=>this.surface.requestRender())),o((()=>[e.pointsOfInterest?.renderPointOfView,e.pointsOfInterest?.centerOnSurfaceFrequent?.location]),(()=>this.setPlacementDirty())),o((()=>[e.state?.pixelRatio,e.state?.contentPixelRatio]),(()=>this.setPlacementDirty()),l),this.surface.on("elevation-change",(()=>this.setPlacementDirty())),e.on("resize",(()=>this.setPlacementDirty())),e.resourceController.scheduler.registerTask(Q.OVERLAY,this),e._stage.renderView.events.on("force-camera-for-screenshot",(e=>{this._updateOverlays($,e.camera,z.BACKGROUND),this.renderer.hasOverlays&&this._drawOverlays(z.BACKGROUND,e)}))]),e._stage.renderer.overlay=this}destroy(){this.view?._stage&&(this.view._stage.renderer.plugins.remove(this.renderer),this.view._stage.renderer.overlay=null),se&&(se.hide(),se=null),this.renderer=n(this.renderer)}get running(){return this._placementDirty&&(this._drapeSources.size>0||this.view.graphics.length>0||B.OVERLAY_DRAW_DEBUG_TEXTURE)&&!!this._spatialReference&&!this.suspended&&this.surface.ready}get _isSpherical(){return this.view.state.isGlobal}get _worldToPCSRatio(){return null!=this._spatialReference&&this._spatialReference.isGeographic&&!this.view.state.isLocal?x(this._spatialReference).metersPerDegree:1}get _overlayStretch(){return te/this.view.resolutionScale}get suspended(){return this.surface.suspended}get updating(){return this.running||this.renderer.updating||this._contentUpdated}get rendersOccludedDraped(){return this.renderer.rendersOccludedDraped}render(){if(this._contentUpdated=!1,this.renderer.processSyncDrapeSources(),this.renderer.hasOverlays)return this._precompileShaders()?this._drawOverlays(z.UPDATE):null}get hasOverlays(){return this.renderer.hasOverlays}setSpatialReference(e){this._spatialReference=e,this.renderer.spatialReference=e,this._longitudeCyclical=null;const t=this.view.renderSpatialReference;null!=e&&null!=t?(this._renderSR=t,this._overlaySREqualsRenderSR=e.equals(this._renderSR),this._isSpherical&&(this._longitudeCyclical=e.isWebMercator?new r(-20037508.342787,20037508.342787):new r(-180,180),this.renderer.longitudeCyclical=this._longitudeCyclical),this.renderer&&(this.renderer.worldToPCSRatio=this._worldToPCSRatio)):this.renderer.disposeOverlays()}registerDrapeSource(e,t,r){this._drapeSources.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources);const s=this.renderer.createDrapeSourceRenderer(e,t,r);return this._updateDrapeSourceExtent(e),this._setContentDirty(),this.notifyChange("running"),s}registerGeometryDrapeSource(e){return this.registerDrapeSource(e,K)}_updateDrapeSourceExtent(e){2===this.renderer.overlays.length&&null!=e.setDrapingExtent&&null!=this._spatialReference&&e.setDrapingExtent(this.renderer.overlays,this._spatialReference)}unregisterDrapeSource(e){this._drapeSources.has(e)&&(this._drapeSources.delete(e),this.renderer.removeDrapeSourceRenderer(e),this.renderer.ensureDrapeSources(this._drapeSources),this._setContentDirty(),this.notifyChange("running"))}registerDrapeTarget(e){this._drapeTargets.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources)}unregisterDrapeTarget(e){this._drapeTargets.delete(e),this.renderer.ensureDrapeTargets(this._drapeTargets)}_setContentDirty(){this.setPlacementDirty(),this.setDrawTexturesDirty()}setPlacementDirty(){this._placementDirty=!0}runTask(e){return this._updateOverlays(e,this.view.state.contentCamera,z.UPDATE)}_updateOverlays(e,t,r){if(!this._spatialReference)return ee;const s=this._computeOverlayResolution(t);this._computeOverlayExtents(t,s,he),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources,he.stretch);const i=this._updateOverlay(k.INNER,he.inner,s,1*he.pixelRatioAdjustment,he.mapUnitsPerPixel),a=S(he.inner)/S(he.outer),n=this._updateOverlay(k.OUTER,he.outer,s,a*he.pixelRatioAdjustment,he.mapUnitsPerPixel);i!==pe.EXTENT&&n!==pe.EXTENT||(this._drapeSources.forEach((e=>this._updateDrapeSourceExtent(e))),this.surface.updateTileOverlayParams(r)),i===pe.NONE&&n===pe.NONE||this.setDrawTexturesDirty(),this._placementDirty=!1,e.madeProgress()}_computeOverlayResolution(e){const t=this.view.state.contentPixelRatio*this.view.resolutionScale,r=e.fullWidth/e.pixelRatio*t,s=e.fullHeight/e.pixelRatio*t,i=Math.ceil(1.5*Math.max(r,s));return Math.min(Z(i),this._maxResolution)}_updateOverlay(e,t,r,s,i){if(0===this.renderer.overlays.length)return pe.NONE;const a=this.renderer.overlays[e],n=a.mapUnitsPerPixel;if(a.mapUnitsPerPixel=i,a.pixelRatio=s,ae(t,a.extent)&&r===a.resolution)return n===i?pe.NONE:pe.RERENDER_ONLY;E(a.extent,t),a.resolution=r;const o=P(a.extent);return a.renderLocalOrigin=X(o[0],o[1],0,"OV_"+this._latestOriginId++),pe.EXTENT}setTileParameters(e){const t=e.renderData.overlay;if(this.renderer.overlays.length>0){const r=this.renderer.overlays[k.INNER],s=this.renderer.overlays[k.OUTER],i=e.extent;this._rectInsideRect(r.extent,i)||this._rectanglesOverlap(i,r.extent)||this._rectanglesOverlap(i,s.extent)?(this._setTileOverlayData(i,k.INNER,t),this._setTileOverlayData(i,k.OUTER,t)):(this._clearTileOverlayData(k.INNER,t),this._clearTileOverlayData(k.OUTER,t))}else this._clearTileOverlayData(k.INNER,t),this._clearTileOverlayData(k.OUTER,t)}overlayPixelSizeInMapUnits(e,t){if(0===this.renderer.overlays.length)return t();const r=this.renderer.overlays[k.INNER],s=this.renderer.overlays[k.OUTER],i=this._pointIsInExtent(e,r.extent)?r:s;return(i.extent[2]-i.extent[0])/i.resolution}_setTileOverlayData(e,t,r){if(0===this.renderer.overlays.length)return;const s=this.renderer.overlays[t].extent,i=S(s),a=M(s);let n=e[0];if(this._longitudeCyclical){n=this._longitudeCyclical.minimalMonotonic(s[0],n);const t=this._longitudeCyclical.minimalMonotonic(s[0],e[2]);n>t&&(n=t-(e[2]-e[0]))}r.setScale(t,S(e)/i,M(e)/a),r.setOffset(t,(n-s[0])/i,(e[1]-s[1])/a)}_clearTileOverlayData(e,t){t.setScale(e,-1,-1),t.setOffset(e,-1,-1)}reloadShaders(){J(),this.setDrawTexturesDirty(),this.runTask($)}updateAnimation(e){return this.renderer.updateAnimation(e)&&(this._drawTexturesAnimateDirty=!0),this._drawTexturesAnimateDirty}setDrawTexturesDirty(){this.renderer.hasOverlays?(this._contentUpdated=!0,this._drawTexturesDirty=!0,this.view._stage.renderView.requestRender()):this.setPlacementDirty()}_intersectGroundFromView(e,t,r,s){const i=this.view.sceneIntersectionHelper.getCenterRayWithSubpixelOffset(e,ue,t,r);if(null==i)return!1;const a=i.origin,n=u(le,i.origin,i.direction);return this._groundIntersector.reset(a,n,e),this._groundIntersector.intersect([]),this.view.basemapTerrain.intersect(this._groundIntersector,null,a,n),this._groundIntersector.results.min.getIntersectionPoint(s)}_findHorizonBasedPointOfInterest(e,t){let r=.5;const a=.55,n=this.view.renderCoordsHelper.getAltitude(e.eye),o=this.view.pointsOfInterest.centerOnSurfaceFrequent,l=1e-5,h=i(o.estimatedSurfaceAltitude,e.aboveGround?-1/0:n+l,e.aboveGround?n-l:1/0),c=e.aboveGround;if("global"===this.view.viewingMode){const t=le;A(G(V,x(this.view.spatialReference).radius+h),U(e.eye,e.viewForward),t),p(t,t,e.eye);const i=s.normalize(F(e.viewForward,t,e.viewRight))/e.fovY+.5,n=i<=0||i>=1?.5:a;r=c?n*i:i+n*(1-i)}else{const t=.5*Math.PI-Math.acos(-e.viewForward[2]),s=Math.tan(t),n=w(0,s,1,0),o=f(n,n,e.projectionMatrix)[1],l=i(.5+.5*o,0,1);r=1===l||0===l?.5:c?l*a:1-(1-l)*a}return!!this._intersectGroundFromView(e,.5,r,t)&&_(t,e.eye)<o.distance*o.distance}_computeOverlayExtents(e,t,r){const s=this.view.pointsOfInterest.centerOnSurfaceFrequent.renderLocation,i=g();this._findHorizonBasedPointOfInterest(e,i)||m(i,s),B.OVERLAY_SHOW_CENTER?(null==se&&(se=new H(this.view.graphics,"red")),se.show(i,this._renderSR)):null!=se&&se.hide();const n=Math.max(.1,y(e.eye,i)),o=q(this.view.renderCoordsHelper,s,e.eye);this._overlaySREqualsRenderSR||T(i,this._renderSR,i,this._spatialReference);const l=this.surface.extent,h=!this._isSpherical&&this._spatialReference?.isGeographic,c=h&&this._spatialReference?1/x(this._spatialReference).metersPerDegree:1,u=this.view.state.contentPixelRatio,p=e.perScreenPixelRatio/u*n*c;r.mapUnitsPerPixel=p/this._worldToPCSRatio,r.stretch=this._overlayStretch;let _=t*p/2*r.stretch,f=!1,O=h?90:1/0;this._isSpherical&&l&&this._spatialReference&&(this._spatialReference.isWebMercator?(_/=Math.cos(L(i[1])),O=l[3]):(f=!0,_/=x(this._spatialReference).metersPerDegree,O=90),_>=O&&(_=O,i[1]=0,this._spatialReference.isWebMercator&&(i[0]=0)));let w=1;f&&(w=1/Math.max(.2,Math.cos(Math.abs(a(i[1])))),_*w>180&&(w=180/_),r.mapUnitsPerPixel*=w);const D=Math.log(2)/12;_=Math.exp(Math.round(Math.log(_)/D)*D);const P=_*w,M=32,I=.5*t/(M*P),C=.5*t/(M*_);i[0]=Math.round(i[0]*I)/I,i[1]=Math.round(i[1]*C)/C;const N=r.inner;N[0]=i[0]-P,N[1]=i[1]-_,N[2]=i[0]+P,N[3]=i[1]+_,this._isSpherical&&this._shiftExtentToFitBounds(N,1/0,O);const U=r.outer;if(6*P>S(l))E(U,l);else{if(Math.PI/2-Math.abs(o-Math.PI/2)<=.25*Math.PI)U[0]=N[0]-P,U[1]=N[1]-_,U[2]=N[2]+P,U[3]=N[3]+_;else{T(e.eye,this._renderSR,le,this._spatialReference),d(oe,i,le);let t=-Math.atan2(oe[1],oe[0])+.125*Math.PI;t<0&&(t+=2*Math.PI);const r=Math.floor(t/(.25*Math.PI));v(oe,re[r],2*_),oe[0]*=w,oe[2]*=w,R(U,N,oe)}}if(this._isSpherical)U[0]=this._longitudeCyclical.clamp(U[0]),U[2]=this._longitudeCyclical.clamp(U[2]),U[1]=Math.max(U[1],-O),U[3]=Math.min(U[3],O);else{const e=b(N,l,ce),t=b(U,l,de);j(e,t)&&(U[2]=U[0],U[3]=U[1])}const A=Math.abs(N[2]-N[0])/t;r.mapUnitsPerPixel=Math.max(r.mapUnitsPerPixel,A),r.pixelRatioAdjustment=r.mapUnitsPerPixel/A}_precompileShaders(){return!!this.renderer.hasOverlays&&(this.renderer.precompileShaders(this.view.state),!0)}_drawOverlays(e,t=this.view.state){if(!this._drawTexturesDirty&&!this._drawTexturesAnimateDirty)return this.renderer;const r=this._drawTexturesDirty;this._drawTexturesDirty=this._drawTexturesAnimateDirty=!1;const s=this.renderer.computeValidity();this.renderer.releaseRenderTargets(),this.renderer.drawOverlays(t);return s!==this.renderer.computeValidity()&&this.surface.updateTileOverlayParams(z.UPDATE),r?(this.surface.requestRender(e),e===z.UPDATE&&this.surface.requestUpdate()):this.surface.requestRender(z.BACKGROUND),this.renderer}_rectanglesOverlap(e,t){return null!=e&&(this._longitudeCyclical?(this._longitudeCyclical.contains(t[0],t[2],e[0])||this._longitudeCyclical.contains(t[0],t[2],e[2])||this._longitudeCyclical.contains(e[0],e[2],t[0]))&&!(e[1]>t[3]||e[3]<t[1]):I(e,t))}_rectInsideRect(e,t){return null!=t&&(this._longitudeCyclical?this._longitudeCyclical.contains(e[0],e[2],t[0])&&this._longitudeCyclical.contains(e[0],e[2],t[2])&&t[1]>e[1]&&t[3]<e[3]:j(e,t))}_pointIsInExtent(e,t){if(this._longitudeCyclical)return this._longitudeCyclical.contains(t[0],t[2],e.x)&&e.y>=t[1]&&e.y<=t[3];const r=e.x,s=e.y;return r>t[0]&&r<t[2]&&s>t[1]&&s<t[3]}_shiftExtentToFitBounds(e,t,r){let s=0,i=0;e[0]<-t?s=e[0]+t:e[2]>t&&(s=t-e[2]),e[1]<-r?i=e[1]+r:e[3]>r&&(i=r-e[3]),C(e,s,i)}get test(){}};function ae(e,t){const r=1e-5,s=B.TESTS_DISABLE_OPTIMIZATIONS?0:r*Math.max(e[2]-e[0],e[3]-e[1],t[2]-t[0],t[3]-t[1]);return Math.abs(t[0]-e[0])<=s&&Math.abs(t[1]-e[1])<=s&&Math.abs(t[2]-e[2])<=s&&Math.abs(t[3]-e[3])<=s}e([h()],ie.prototype,"_spatialReference",void 0),e([h({readOnly:!0})],ie.prototype,"running",null),e([h()],ie.prototype,"_placementDirty",void 0),e([h()],ie.prototype,"_contentUpdated",void 0),e([h()],ie.prototype,"_isSpherical",null),e([h()],ie.prototype,"_worldToPCSRatio",null),e([h()],ie.prototype,"renderer",void 0),e([h({constructOnly:!0})],ie.prototype,"view",void 0),e([h({constructOnly:!0})],ie.prototype,"surface",void 0),e([h()],ie.prototype,"suspended",null),e([h()],ie.prototype,"updating",null),e([h({type:Boolean})],ie.prototype,"rendersOccludedDraped",null),ie=e([c("esri.views.3d.terrain.OverlayManager")],ie);class ne{constructor(){this.inner=D(),this.outer=D(),this.mapUnitsPerPixel=0,this.pixelRatioAdjustment=1,this.stretch=te}}const oe=O(),le=g(),he=new ne,ce=D(),de=D(),ue=N();var pe;!function(e){e[e.NONE=0]="NONE",e[e.EXTENT=1]="EXTENT",e[e.RERENDER_ONLY=2]="RERENDER_ONLY"}(pe||(pe={}));export{ie as OverlayManager};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{Cyclical as r,cyclicalPI as s}from"../../../core/Cyclical.js";import has from"../../../core/has.js";import{clamp as i,deg2rad as a}from"../../../core/mathUtils.js";import{destroyMaybe as n}from"../../../core/maybe.js";import{watch as o,sync as l}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{subtract as d}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{g as u,d as p,c as _,j as m}from"../../../chunks/vec32.js";import{create as y}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{t as g,b as f,g as v}from"../../../chunks/vec42.js";import{create as R,fromValues as w}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as O}from"../../../geometry/ellipsoidUtils.js";import{projectVectorToVector as x}from"../../../geometry/projection/projectVectorToVector.js";import{create as D,width as T,copy as S,center as E,height as P,intersection as M,contains as b,intersects as j,offset as I}from"../../../geometry/support/aaBoundingRect.js";import{create as C,wrap as N}from"../../../geometry/support/ray.js";import{k as U,b as A,t as G}from"../../../chunks/sphere.js";import{angleAroundAxis as V}from"../../../geometry/support/vector.js";import{y2lat as F}from"../../../geometry/support/webMercatorUtils.js";import{viewAngle as L}from"../state/utils/viewUtils.js";import{debugFlags as q}from"../support/debugFlags.js";import{PointGraphics as B}from"../support/debugUtils.js";import{OverlayIndex as H}from"./interfaces.js";import{OverlayRenderer as k}from"./OverlayRenderer.js";import{RenderRequestType as Y}from"../webgl-engine/lib/basicInterfaces.js";import{newIntersector as z}from"../webgl-engine/lib/Intersector.js";import{fromValues as W}from"../webgl-engine/lib/LocalOriginFactory.js";import{SortedRenderGeometryRenderer as X}from"../webgl-engine/lib/SortedRenderGeometryRenderer.js";import{applyTextureResizeModulo as K}from"../webgl-engine/lib/textureUtils.js";import{removeLoadedShaderModules as Z}from"../webgl-engine/parts/renderUtils.js";import{TaskPriority as J,noBudget as Q}from"../../support/Scheduler.js";import{Yield as $}from"../../support/Yield.js";const ee=1.3,te=[[-.1,-2,3.9,2],[-.1,-3.9,3.9,.1],[-2,-3.9,2,.1],[-3.9,-3.9,.1,.1],[-3.9,-2,.1,2],[-3.9,-.1,.1,3.9],[-2,-.1,2,3.9],[-.1,-.1,3.9,3.9]];let re,se=class extends t{constructor(e){super(e),this._spatialReference=null,this._renderSR=null,this._overlaySREqualsRenderSR=!0,this._drapeSources=new Set,this._drapeTargets=new Set,this._placementDirty=!1,this._contentUpdated=!1,this._drawTexturesDirty=!1,this._drawTexturesAnimateDirty=!1,this._longitudeCyclical=null,this._latestOriginId=0,this._maxResolution=has("esri-mobile")?2048:4096}initialize(){const e=this.view;this.renderer=new k({view:e,worldToPCSRatio:this._worldToPCSRatio,spatialReference:this._spatialReference}),e._stage.renderer.plugins.add(this.renderer);const t=()=>this.setDrawTexturesDirty();this._groundIntersector=z(this.view.state.viewingMode),this._groundIntersector.options.backfacesTerrain=!0,this._groundIntersector.options.invisibleTerrain=!0,this._groundIntersector.options.hud=!1,this.addHandles([o((()=>this.renderer.hasHighlights),t),this.renderer.events.on("has-water",(()=>e._stage?.renderer.updateHasFlags())),this.renderer.events.on("content-changed",t),o((()=>e.state.camera.pixelRatio),t),o((()=>e.state.alignPixelEnabled),t),this.renderer.events.on("textures-disposed",(()=>this.surface.requestRender())),o((()=>[e.pointsOfInterest?.renderPointOfView,e.pointsOfInterest?.centerOnSurfaceFrequent?.location]),(()=>this.setPlacementDirty())),o((()=>[e.state?.pixelRatio,e.state?.contentPixelRatio]),(()=>this.setPlacementDirty()),l),this.surface.on("elevation-change",(()=>this.setPlacementDirty())),e.on("resize",(()=>this.setPlacementDirty())),e.resourceController.scheduler.registerTask(J.OVERLAY,this),e._stage.renderView.events.on("force-camera-for-screenshot",(e=>{this._updateOverlays(Q,e.camera,Y.BACKGROUND),this.renderer.hasOverlays&&this._drawOverlays(Y.BACKGROUND,e)}))]),e._stage.renderer.overlay=this}destroy(){this.view?._stage&&(this.view._stage.renderer.plugins.remove(this.renderer),this.view._stage.renderer.overlay=null),re&&(re.hide(),re=null),this.renderer=n(this.renderer)}get running(){return this._placementDirty&&(this._drapeSources.size>0||this.view.graphics.length>0||q.OVERLAY_DRAW_DEBUG_TEXTURE)&&!!this._spatialReference&&!this.suspended&&this.surface.ready}get _isSpherical(){return this.view.state.isGlobal}get _worldToPCSRatio(){return null!=this._spatialReference&&this._spatialReference.isGeographic&&!this.view.state.isLocal?O(this._spatialReference).metersPerDegree:1}get _overlayStretch(){return ee/this.view.resolutionScale}get suspended(){return this.surface.suspended}get updating(){return this.running||this.renderer.updating||this._contentUpdated}get rendersOccludedDraped(){return this.renderer.rendersOccludedDraped}render(){if(this._contentUpdated=!1,this.renderer.processSyncDrapeSources(),this.renderer.hasOverlays)return this._precompileShaders()?this._drawOverlays(Y.UPDATE):null}get hasOverlays(){return this.renderer.hasOverlays}setSpatialReference(e){this._spatialReference=e,this.renderer.spatialReference=e,this._longitudeCyclical=null;const t=this.view.renderSpatialReference;null!=e&&null!=t?(this._renderSR=t,this._overlaySREqualsRenderSR=e.equals(this._renderSR),this._isSpherical&&(this._longitudeCyclical=e.isWebMercator?new r(-20037508.342787,20037508.342787):new r(-180,180),this.renderer.longitudeCyclical=this._longitudeCyclical),this.renderer&&(this.renderer.worldToPCSRatio=this._worldToPCSRatio)):this.renderer.disposeOverlays()}registerDrapeSource(e,t,r){this._drapeSources.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources);const s=this.renderer.createDrapeSourceRenderer(e,t,r);return this._updateDrapeSourceExtent(e),this._setContentDirty(),this.notifyChange("running"),s}registerGeometryDrapeSource(e){return this.registerDrapeSource(e,X)}_updateDrapeSourceExtent(e){2===this.renderer.overlays.length&&null!=e.setDrapingExtent&&null!=this._spatialReference&&e.setDrapingExtent(this.renderer.overlays,this._spatialReference)}unregisterDrapeSource(e){this._drapeSources.has(e)&&(this._drapeSources.delete(e),this.renderer.removeDrapeSourceRenderer(e),this.renderer.ensureDrapeSources(this._drapeSources),this._setContentDirty(),this.notifyChange("running"))}registerDrapeTarget(e){this._drapeTargets.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources)}unregisterDrapeTarget(e){this._drapeTargets.delete(e),this.renderer.ensureDrapeTargets(this._drapeTargets)}_setContentDirty(){this.setPlacementDirty(),this.setDrawTexturesDirty()}setPlacementDirty(){this._placementDirty=!0}runTask(e){return this._updateOverlays(e,this.view.state.contentCamera,Y.UPDATE)}_updateOverlays(e,t,r){if(!this._spatialReference)return $;const s=this._computeOverlayResolution(t);this._computeOverlayExtents(t,s,le),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources,le.stretch);const i=this._updateOverlay(H.INNER,le.inner,s,1*le.pixelRatioAdjustment,le.mapUnitsPerPixel),a=T(le.inner)/T(le.outer),n=this._updateOverlay(H.OUTER,le.outer,s,a*le.pixelRatioAdjustment,le.mapUnitsPerPixel);i!==ue.EXTENT&&n!==ue.EXTENT||(this._drapeSources.forEach((e=>this._updateDrapeSourceExtent(e))),this.surface.updateTileOverlayParams(r)),i===ue.NONE&&n===ue.NONE||this.setDrawTexturesDirty(),this._placementDirty=!1,e.madeProgress()}_computeOverlayResolution(e){const t=this.view.state.contentPixelRatio*this.view.resolutionScale,r=e.fullWidth/e.pixelRatio*t,s=e.fullHeight/e.pixelRatio*t,i=Math.ceil(1.5*Math.max(r,s));return Math.min(K(i),this._maxResolution)}_updateOverlay(e,t,r,s,i){if(0===this.renderer.overlays.length)return ue.NONE;const a=this.renderer.overlays[e],n=a.mapUnitsPerPixel;if(a.mapUnitsPerPixel=i,a.pixelRatio=s,ie(t,a.extent)&&r===a.resolution)return n===i?ue.NONE:ue.RERENDER_ONLY;S(a.extent,t),a.resolution=r;const o=E(a.extent);return a.renderLocalOrigin=W(o[0],o[1],0,"OV_"+this._latestOriginId++),ue.EXTENT}setTileParameters(e){const t=e.renderData.overlay;if(this.renderer.overlays.length>0){const r=this.renderer.overlays[H.INNER],s=this.renderer.overlays[H.OUTER],i=e.extent;this._rectInsideRect(r.extent,i)||this._rectanglesOverlap(i,r.extent)||this._rectanglesOverlap(i,s.extent)?(this._setTileOverlayData(i,H.INNER,t),this._setTileOverlayData(i,H.OUTER,t)):(this._clearTileOverlayData(H.INNER,t),this._clearTileOverlayData(H.OUTER,t))}else this._clearTileOverlayData(H.INNER,t),this._clearTileOverlayData(H.OUTER,t)}overlayPixelSizeInMapUnits(e,t){if(0===this.renderer.overlays.length)return t();const r=this.renderer.overlays[H.INNER],s=this.renderer.overlays[H.OUTER],i=this._pointIsInExtent(e,r.extent)?r:s;return(i.extent[2]-i.extent[0])/i.resolution}_setTileOverlayData(e,t,r){if(0===this.renderer.overlays.length)return;const s=this.renderer.overlays[t].extent,i=T(s),a=P(s);let n=e[0];if(this._longitudeCyclical){n=this._longitudeCyclical.minimalMonotonic(s[0],n);const t=this._longitudeCyclical.minimalMonotonic(s[0],e[2]);n>t&&(n=t-(e[2]-e[0]))}r.setScale(t,T(e)/i,P(e)/a),r.setOffset(t,(n-s[0])/i,(e[1]-s[1])/a)}_clearTileOverlayData(e,t){t.setScale(e,-1,-1),t.setOffset(e,-1,-1)}reloadShaders(){Z(),this.setDrawTexturesDirty(),this.runTask(Q)}updateAnimation(e){return this.renderer.updateAnimation(e)&&(this._drawTexturesAnimateDirty=!0),this._drawTexturesAnimateDirty}setDrawTexturesDirty(){this.renderer.hasOverlays?(this._contentUpdated=!0,this._drawTexturesDirty=!0,this.view._stage.renderView.requestRender()):this.setPlacementDirty()}_intersectGroundFromView(e,t,r,s,i){const a=this.view.sceneIntersectionHelper.getCenterRayWithSubpixelOffset(e,de,t,r);if(null==a)return!1;const n=a.origin,o=u(oe,a.origin,a.direction);this._groundIntersector.reset(n,o,e),this._groundIntersector.intersect([]),this.view.basemapTerrain.intersect(this._groundIntersector,null,n,o);const l=this._groundIntersector.results.min;return l.getIntersectionPoint(i)&&l.withinDistance(s)}_findHorizonBasedPointOfInterest(e,t){let r=.5;const a=.55,n=this.view.renderCoordsHelper.getAltitude(e.eye),o=this.view.pointsOfInterest.centerOnSurfaceFrequent,l=1e-5,h=i(o.estimatedSurfaceAltitude,e.aboveGround?-1/0:n+l,e.aboveGround?n-l:1/0),c=e.aboveGround;if("global"===this.view.viewingMode){const t=oe;U(A(G,O(this.view.spatialReference).radius+h),N(e.eye,e.viewForward),t),p(t,t,e.eye);const i=s.normalize(V(e.viewForward,t,e.viewRight))/e.fovY+.5,n=i<=0||i>=1?.5:a;r=c?n*i:i+n*(1-i)}else{const t=.5*Math.PI-Math.acos(-e.viewForward[2]),s=Math.tan(t),n=w(0,s,1,0),o=g(n,n,e.projectionMatrix)[1],l=i(.5+.5*o,0,1);r=1===l||0===l?.5:c?l*a:1-(1-l)*a}return this._intersectGroundFromView(e,.5,r,o.distance,t)}_computeOverlayExtents(e,t,r){const s=this.view.pointsOfInterest.centerOnSurfaceFrequent.renderLocation,i=y();this._findHorizonBasedPointOfInterest(e,i)||_(i,s),q.OVERLAY_SHOW_CENTER?(null==re&&(re=new B(this.view.graphics,"red")),re.show(i,this._renderSR)):null!=re&&re.hide();const n=Math.max(.1,m(e.eye,i)),o=L(this.view.renderCoordsHelper,s,e.eye);this._overlaySREqualsRenderSR||x(i,this._renderSR,i,this._spatialReference);const l=this.surface.extent,h=!this._isSpherical&&this._spatialReference?.isGeographic,c=h&&this._spatialReference?1/O(this._spatialReference).metersPerDegree:1,u=this.view.state.contentPixelRatio,p=e.perScreenPixelRatio/u*n*c;r.mapUnitsPerPixel=p/this._worldToPCSRatio,r.stretch=this._overlayStretch;let g=t*p/2*r.stretch,R=!1,w=h?90:1/0;this._isSpherical&&l&&this._spatialReference&&(this._spatialReference.isWebMercator?(g/=Math.cos(F(i[1])),w=l[3]):(R=!0,g/=O(this._spatialReference).metersPerDegree,w=90),g>=w&&(g=w,i[1]=0,this._spatialReference.isWebMercator&&(i[0]=0)));let D=1;R&&(D=1/Math.max(.2,Math.cos(Math.abs(a(i[1])))),g*D>180&&(D=180/g),r.mapUnitsPerPixel*=D);const E=Math.log(2)/12;g=Math.exp(Math.round(Math.log(g)/E)*E);const P=g*D,j=32,I=.5*t/(j*P),C=.5*t/(j*g);i[0]=Math.round(i[0]*I)/I,i[1]=Math.round(i[1]*C)/C;const N=r.inner;N[0]=i[0]-P,N[1]=i[1]-g,N[2]=i[0]+P,N[3]=i[1]+g,this._isSpherical&&this._shiftExtentToFitBounds(N,1/0,w);const U=r.outer;if(6*P>T(l))S(U,l);else{if(Math.PI/2-Math.abs(o-Math.PI/2)<=.25*Math.PI)U[0]=N[0]-P,U[1]=N[1]-g,U[2]=N[2]+P,U[3]=N[3]+g;else{x(e.eye,this._renderSR,oe,this._spatialReference),d(ne,i,oe);let t=-Math.atan2(ne[1],ne[0])+.125*Math.PI;t<0&&(t+=2*Math.PI);const r=Math.floor(t/(.25*Math.PI));f(ne,te[r],2*g),ne[0]*=D,ne[2]*=D,v(U,N,ne)}}if(this._isSpherical)U[0]=this._longitudeCyclical.clamp(U[0]),U[2]=this._longitudeCyclical.clamp(U[2]),U[1]=Math.max(U[1],-w),U[3]=Math.min(U[3],w);else{const e=M(N,l,he),t=M(U,l,ce);b(e,t)&&(U[2]=U[0],U[3]=U[1])}const A=Math.abs(N[2]-N[0])/t;r.mapUnitsPerPixel=Math.max(r.mapUnitsPerPixel,A),r.pixelRatioAdjustment=r.mapUnitsPerPixel/A}_precompileShaders(){return!!this.renderer.hasOverlays&&(this.renderer.precompileShaders(this.view.state),!0)}_drawOverlays(e,t=this.view.state){if(!this._drawTexturesDirty&&!this._drawTexturesAnimateDirty)return this.renderer;const r=this._drawTexturesDirty;this._drawTexturesDirty=this._drawTexturesAnimateDirty=!1;const s=this.renderer.computeValidity();this.renderer.releaseRenderTargets(),this.renderer.drawOverlays(t);return s!==this.renderer.computeValidity()&&this.surface.updateTileOverlayParams(Y.UPDATE),r?(this.surface.requestRender(e),e===Y.UPDATE&&this.surface.requestUpdate()):this.surface.requestRender(Y.BACKGROUND),this.renderer}_rectanglesOverlap(e,t){return null!=e&&(this._longitudeCyclical?(this._longitudeCyclical.contains(t[0],t[2],e[0])||this._longitudeCyclical.contains(t[0],t[2],e[2])||this._longitudeCyclical.contains(e[0],e[2],t[0]))&&!(e[1]>t[3]||e[3]<t[1]):j(e,t))}_rectInsideRect(e,t){return null!=t&&(this._longitudeCyclical?this._longitudeCyclical.contains(e[0],e[2],t[0])&&this._longitudeCyclical.contains(e[0],e[2],t[2])&&t[1]>e[1]&&t[3]<e[3]:b(e,t))}_pointIsInExtent(e,t){if(this._longitudeCyclical)return this._longitudeCyclical.contains(t[0],t[2],e.x)&&e.y>=t[1]&&e.y<=t[3];const r=e.x,s=e.y;return r>t[0]&&r<t[2]&&s>t[1]&&s<t[3]}_shiftExtentToFitBounds(e,t,r){let s=0,i=0;e[0]<-t?s=e[0]+t:e[2]>t&&(s=t-e[2]),e[1]<-r?i=e[1]+r:e[3]>r&&(i=r-e[3]),I(e,s,i)}get test(){}};function ie(e,t){const r=1e-5,s=q.TESTS_DISABLE_OPTIMIZATIONS?0:r*Math.max(e[2]-e[0],e[3]-e[1],t[2]-t[0],t[3]-t[1]);return Math.abs(t[0]-e[0])<=s&&Math.abs(t[1]-e[1])<=s&&Math.abs(t[2]-e[2])<=s&&Math.abs(t[3]-e[3])<=s}e([h()],se.prototype,"_spatialReference",void 0),e([h({readOnly:!0})],se.prototype,"running",null),e([h()],se.prototype,"_placementDirty",void 0),e([h()],se.prototype,"_contentUpdated",void 0),e([h()],se.prototype,"_isSpherical",null),e([h()],se.prototype,"_worldToPCSRatio",null),e([h()],se.prototype,"renderer",void 0),e([h({constructOnly:!0})],se.prototype,"view",void 0),e([h({constructOnly:!0})],se.prototype,"surface",void 0),e([h()],se.prototype,"suspended",null),e([h()],se.prototype,"updating",null),e([h({type:Boolean})],se.prototype,"rendersOccludedDraped",null),se=e([c("esri.views.3d.terrain.OverlayManager")],se);class ae{constructor(){this.inner=D(),this.outer=D(),this.mapUnitsPerPixel=0,this.pixelRatioAdjustment=1,this.stretch=ee}}const ne=R(),oe=y(),le=new ae,he=D(),ce=D(),de=C();var ue;!function(e){e[e.NONE=0]="NONE",e[e.EXTENT=1]="EXTENT",e[e.RERENDER_ONLY=2]="RERENDER_ONLY"}(ue||(ue={}));export{se as OverlayManager};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{copy as t}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r,IDENTITY as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{g as s,t as e,h as a,l as n,c as o,n as h}from"../../../../chunks/vec32.js";import{create as
|
|
5
|
+
import{copy as t}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r,IDENTITY as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{g as s,t as e,h as a,l as n,c as o,n as h}from"../../../../chunks/vec32.js";import{create as d,UNIT_Z as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{t as l}from"../../../../chunks/vec42.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as m,fromPoints as y,copy as u}from"../../../../geometry/support/ray.js";import{ViewingMode as p}from"../../../ViewingMode.js";import{IntersectorOptions as g,StoreResults as _,IntersectorType as O}from"./IntersectorInterfaces.js";import{HudTarget as L}from"./IntersectorTarget.js";import{isValidIntersectorResult as v}from"./intersectorUtils.js";import{IntersectorTransform as j,getVerticalOffsetObject3D as w}from"./verticalOffsetUtils.js";const E=1e-5;class b{constructor(t){this.options=new g,this._results=new A,this.transform=new j,this.tolerance=E,this.verticalOffset=null,this._ray=m(),this._rayEnd=d(),this._rayBeginTransformed=d(),this._rayEndTransformed=d(),this.viewingMode=t??p.Global}get results(){return this._results}get ray(){return this._ray}get rayBegin(){return this._ray.origin}get rayEnd(){return this._rayEnd}reset(t,r,i){this.resetWithRay(y(t,r,this._ray),i)}resetWithRay(t,r){this.camera=r,t!==this._ray&&u(t,this._ray),0!==this.options.verticalOffset?this.viewingMode===p.Local?this._ray.origin[2]-=this.options.verticalOffset:this.verticalOffset=this.options.verticalOffset:this.verticalOffset=null,s(this._rayEnd,this._ray.origin,this._ray.direction),this._results.init(this._ray)}intersect(t=null,r,i,s,e){this.point=r,this.filterPredicate=s,this.tolerance=i??E;const a=w(this.verticalOffset);if(t&&t.length>0){const r=e?t=>{e(t)&&this.intersectObject(t)}:t=>{this.intersectObject(t)};for(const i of t){const t=i.getSpatialQueryAccelerator?.();null!=t?(null!=a?t.forEachAlongRayWithVerticalOffset(this._ray.origin,this._ray.direction,r,a):t.forEachAlongRay(this._ray.origin,this._ray.direction,r),this.options.selectionMode&&this.options.hud&&t.forEachDegenerateObject(r)):i.objects.forAll((t=>r(t)))}}this.sortResults()}intersectObject(t){const r=t.geometries;if(!r)return;const s=t.effectiveTransformation,a=w(this.verticalOffset);for(const n of r){if(!n.visible)continue;const{material:r,id:o}=n;if(!r.visible)continue;this.transform.setAndInvalidateLazyTransforms(s,n.transformation),e(this._rayBeginTransformed,this.rayBegin,this.transform.inverse),e(this._rayEndTransformed,this.rayEnd,this.transform.inverse);const h=this.transform.transform;null!=a&&(a.objectTransform=this.transform),r.intersect(n,this.transform.transform,this,this._rayBeginTransformed,this._rayEndTransformed,((r,s,e,a,n,d)=>{if(r>=0){if(null!=this.filterPredicate&&!this.filterPredicate(this._ray.origin,this._rayEnd,r))return;const c=a?this._results.hud:this._results,l=a?a=>{const h=new L(t,o,e,d);a.set(O.HUD,h,r,s,i,n)}:i=>i.set(O.OBJECT,{object:t,geometryId:o,triangleNr:e},r,s,h,n);if((null==c.min.drapedLayerOrder||n>=c.min.drapedLayerOrder)&&(null==c.min.dist||r<c.min.dist)&&l(c.min),this.options.store!==_.MIN&&(null==c.max.drapedLayerOrder||n<c.max.drapedLayerOrder)&&(null==c.max.dist||r>c.max.dist)&&l(c.max),this.options.store===_.ALL)if(a){const t=new B(this._ray);l(t),this._results.hud.all.push(t)}else{const t=new I(this._ray);l(t),this._results.all.push(t)}}}))}}sortResults(t=this._results.all){t.sort(((t,r)=>t.dist!==r.dist?(t.dist??0)-(r.dist??0):t.drapedLayerOrder!==r.drapedLayerOrder?x(t.drapedLayerOrder,r.drapedLayerOrder):x(t.drapedLayerGraphicOrder,r.drapedLayerGraphicOrder)))}}function x(t,r){return(r??-Number.MAX_VALUE)-(t??-Number.MAX_VALUE)}function T(t){return new b(t)}class A{constructor(){this.min=new I(m()),this.max=new I(m()),this.hud={min:new B(m()),max:new B(m()),all:new Array},this.ground=new I(m()),this.all=[]}init(t){this.min.init(t),this.max.init(t),this.ground.init(t),this.all.length=0,this.hud.min.init(t),this.hud.max.init(t),this.hud.all.length=0}}class I{get ray(){return this._ray}get distanceInRenderSpace(){return null!=this.dist?(a(G,this.ray.direction,this.dist),n(G)):null}withinDistance(t){return!!v(this)&&this.distanceInRenderSpace<=t}getIntersectionPoint(t){return!!v(this)&&(a(G,this.ray.direction,this.dist),s(t,this.ray.origin,G),!0)}getTransformedNormal(t){return o(M,this.normal),M[3]=0,l(M,M,this.transformation),o(t,M),h(t,t)}constructor(t){this.intersector=O.OBJECT,this.normal=d(),this.transformation=r(),this._ray=m(),this.init(t)}init(t){this.dist=null,this.target=null,this.drapedLayerOrder=null,this.drapedLayerGraphicOrder=null,this.intersector=O.OBJECT,u(t,this._ray)}set(r,s,e,a,n,h,d){this.intersector=r,this.dist=e,o(this.normal,a??c),t(this.transformation,n??i),this.target=s,this.drapedLayerOrder=h,this.drapedLayerGraphicOrder=d}copy(r){u(r.ray,this._ray),this.intersector=r.intersector,this.dist=r.dist,this.target=r.target,this.drapedLayerOrder=r.drapedLayerOrder,this.drapedLayerGraphicOrder=r.drapedLayerGraphicOrder,o(this.normal,r.normal),t(this.transformation,r.transformation)}}class B extends I{constructor(){super(...arguments),this.intersector=O.HUD}}function R(t){return new I(t)}const G=d(),M=f();export{E as defaultTolerance,T as newIntersector,R as newIntersectorResult};
|
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.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import"../geometry.js";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,sync as l,syncAndInitial as p}from"../core/reactiveUtils.js";import{initialize as h}from"../core/workers/workers.js";import{property as g}from"../core/accessorSupport/decorators/property.js";import{cast as d}from"../core/accessorSupport/decorators/cast.js";import"../core/RandomLCG.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import{ensureClass as c}from"../core/accessorSupport/ensureType.js";import{isLoadedOrLoadFor as m}from"../geometry/projection.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 v from"./2d/AnimationManager.js";import b from"./2d/FrameTask.js";import{GoToManager as _}from"./2d/GoToManager.js";import{layerView2DImporter as j}from"./2d/layerViewModuleImportUtils.js";import S from"./2d/MapViewConstraints.js";import T from"./2d/tiling/TileInfoView.js";import"./2d/tiling/TileKey.js";import"./2d/tiling/TileQueue.js";import"./2d/tiling/TileStrategy.js";import{extentToScale as O}from"./2d/viewpointUtils.js";import{ViewStateManager as L}from"./2d/ViewStateManager.js";import R from"./2d/input/MapViewInputManager.js";import k from"./2d/layers/features/support/TileStore.js";import{createOrReuseHighlightGradient as C}from"./2d/layers/support/util.js";import{clipContainsPoint as x}from"./2d/support/clippingUtils.js";import D from"./2d/support/HighlightGroup.js";import{createInitialHighlightGroups as E,getDefaultHighlightOptions as G,setDefaultHighlightOptions as P}from"./2d/support/highlightGroupUtils.js";import z from"./2d/support/HighlightOptions.js";import{hitTest as A}from"./2d/support/hitTestUtils.js";import{takeRawScreenshot as U,takeScreenshot as q}from"./2d/support/screenshotUtils.js";import{StationaryManager as I}from"./2d/support/StationaryManager.js";import{Timeline as F}from"./2d/support/Timeline.js";import{isSupportedScreenPointEvent as N,createScreenPointFromSupportedEvent as W}from"./support/screenUtils.js";import{check as $}from"./support/WebGLRequirements.js";import H from"./ui/DefaultUI.js";import B from"./ui/2d/DefaultUI2D.js";import{isWebMap as Z}from"../webmap/utils.js";import J from"../webmap/background/ColorBackground.js";import K from"../geometry/Polygon.js";let Q,X,Y,ee,te,ie,re;async function se(){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")]);X=e,Y=t,ee=i,te=r,ie=s,re=a,Q=n}let ae=class extends(f(V(w(M)))){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.fullOpacity=1,this.goToManager=new _({view:this}),this.graphicsView=null,this.stateManager=new L({constraints:new S({view:this})}),this.stationaryManager=new I,this.labelManager=null,this.mapViewNavigation=null,this.renderingOptions={samplingMode:"dynamic",edgeLabelsVisible:!0,labelsAnimationTime:125,labelCollisionsEnabled:!0},this.supersampleScreenshotsEnabled=!0,this.supportsGround=!1,this.frameTask=new b(this),this.floors=new i,this.grid=null,this.highlights=E(),this.inputManager=new R({view:this}),this.map=null,this.spatialReferenceLocked=!1,this.timeline=new F,this.type="2d",this.view2dType=null,this.ui=new B,this.test={takeScreenshot:async e=>U(this._getScreenshotView(e),e)},this.padding={top:0,right:0,bottom:0,left:0},this.addHandles([o((()=>this.viewpoint),(()=>this.stationaryManager.flip()),l),this.on("resize",(e=>this.stateManager.resize(e.width,e.height)))]),h()}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 k(this.featuresTilingScheme)}get constraintsInfo(){const e=this.defaultsFromMap?.tileInfo,t=this.spatialReference;return{lods:e?.spatialReference?.equals(t)?e.lods:null,spatialReference:t}}get state(){return this.stateManager.state}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)}set animation(e){const t=this._get("animation");if(e===t)return;if(t&&t.stop(),e!==this.animationManager.animation&&this.animationManager.stop(),!e||e.isFulfilled())return void this._set("animation",null);this._set("animation",e);const i=()=>{this.destroyed||e===this._get("animation")&&(this._set("animation",null),this.frameTask?.requestFrame())};e.when(i,i)}get background(){return Z(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 this.stateManager?.constraints}set constraints(e){e.view=this;const t=this.stateManager.constraints;this.stateManager.constraints=e,t?.destroy()}get extent(){return this.stateManager?.extent??null}set extent(e){this.stateManager.extent=e}get highlightOptions(){return G(this)}set highlightOptions(e){P(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 this.stateManager.resizeAlign}set resizeAlign(e){this.stateManager.resizeAlign=e}get resolution(){return this.stateManager.resolution??0}get rotation(){return this.stateManager.rotation??0}set rotation(e){const{rotationEnabled:t}=this.constraints;this.constraints.rotationEnabled=!0,this.stateManager.rotation=e,this.constraints.rotationEnabled=t}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get stationary(){return!this.animation&&!this.navigating&&!this.resizing&&this.stationaryManager.stationary}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 this.stateManager.viewpoint??null}set viewpoint(e){this.stateManager.viewpoint=e,this.frameTask.requestFrame()}get visibleArea(){const e=this.stateManager.visibleArea;return e?new K({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}goTo(e,t){return this.goToManager.goTo(e,t)}async hitTest(e,t){return A(this,e,t)}async takeScreenshot(e){return q(this._getScreenshotView(e),e)}toMap(e){if(!this.ready)return null;const t=N(e)?W(this,e):e;return this.stateManager.toMap(t)}toScreen(e,t){return this.stateManager.toScreen(e,t)}on(e,t,i,r){const s=this.inputManager&&this.viewEvents.on(e,t,i,r);return s||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}whenLayerView(e){return super.whenLayerView(e)}graphicChanged(e){if(this.graphicsView){this.graphicsView.graphicUpdateHandler(e)}}whenReady(){return new Promise((e=>{this.ready?e(this):this._resolveWhenReady.push(e)}))}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties.spatialReference||this.defaultsFromMap?.spatialReference||null}getDefaultTimeZone(){return Z(this.map)?this.map.initialViewProperties.timeZone:null}getDefaultTimeExtent(){return Z(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=>x(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=$(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)throw a.getLogger(this).warn("#validate()",e.message),e}loadAsyncDependencies(){return se()}_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&&O(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 Q(this.surface,{canvas:this.renderCanvas,contextOptions:{disabledExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions},renderingOptions:this.renderingOptions,timeline:this.timeline});this.stage=t,this._magnifierView=new ie,this._magnifierView.magnifier=this.magnifier,this._gridView=new re;const i=new ee({view:this});this._set("labelManager",i);const r=new v({view:this});this._set("animationManager",r);const s=new te({view:this,animationManager:r});this._set("mapViewNavigation",s),this._setupSpatialReferenceDependentProperties(),this.addHandles([this.rootLayerViews.on("change",(()=>this._updateStageChildren())),t.on("webgl-error",(e=>this.fatalError=e.error)),o((()=>this.stationary),(e=>t.stationary=e),p),o((()=>this.background),(e=>{t.backgroundColor=e?.color,this._magnifierView.backgroundColor=e?.color}),p),o((()=>this.magnifier),(e=>this._magnifierView.magnifier=e),p),o((()=>this.grid),(e=>this._gridView.grid=e),p),o((()=>this.renderingOptions),(e=>t.renderingOptions=e),p),o((()=>this.highlights.items.map((e=>({name:e.name,options:{fillColor:e.options.color,haloColor:e.options.haloColor,fillOpacity:e.options.fillOpacity,haloOpacity:e.options.haloOpacity,haloWidth:e.options.haloWidth,haloBlur:e.options.haloBlur}})))),(()=>{t.highlightGradient=C(t.highlightGradient,this.highlights.items)}),p),o((()=>this.state.id),(()=>t.state=this.state),p)],"map-view"),this._updateStageChildren();const a=this._resolveWhenReady;this._resolveWhenReady=[],a.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 T(y.create({spatialReference:this.spatialReference,size:512,numLODs:36}));this._set("featuresTilingScheme",e);const t=new X({view:this,graphics:this.graphics,requestUpdateCallback:()=>this.requestUpdate(),container:new Y(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()}}};ae.type="2d",e([g({readOnly:!0})],ae.prototype,"animationManager",void 0),e([g({constructOnly:!0})],ae.prototype,"deactivatedWebGLExtensions",void 0),e([g({constructOnly:!0})],ae.prototype,"debugWebGLExtensions",void 0),e([g({readOnly:!0})],ae.prototype,"featuresTilingScheme",void 0),e([g({readOnly:!0})],ae.prototype,"fullOpacity",void 0),e([g()],ae.prototype,"goToManager",void 0),e([g({readOnly:!0})],ae.prototype,"graphicsTileStore",null),e([g()],ae.prototype,"graphicsView",void 0),e([g()],ae.prototype,"stateManager",void 0),e([g()],ae.prototype,"constraintsInfo",null),e([g({readOnly:!0})],ae.prototype,"state",null),e([g()],ae.prototype,"initialExtentRequired",null),e([g()],ae.prototype,"labelManager",void 0),e([g({readOnly:!0})],ae.prototype,"mapViewNavigation",void 0),e([g({constructOnly:!0})],ae.prototype,"renderCanvas",void 0),e([g()],ae.prototype,"renderingOptions",void 0),e([g({constructOnly:!0})],ae.prototype,"supersampleScreenshotsEnabled",void 0),e([g({readOnly:!0})],ae.prototype,"supportsGround",void 0),e([g()],ae.prototype,"defaultsFromMapSettings",null),e([g({readOnly:!0})],ae.prototype,"typeSpecificPreconditionsReady",null),e([g()],ae.prototype,"animation",null),e([g({type:J})],ae.prototype,"background",null),e([g()],ae.prototype,"center",null),e([g({type:S})],ae.prototype,"constraints",null),e([g()],ae.prototype,"extent",null),e([g()],ae.prototype,"floors",void 0),e([g()],ae.prototype,"grid",void 0),e([g({type:z})],ae.prototype,"highlightOptions",null),e([g({type:i.ofType(D)})],ae.prototype,"highlights",void 0),e([g({readOnly:!0})],ae.prototype,"inputManager",void 0),e([g()],ae.prototype,"map",void 0),e([g()],ae.prototype,"padding",null),e([g({readOnly:!0})],ae.prototype,"rendering",null),e([g()],ae.prototype,"resizeAlign",null),e([g({readOnly:!0})],ae.prototype,"resolution",null),e([g()],ae.prototype,"rotation",null),e([g()],ae.prototype,"scale",null),e([g({constructOnly:!0})],ae.prototype,"spatialReferenceLocked",void 0),e([g()],ae.prototype,"stationary",null),e([g({readOnly:!0})],ae.prototype,"tileInfo",null),e([g({type:F,readOnly:!0})],ae.prototype,"timeline",void 0),e([g({readOnly:!0})],ae.prototype,"type",void 0),e([g({readOnly:!0})],ae.prototype,"updating",null),e([g({readOnly:!0})],ae.prototype,"view2dType",void 0),e([g()],ae.prototype,"viewpoint",null),e([g({readOnly:!0})],ae.prototype,"visibleArea",null),e([g()],ae.prototype,"zoom",null),e([g({readOnly:!0})],ae.prototype,"navigating",null),e([g(),d((e=>e instanceof H?e:c(B,e)))],ae.prototype,"ui",void 0),ae=e([u("esri.views.View2D")],ae);const ne=ae;export{ne as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import"../geometry.js";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,sync as l,syncAndInitial as p}from"../core/reactiveUtils.js";import{initialize as h}from"../core/workers/workers.js";import{property as g}from"../core/accessorSupport/decorators/property.js";import{cast as d}from"../core/accessorSupport/decorators/cast.js";import"../core/RandomLCG.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import{ensureClass as c}from"../core/accessorSupport/ensureType.js";import{isLoadedOrLoadFor as m}from"../geometry/projection.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 v from"./2d/AnimationManager.js";import b from"./2d/FrameTask.js";import{GoToManager as _}from"./2d/GoToManager.js";import{layerView2DImporter as j}from"./2d/layerViewModuleImportUtils.js";import S from"./2d/MapViewConstraints.js";import T from"./2d/tiling/TileInfoView.js";import"./2d/tiling/TileKey.js";import"./2d/tiling/TileQueue.js";import"./2d/tiling/TileStrategy.js";import{extentToScale as O}from"./2d/viewpointUtils.js";import{ViewStateManager as L}from"./2d/ViewStateManager.js";import R from"./2d/input/MapViewInputManager.js";import k from"./2d/layers/features/support/TileStore.js";import{createOrReuseHighlightGradient as C}from"./2d/layers/support/util.js";import{clipContainsPoint as x}from"./2d/support/clippingUtils.js";import D from"./2d/support/HighlightGroup.js";import{createInitialHighlightGroups as E,getDefaultHighlightOptions as G,setDefaultHighlightOptions as P}from"./2d/support/highlightGroupUtils.js";import z from"./2d/support/HighlightOptions.js";import{hitTest as A}from"./2d/support/hitTestUtils.js";import{takeRawScreenshot as U,takeScreenshot as q}from"./2d/support/screenshotUtils.js";import{StationaryManager as I}from"./2d/support/StationaryManager.js";import{Timeline as N}from"./2d/support/Timeline.js";import F from"./navigation/Navigation.js";import W from"./navigation/NavigationActionMap.js";import{isSupportedScreenPointEvent as $,createScreenPointFromSupportedEvent as H}from"./support/screenUtils.js";import{check as B}from"./support/WebGLRequirements.js";import Z from"./ui/DefaultUI.js";import J from"./ui/2d/DefaultUI2D.js";import{isWebMap as K}from"../webmap/utils.js";import Q from"../webmap/background/ColorBackground.js";import X from"../geometry/Polygon.js";let Y,ee,te,ie,re,se,ae;async function ne(){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")]);ee=e,te=t,ie=i,re=r,se=s,ae=a,Y=n}let oe=class extends(f(V(w(M)))){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.fullOpacity=1,this.goToManager=new _({view:this}),this.graphicsView=null,this.stateManager=new L({constraints:new S({view:this})}),this.stationaryManager=new I,this.labelManager=null,this.mapViewNavigation=null,this.navigation=new F({actionMap:new W({dragTertiary:"none"})}),this.renderingOptions={samplingMode:"dynamic",edgeLabelsVisible:!0,labelsAnimationTime:125,labelCollisionsEnabled:!0},this.supersampleScreenshotsEnabled=!0,this.supportsGround=!1,this.frameTask=new b(this),this.floors=new i,this.grid=null,this.highlights=E(),this.inputManager=new R({view:this}),this.map=null,this.spatialReferenceLocked=!1,this.timeline=new N,this.type="2d",this.view2dType=null,this.ui=new J,this.test={takeScreenshot:async e=>U(this._getScreenshotView(e),e)},this.padding={top:0,right:0,bottom:0,left:0},this.addHandles([o((()=>this.viewpoint),(()=>this.stationaryManager.flip()),l),this.on("resize",(e=>this.stateManager.resize(e.width,e.height)))]),h()}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 k(this.featuresTilingScheme)}get constraintsInfo(){const e=this.defaultsFromMap?.tileInfo,t=this.spatialReference;return{lods:e?.spatialReference?.equals(t)?e.lods:null,spatialReference:t}}get state(){return this.stateManager.state}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)}set animation(e){const t=this._get("animation");if(e===t)return;if(t&&t.stop(),e!==this.animationManager.animation&&this.animationManager.stop(),!e||e.isFulfilled())return void this._set("animation",null);this._set("animation",e);const i=()=>{this.destroyed||e===this._get("animation")&&(this._set("animation",null),this.frameTask?.requestFrame())};e.when(i,i)}get background(){return K(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 this.stateManager?.constraints}set constraints(e){e.view=this;const t=this.stateManager.constraints;this.stateManager.constraints=e,t?.destroy()}get extent(){return this.stateManager?.extent??null}set extent(e){this.stateManager.extent=e}get highlightOptions(){return G(this)}set highlightOptions(e){P(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 this.stateManager.resizeAlign}set resizeAlign(e){this.stateManager.resizeAlign=e}get resolution(){return this.stateManager.resolution??0}get rotation(){return this.stateManager.rotation??0}set rotation(e){const{rotationEnabled:t}=this.constraints;this.constraints.rotationEnabled=!0,this.stateManager.rotation=e,this.constraints.rotationEnabled=t}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get stationary(){return!this.animation&&!this.navigating&&!this.resizing&&this.stationaryManager.stationary}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 this.stateManager.viewpoint??null}set viewpoint(e){this.stateManager.viewpoint=e,this.frameTask.requestFrame()}get visibleArea(){const e=this.stateManager.visibleArea;return e?new X({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}goTo(e,t){return this.goToManager.goTo(e,t)}async hitTest(e,t){return A(this,e,t)}async takeScreenshot(e){return q(this._getScreenshotView(e),e)}toMap(e){if(!this.ready)return null;const t=$(e)?H(this,e):e;return this.stateManager.toMap(t)}toScreen(e,t){return this.stateManager.toScreen(e,t)}on(e,t,i,r){const s=this.inputManager&&this.viewEvents.on(e,t,i,r);return s||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}whenLayerView(e){return super.whenLayerView(e)}graphicChanged(e){if(this.graphicsView){this.graphicsView.graphicUpdateHandler(e)}}whenReady(){return new Promise((e=>{this.ready?e(this):this._resolveWhenReady.push(e)}))}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties.spatialReference||this.defaultsFromMap?.spatialReference||null}getDefaultTimeZone(){return K(this.map)?this.map.initialViewProperties.timeZone:null}getDefaultTimeExtent(){return K(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=>x(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=B(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)throw a.getLogger(this).warn("#validate()",e.message),e}loadAsyncDependencies(){return ne()}_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&&O(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 Y(this.surface,{canvas:this.renderCanvas,contextOptions:{disabledExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions},renderingOptions:this.renderingOptions,timeline:this.timeline});this.stage=t,this._magnifierView=new se,this._magnifierView.magnifier=this.magnifier,this._gridView=new ae;const i=new ie({view:this});this._set("labelManager",i);const r=new v({view:this});this._set("animationManager",r);const s=new re({view:this,animationManager:r});this._set("mapViewNavigation",s),this._setupSpatialReferenceDependentProperties(),this.addHandles([this.rootLayerViews.on("change",(()=>this._updateStageChildren())),t.on("webgl-error",(e=>this.fatalError=e.error)),o((()=>this.stationary),(e=>t.stationary=e),p),o((()=>this.background),(e=>{t.backgroundColor=e?.color,this._magnifierView.backgroundColor=e?.color}),p),o((()=>this.magnifier),(e=>this._magnifierView.magnifier=e),p),o((()=>this.grid),(e=>this._gridView.grid=e),p),o((()=>this.renderingOptions),(e=>t.renderingOptions=e),p),o((()=>this.highlights.items.map((e=>({name:e.name,options:{fillColor:e.options.color,haloColor:e.options.haloColor,fillOpacity:e.options.fillOpacity,haloOpacity:e.options.haloOpacity,haloWidth:e.options.haloWidth,haloBlur:e.options.haloBlur}})))),(()=>{t.highlightGradient=C(t.highlightGradient,this.highlights.items)}),p),o((()=>this.state.id),(()=>t.state=this.state),p)],"map-view"),this._updateStageChildren();const a=this._resolveWhenReady;this._resolveWhenReady=[],a.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 T(y.create({spatialReference:this.spatialReference,size:512,numLODs:36}));this._set("featuresTilingScheme",e);const t=new ee({view:this,graphics:this.graphics,requestUpdateCallback:()=>this.requestUpdate(),container:new te(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()}}};oe.type="2d",e([g({readOnly:!0})],oe.prototype,"animationManager",void 0),e([g({constructOnly:!0})],oe.prototype,"deactivatedWebGLExtensions",void 0),e([g({constructOnly:!0})],oe.prototype,"debugWebGLExtensions",void 0),e([g({readOnly:!0})],oe.prototype,"featuresTilingScheme",void 0),e([g({readOnly:!0})],oe.prototype,"fullOpacity",void 0),e([g()],oe.prototype,"goToManager",void 0),e([g({readOnly:!0})],oe.prototype,"graphicsTileStore",null),e([g()],oe.prototype,"graphicsView",void 0),e([g()],oe.prototype,"stateManager",void 0),e([g()],oe.prototype,"constraintsInfo",null),e([g({readOnly:!0})],oe.prototype,"state",null),e([g()],oe.prototype,"initialExtentRequired",null),e([g()],oe.prototype,"labelManager",void 0),e([g({readOnly:!0})],oe.prototype,"mapViewNavigation",void 0),e([g({type:F,nonNullable:!0})],oe.prototype,"navigation",void 0),e([g({constructOnly:!0})],oe.prototype,"renderCanvas",void 0),e([g()],oe.prototype,"renderingOptions",void 0),e([g({constructOnly:!0})],oe.prototype,"supersampleScreenshotsEnabled",void 0),e([g({readOnly:!0})],oe.prototype,"supportsGround",void 0),e([g()],oe.prototype,"defaultsFromMapSettings",null),e([g({readOnly:!0})],oe.prototype,"typeSpecificPreconditionsReady",null),e([g()],oe.prototype,"animation",null),e([g({type:Q})],oe.prototype,"background",null),e([g()],oe.prototype,"center",null),e([g({type:S})],oe.prototype,"constraints",null),e([g()],oe.prototype,"extent",null),e([g()],oe.prototype,"floors",void 0),e([g()],oe.prototype,"grid",void 0),e([g({type:z})],oe.prototype,"highlightOptions",null),e([g({type:i.ofType(D)})],oe.prototype,"highlights",void 0),e([g({readOnly:!0})],oe.prototype,"inputManager",void 0),e([g()],oe.prototype,"map",void 0),e([g()],oe.prototype,"padding",null),e([g({readOnly:!0})],oe.prototype,"rendering",null),e([g()],oe.prototype,"resizeAlign",null),e([g({readOnly:!0})],oe.prototype,"resolution",null),e([g()],oe.prototype,"rotation",null),e([g()],oe.prototype,"scale",null),e([g({constructOnly:!0})],oe.prototype,"spatialReferenceLocked",void 0),e([g()],oe.prototype,"stationary",null),e([g({readOnly:!0})],oe.prototype,"tileInfo",null),e([g({type:N,readOnly:!0})],oe.prototype,"timeline",void 0),e([g({readOnly:!0})],oe.prototype,"type",void 0),e([g({readOnly:!0})],oe.prototype,"updating",null),e([g({readOnly:!0})],oe.prototype,"view2dType",void 0),e([g()],oe.prototype,"viewpoint",null),e([g({readOnly:!0})],oe.prototype,"visibleArea",null),e([g()],oe.prototype,"zoom",null),e([g({readOnly:!0})],oe.prototype,"navigating",null),e([g(),d((e=>e instanceof Z?e:c(J,e)))],oe.prototype,"ui",void 0),oe=e([u("esri.views.View2D")],oe);const le=oe;export{le 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.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
function
|
|
5
|
+
function r(r,e){switch(e){case"primary":return"touch"===r.pointerType||0===r.button;case"secondary":return"touch"!==r.pointerType&&2===r.button;case"tertiary":return"touch"!==r.pointerType&&1===r.button}}function e(e,t){return t.some((t=>r(e,t)))}function t(r,e){const{button:t,pointerType:n}=r;return"touch"!==n&&e.some((r=>"primary"===r&&0===t||"secondary"===r&&2===t||"tertiary"===r&&1===t))}function n(r,{dragPrimary:e,dragSecondary:t,dragTertiary:n}){return[{key:"primary",value:e},{key:"secondary",value:t},{key:"tertiary",value:n}].filter((e=>e.value===r)).map((r=>r.key))}export{t as eventMatchesMousePointerActions,r as eventMatchesPointerAction,e as eventMatchesPointerActions,n as getPointerActions};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as o}from"../../chunks/tslib.es6.js";import{prefersReducedMotion as e}from"../../core/a11yUtils.js";import t from"../../core/Accessor.js";import{
|
|
5
|
+
import{_ as o}from"../../chunks/tslib.es6.js";import{prefersReducedMotion as e}from"../../core/a11yUtils.js";import t from"../../core/Accessor.js";import{deprecatedProperty as r}from"../../core/deprecate.js";import a from"../../core/Logger.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as m}from"../../core/accessorSupport/decorators/subclass.js";import n from"./NavigationActionMap.js";import p from"./gamepad/GamepadSettings.js";let i=class extends t{constructor(o){super(o),this.actionMap=new n,this.browserTouchPanEnabled=!0,this.gamepad=new p,this.momentumEnabled=!0}get effectiveMomentumEnabled(){return this.momentumEnabled&&!e()}get mouseWheelZoomEnabled(){return"zoom"===this.actionMap.mouseWheel}set mouseWheelZoomEnabled(o){r(a.getLogger(this),"mouseWheelZoomEnabled",{replacement:"actionMap.mouseWheel",version:"4.32",warnOnce:!0}),this.actionMap.mouseWheel=o?"zoom":"none"}};o([s({type:n,nonNullable:!0})],i.prototype,"actionMap",void 0),o([s({type:Boolean})],i.prototype,"browserTouchPanEnabled",void 0),o([s({type:p,nonNullable:!0})],i.prototype,"gamepad",void 0),o([s({type:Boolean})],i.prototype,"momentumEnabled",void 0),o([s({type:Boolean})],i.prototype,"mouseWheelZoomEnabled",null),i=o([m("esri.views.navigation.Navigation")],i);const l=i;export{l as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{_ as o}from"../../chunks/tslib.es6.js";import r from"../../core/Accessor.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as t}from"../../core/accessorSupport/decorators/subclass.js";const s=()=>e({type:["pan","rotate","zoom","none"],nonNullable:!0});let a=class extends r{constructor(o){super(o),this.dragPrimary="pan",this.dragSecondary="rotate",this.dragTertiary="zoom",this.mouseWheel="zoom"}};o([s()],a.prototype,"dragPrimary",void 0),o([s()],a.prototype,"dragSecondary",void 0),o([s()],a.prototype,"dragTertiary",void 0),o([e({type:["zoom","none"],nonNullable:!0})],a.prototype,"mouseWheel",void 0),a=o([t("esri.views.navigation.NavigationActionMap")],a);const p=a;export{p 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.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Color.js";import{handlesGroup as r}from"../../core/handleUtils.js";import{memoize as i}from"../../core/memoize.js";import{watch as o,on as n}from"../../core/reactiveUtils.js";import{union as s}from"../../core/SetUtils.js";import{getMetersPerVerticalUnitForSR as l}from"../../core/unitUtils.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import{i as u}from"../../chunks/vec32.js";import{create as p}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as d}from"../../geometry/ellipsoidUtils.js";import{create as m,fromPoints as v}from"../../geometry/support/ray.js";import{GeometryDescriptor as y}from"../../layers/support/ElevationQuery.js";import{externalToInternalIntersectOptions as f}from"../../views/3d/support/hitTest.js";import{newIntersector as h}from"../../views/3d/webgl-engine/lib/Intersector.js";import{StoreResults as w}from"../../views/3d/webgl-engine/lib/IntersectorInterfaces.js";import{toGraphic as _}from"../../views/3d/webgl-engine/lib/intersectorUtilsConversions.js";import g from"./ElevationProfileLine.js";const j=2e5;let
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Color.js";import{handlesGroup as r}from"../../core/handleUtils.js";import{memoize as i}from"../../core/memoize.js";import{watch as o,on as n}from"../../core/reactiveUtils.js";import{union as s}from"../../core/SetUtils.js";import{getMetersPerVerticalUnitForSR as l}from"../../core/unitUtils.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import{i as u}from"../../chunks/vec32.js";import{create as p}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as d}from"../../geometry/ellipsoidUtils.js";import{create as m,fromPoints as v}from"../../geometry/support/ray.js";import{GeometryDescriptor as y}from"../../layers/support/ElevationQuery.js";import{externalToInternalIntersectOptions as f}from"../../views/3d/support/hitTest.js";import{newIntersector as h}from"../../views/3d/webgl-engine/lib/Intersector.js";import{StoreResults as w}from"../../views/3d/webgl-engine/lib/IntersectorInterfaces.js";import{toGraphic as _}from"../../views/3d/webgl-engine/lib/intersectorUtilsConversions.js";import g from"./ElevationProfileLine.js";const j=2e5;let b=class extends g{constructor(e){super(e),this.type="view",this.color=new t("#cf4ccf"),this.viewVisualizationEnabled=!0,this.include=null,this.exclude=null,this.numSamplesForPreview=50,this.numSamplesPerChunk=25,this._getQueryElevationDependencies=i(((e,t,r,i,o,n,s)=>({inputGraphicUid:null!=e?x(e):null,visibleLayers:t,maxIntersectionDistance:r,intersectOptions:i,view:o,stationary:n,spatialReference:s}))),this._vecA=p(),this._vecB=p(),this._ray=m()}get minDemResolution(){const e=this._viewModel?.view;if(null==e||"3d"!==e.type)return null;const t=e.pointsOfInterest?.focus?.worldUnitsPerContentPixel;return null==t?null:t*l(e.spatialReference)}get queryElevationDependencies(){const e=this._view;return e?this._getQueryElevationDependencies(this._viewModel?.input,this._visibleLayers,this._maxIntersectionDistance,this._intersectOptions,e,e.stationary,e.spatialReference):null}get _visibleLayers(){return this._view?.map?.allLayers?.filter((e=>e.visible)).toArray()??[]}get _intersectOptions(){const e=this._view;if(null==e||e.destroyed)return{};const t=f(e,{include:this.include,exclude:this.exclude}),r=f(e,{exclude:this._pointCloudLayers});return t.exclude=s(t.exclude,r.exclude),t}get _pointCloudLayers(){const e=this._view;return null==e?[]:e.allLayerViews.toArray().filter((e=>"point-cloud"===e.layer?.type)).map((e=>e.layer))}get _view(){const e=this._viewModel?.view;return null!=e&&"3d"===e.type?e:null}get _maxIntersectionDistance(){const e=this._view;return e?.renderCoordsHelper?d(e.spatialReference).radius/e.renderCoordsHelper.unitInMeters:Number.POSITIVE_INFINITY}get _intersector(){const e=this._view;if(null==e)return null;const t=h(e.state.viewingMode),r=t.options;return r.hud=!1,r.invisibleTerrain=!1,r.backfacesTerrain=!1,r.selectionMode=!1,r.store=w.ALL,t}async queryElevation(e,{noDataValue:t,signal:r}){const i=this.queryElevationDependencies;if(null==i)throw new Error("ElevationProfileLineInput: no dependencies");const o=this._intersector;if(null==o)throw new Error("ElevationProfileLineInput: no view");const{intersectOptions:n,view:s,spatialReference:l}=i,c=s.renderCoordsHelper,a=s.sceneIntersectionHelper,p=this._vecA,d=this._vecA,m=this._vecB,f=this._ray;if(!l)return{geometry:e,noDataValue:t};const h=await y.fromGeometry(e).project(l,r);if(!h)return{geometry:e,noDataValue:t};const w=h.coordinates,_=w.length;for(let y=0;y<_;++y){const e=w[y];u(m,e.x,e.y,e.z??0),c.toRenderCoords(m,l,m),c.setAltitude(p,j,m);const r=v(p,m,f);a.computeIntersection(r,o,n,!0);const s=I(i,o.results.all);s?(s.getIntersectionPoint(d),c.fromRenderCoords(d,d,l),e.z=d[2]):e.z=t}return{geometry:h.export(),noDataValue:t}}attach(e){const t=()=>this._onChange();return r([super.attach(e),o((()=>this.queryElevationDependencies),t),n((()=>e.elevationProvider),"elevation-change",t,{onListenerAdd:t,onListenerRemove:t})])}};function I({view:e,inputGraphicUid:t,maxIntersectionDistance:r},i){for(const o of i){if(!o.withinDistance(r))continue;const i=_(o,e);if(null==i||x(i)!==t)return o}return null}function x(e){if(e.layer&&"objectIdField"in e.layer){const t=e.attributes[e.layer.objectIdField];if(t)return`o-${e.layer.id}-${t}`}return`u-${e.uid}`}e([c({type:t,nonNullable:!0})],b.prototype,"color",void 0),e([c()],b.prototype,"viewVisualizationEnabled",void 0),e([c()],b.prototype,"include",void 0),e([c()],b.prototype,"exclude",void 0),e([c({readOnly:!0})],b.prototype,"minDemResolution",null),e([c()],b.prototype,"queryElevationDependencies",null),e([c()],b.prototype,"_visibleLayers",null),e([c()],b.prototype,"_intersectOptions",null),e([c()],b.prototype,"_pointCloudLayers",null),e([c()],b.prototype,"_view",null),e([c()],b.prototype,"_maxIntersectionDistance",null),e([c()],b.prototype,"_intersector",null),b=e([a("esri.widgets.ElevationProfile.ElevationProfileLineView")],b);const L=b;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.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../chunks/tslib.es6.js";import o from"../../core/Accessor.js";import{when as i}from"../../core/reactiveUtils.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";let s=class extends o{constructor(t){super(t),this._navigationMode="pan",this.view=null}initialize(){this.addHandles(i((()=>this.view?.inputManager),(()=>this._setNavigationMode())))}destroy(){this.view=null}get state(){return this.view?.ready&&"3d"===this.view?.type?"ready":"disabled"}get navigationMode(){return this._navigationMode}set navigationMode(t){this._navigationMode=t,this._setNavigationMode()}toggle(){"disabled"!==this.state&&(this.navigationMode="pan"!==this.navigationMode?"pan":"rotate")}_setNavigationMode(){const t=this.view?.
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import o from"../../core/Accessor.js";import{when as i}from"../../core/reactiveUtils.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";let s=class extends o{constructor(t){super(t),this._navigationMode="pan",this.view=null}initialize(){this.addHandles(i((()=>this.view?.inputManager),(()=>this._setNavigationMode())))}destroy(){this.view=null}get state(){return this.view?.ready&&"3d"===this.view?.type?"ready":"disabled"}get navigationMode(){return this._navigationMode}set navigationMode(t){this._navigationMode=t,this._setNavigationMode()}toggle(){"disabled"!==this.state&&(this.navigationMode="pan"!==this.navigationMode?"pan":"rotate")}_setNavigationMode(){const t=this.view?.navigation.actionMap;if(!t)return;const o="pan"===this._navigationMode;t.dragPrimary=o?"pan":"rotate",t.dragSecondary=o?"rotate":"pan"}};t([e({readOnly:!0})],s.prototype,"state",null),t([e()],s.prototype,"_navigationMode",void 0),t([e()],s.prototype,"view",void 0),s=t([a("esri.widgets.NavigationToggle.NavigationToggleViewModel")],s);const r=s;export{r as default};
|