@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
124 lines (121 loc) • 6.86 kB
TypeScript
import type SceneView from "../../views/SceneView.js";
import type { EventedAccessor } from "../../core/Evented.js";
import type { Season } from "./types.js";
/** @deprecated since version 4.34. Use the [Daylight component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-daylight/) instead. For information on widget deprecation, read about [Esri's move to web components](https://developers.arcgis.com/javascript/latest/components-transition-plan/). */
export interface DaylightViewModelProperties extends Partial<Pick<DaylightViewModel, "currentSeason" | "dayPlaying" | "directShadowsEnabled" | "playSpeedMultiplier" | "sunLightingEnabled" | "timeSliderPosition" | "utcOffset" | "view" | "yearPlaying">> {
/**
* The calendar date in the timezone given by [utcOffset](https://developers.arcgis.com/javascript/latest/references/core/widgets/Daylight/DaylightViewModel/#utcOffset).
*
* This property should only be set once the widget and the view are initialized, for example,
* from within an event handler. To initialize the view with a specific date and time, set a
* [SunLighting](https://developers.arcgis.com/javascript/latest/references/core/views/3d/environment/SunLighting/) on the
* [SceneView.environment](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#environment).
*
* @example
* view.environment.lighting = new SunLighting({
* date: new Date("2022-06-21T12:00:00")
* });
*/
localDate?: (Date | number | string);
}
/** @deprecated since version 4.34. Use the [Daylight component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-daylight/) instead. For information on widget deprecation, read about [Esri's move to web components](https://developers.arcgis.com/javascript/latest/components-transition-plan/). */
export interface DaylightViewModelEvents {
/**
* Fires when the user changes the date or time in the widget by interacting with the slider, the date picker, the
* season selector or the play buttons.
*
* @since 4.33
*/
"user-date-time-change": Record<never, never>;
}
/**
* Provides the logic for the [Daylight](https://developers.arcgis.com/javascript/latest/references/core/widgets/Daylight/) widget.
*
* @deprecated since version 4.34. Use the [Daylight component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-daylight/) instead. For information on widget deprecation, read about [Esri's move to web components](https://developers.arcgis.com/javascript/latest/components-transition-plan/).
* @since 4.14
* @see [Daylight](https://developers.arcgis.com/javascript/latest/references/core/widgets/Daylight/) widget
* @see [Daylight component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-daylight/)
* @see [Programming patterns: Widget viewModel pattern](https://developers.arcgis.com/javascript/latest/programming-patterns/#widget-viewmodel-pattern)
*/
export default class DaylightViewModel extends EventedAccessor {
/**
* @deprecated
* Do not directly reference this property.
* Use EventNames and EventTypes helpers from \@arcgis/core/Evented
*/
"@eventTypes": DaylightViewModelEvents;
constructor(properties?: DaylightViewModelProperties);
/**
* A season can be set instead of a date.
* Each season uses a fixed date corresponding to the seasonal equinoxes and solstices.
*/
accessor currentSeason: Season;
/**
* Starts or pauses the daytime animation cycling through the minutes of the day.
* Set to `true` to start the animation and to `false` to pause it.
*
* @default false
*/
accessor dayPlaying: boolean;
/**
* Indicates whether to show shadows cast by the sun. For more details on this property
* see [SceneView.environment.lighting.directShadowsEnabled](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#environment).
*/
accessor directShadowsEnabled: boolean;
/**
* The calendar date in the timezone given by [utcOffset](https://developers.arcgis.com/javascript/latest/references/core/widgets/Daylight/DaylightViewModel/#utcOffset).
*
* This property should only be set once the widget and the view are initialized, for example,
* from within an event handler. To initialize the view with a specific date and time, set a
* [SunLighting](https://developers.arcgis.com/javascript/latest/references/core/views/3d/environment/SunLighting/) on the
* [SceneView.environment](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#environment).
*
* @example
* view.environment.lighting = new SunLighting({
* date: new Date("2022-06-21T12:00:00")
* });
*/
get localDate(): Date;
set localDate(value: (Date | number | string));
/**
* Controls the daytime animation speed.
*
* @default 1.0
* @example
* // Plays the daylight animation at half of the default speed
* daylightWidget.playSpeedMultiplier = 0.5;
*/
accessor playSpeedMultiplier: number;
/**
* Indicates whether date and time are used to determine position of the light source.
* When `false`, the light source is positioned relative to the camera, using [VirtualLighting](https://developers.arcgis.com/javascript/latest/references/core/views/3d/environment/VirtualLighting/).
*/
accessor sunLightingEnabled: boolean;
/**
* Slider position for the time of day in the timezone
* given by [utcOffset](https://developers.arcgis.com/javascript/latest/references/core/widgets/Daylight/DaylightViewModel/#utcOffset). The position represents the time
* of the day in minutes. Possible values range between 0 and 1440.
*
* This property should only be set once the widget and the view are initialized, for example,
* from within an event handler. To initialize the view with a specific date and time, set a
* [SunLighting](https://developers.arcgis.com/javascript/latest/references/core/views/3d/environment/SunLighting/) on the
* [SceneView.environment](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#environment).
*
* @example
* view.environment.lighting = new SunLighting({
* date: new Date("2022-06-21T12:00:00")
* });
*/
accessor timeSliderPosition: number;
/** The difference in hours between UTC time and the time displayed in the widget. */
accessor utcOffset: number;
/** The view from which the widget will operate. */
accessor view: SceneView | null | undefined;
/**
* Starts or pauses the date animation cycling through the months of the year. Set to `true` to start the animation
* and to `false` to pause it.
*
* @default false
*/
accessor yearPlaying: boolean;
}