UNPKG

@arcgis/core

Version:

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

3 lines (2 loc) 2.58 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */ import{__decorate as e}from"tslib";import r from"../../core/Accessor.js";import{deprecateUnnecessaryViewModel as t}from"../../core/deprecate.js";import n from"../../core/Logger.js";import{watch as o,syncAndInitial as s}from"../../core/reactiveUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import p from"../../views/3d/environment/CloudyWeather.js";import l from"../../views/3d/environment/FoggyWeather.js";import h from"../../views/3d/environment/RainyWeather.js";import y from"../../views/3d/environment/SnowyWeather.js";import m from"../../views/3d/environment/SunnyWeather.js";import{validateWeatherType as u}from"../../views/3d/environment/weather.js";let c=class extends r{constructor(e){super(e),this.view=null,this._weatherByType={sunny:new m,cloudy:new p,rainy:new h,snowy:new y,foggy:new l},this._settingWeather=!1,e?.suppressDeprecationWarning||t(n.getLogger(this),"Weather","arcgis-weather",{version:"4.33"})}normalizeCtorArgs(e={}){const{suppressDeprecationWarning:r,...t}=e;return t}initialize(){this.addHandles([o(()=>this.current,e=>{this._settingWeather||null==e||(this._weatherByType={...this._weatherByType,[e.type]:e})},s)])}get state(){const e=this.view;return null!=e&&e.ready?null!=this.error?"not-visible"===this.error?"ready":"error":"ready":"disabled"}get weatherByType(){return this._weatherByType}get error(){const e=this.view;return null!=e&&e.ready?"3d"!==e.type?"unsupported-view":"local"===e.viewingMode?"local-scene":e.environment.atmosphereEnabled?e.environment.weatherAvailable?null:"not-visible":"no-atmosphere":null}get current(){return this._environment?.weather??this._weatherByType.sunny}set current(e){const r=this._environment;r&&(r.weather=e)}get _environment(){const e=this.view;return null!=e&&"3d"===e.type?e.environment:null}setWeatherByType(e){if(!u(e,n.getLogger(this)))return;const r=this._environment;null!=r&&(this._settingWeather=!0,r.weather=this._weatherByType[e],this._settingWeather=!1)}setSnowCoverEnabled(e){const r=this.current;"snowCover"in r&&(r.snowCover=e?"enabled":"disabled")}};e([i()],c.prototype,"view",void 0),e([i()],c.prototype,"state",null),e([i()],c.prototype,"_weatherByType",void 0),e([i()],c.prototype,"weatherByType",null),e([i()],c.prototype,"error",null),e([i()],c.prototype,"current",null),e([i()],c.prototype,"_environment",null),c=e([a("esri.widgets.Weather.WeatherViewModel")],c);const w=c;export{w as default};