You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
4.5 KiB
12 lines
4.5 KiB
// All material copyright Esri, All Rights Reserved, unless otherwise specified. |
|
// See https://js.arcgis.com/4.30/esri/copyright.txt for details. |
|
//>>built |
|
define("exports ../../chunks/tslib.es6 ../../core/Accessor ../../core/asyncUtils ../../core/handleUtils ../../core/maybe ../../core/memoize ../../core/promiseUtils ../../core/reactiveUtils ../../core/throttle ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass ../../support/elevationInfoUtils ./support/constants ./support/geometryUtils ./support/profileUtils".split(" "),function(h,k,v,w,x,y,m,p,n,z,l,C, |
|
D,E,A,t,q,u,B){h.ElevationProfileController=class extends v{constructor(a){super(a);this._updateTask=null;this._paramsPerProfile=new Map;this._getUpdateParametersMemoized=m.memoize((c,b,d)=>({stationary:c,visibleProfiles:b,generationParameters:d}));this._getGenerationParametersMemoized=m.memoize((c,b,d,e,f,g,r)=>u.isPolyline(b)&&u.isValidInputPath(b)&&null!=e?{view:c,geometry:b,elevationInfo:d,options:g,queue:e,cache:f,slicePlane:r}:null);this._getElevationInfoMemoized=m.memoize((c,b)=>({mode:c,offset:b})); |
|
this._getOptionsMemoized=m.memoize((c,b,d)=>{const {densificationMaxSamples:e,maxTotalSamples:f}=q.getConfig();return{geodesicDistanceThreshold:c,samplingDistance:b,densificationMaxSamples:Math.round(e/d),maxTotalSamples:f}});this._updateThrottled=z.throttle(c=>p.ignoreAbortErrors(this._update(c)),q.getConfig().updateThrottleMillis)}initialize(){const a=this.viewModel;this.addHandles([n.watch(()=>a.profiles.toArray(),c=>{this._abortUpdate();this._paramsPerProfile.clear();this.removeHandles("line-change"); |
|
this.addHandles(c.map(b=>x.handlesGroup([b.attach(this.viewModel),b.on("change",()=>{this._invalidateProfile(b)})])),"line-change")},n.syncAndInitial),this._updateThrottled,n.watch(()=>this._updateParameters,this._updateThrottled,n.syncAndInitial)])}destroy(){this._paramsPerProfile.clear()}get _updateParameters(){var {viewModel:a}=this;a=a.view;return this._getUpdateParametersMemoized(null!=a?a.stationary:!0,this.viewModel.visibleProfiles,this._generationParameters)}get _generationParameters(){const {view:a, |
|
input:c,queue:b,tileCache:d}=this.viewModel;return null!=a&&a.ready?this._getGenerationParametersMemoized(a,c?.geometry,this._elevationInfo,b,d,this._options,"3d"===a.type?a.slicePlane:null):null}get _elevationInfo(){var a=this.viewModel.input;a=a?t.hasGraphicFeatureExpressionInfo(a)?null:t.getGraphicEffectiveElevationInfo(a):null;return null!=a?this._getElevationInfoMemoized(a.mode,a.offset):null}get _options(){const a=this.viewModel,c=a.visibleProfiles.length;let b=a.minDemResolution??q.getConfig().defaultDemResolution; |
|
b=parseFloat(b.toFixed(2));return this._getOptionsMemoized(a.geodesicDistanceThreshold,b,c)}async _update({stationary:a,visibleProfiles:c,generationParameters:b}){this._abortUpdate();a&&(null==b?this._clearResults():this._updateTask=w.createTask(async d=>{this.viewModel.error=null;const e=c.filter(g=>!this._isProfileValid(g,b));var f=B.generateProfiles({...b,providers:e},{signal:d});try{for await(const g of f)for(p.throwIfAborted(d),this._clearInvalidResults(b),f=0;f<e.length;f++)e[f].result=g[f]; |
|
for(const g of e)this._paramsPerProfile.set(g,b)}catch(g){p.throwIfAbortError(g),this._abortUpdate(),this.viewModel.error=g,e.forEach(r=>{r.result=null})}}))}_abortUpdate(){this._updateTask=y.abortMaybe(this._updateTask)}_isProfileValid(a,c){return this._paramsPerProfile.has(a)&&this._paramsPerProfile.get(a)===c}_invalidateProfile(a){this._paramsPerProfile.delete(a);this._updateThrottled(this._updateParameters)}_clearInvalidResults(a){for(const c of this.viewModel.profiles.items)this._isProfileValid(c, |
|
a)||(c.result=null,this._paramsPerProfile.delete(c))}_clearResults(){for(const a of this.viewModel.profiles.items)a.result=null,this._paramsPerProfile.delete(a)}};k.__decorate([l.property({nonNullable:!0})],h.ElevationProfileController.prototype,"viewModel",void 0);k.__decorate([l.property()],h.ElevationProfileController.prototype,"_updateParameters",null);k.__decorate([l.property()],h.ElevationProfileController.prototype,"_generationParameters",null);k.__decorate([l.property()],h.ElevationProfileController.prototype, |
|
"_elevationInfo",null);k.__decorate([l.property()],h.ElevationProfileController.prototype,"_options",null);h.ElevationProfileController=k.__decorate([A.subclass("esri.widgets.ElevationProfile.ElevationProfileController")],h.ElevationProfileController);Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})}); |