Skip to content
import ShadowCastViewModel from "@arcgis/core/widgets/ShadowCast/ShadowCastViewModel.js";
Inheritance:
ShadowCastViewModelAccessor
Since
ArcGIS Maps SDK for JavaScript 4.21

Provides the logic for the ShadowCast widget and component.

See also

Constructors

Constructor

Constructor
Parameters
ParameterTypeDescriptionRequired
properties
See the properties table for a list of all the properties that may be passed into the constructor.

Properties

Any properties can be set, retrieved or listened to. See the Watch for changes topic.

date

autocast Property
Type
Date

The calendar date used to calculate the shadow cast. This date excludes the time. If a date with a time is set, the time value will be set to midnight (00:00:00) of that date in local system time. If no date is set, then it defaults to the current date in local system time.

Example
widget.viewModel.date = new Date('June 1, 2021');

declaredClass

readonlyinherited Property
Type
string
Inherited from: Accessor

The name of the class. The declared class name is formatted as esri.folder.className.

discreteOptions

autocast Property
Type
DiscreteOptions

The configuration used when the widget's visualizationType is set to "discrete".

durationOptions

autocast Property
Type
DurationOptions

The configuration used when the widget's visualizationType is set to "duration".

endTimeOfDay

Property
Type
number

Time (in milliseconds from midnight of the date) when the shadow cast computation should stop. By default the shadow cast end time is set to 4PM (16 * 3600 * 1000ms).

Default value
16 * 3600 * 1000

startTimeOfDay

Property
Type
number

Time (in milliseconds from midnight of the date) when the shadow cast computation should start. By default the shadow cast start time is set to 10AM (10 * 3600 * 1000ms).

Default value
10 * 3600 * 1000

state

readonly Property
Type
ShadowCastState

The current state of the view model that can be used for rendering the UI of the widget.

ValueDescription
disabledwidget is being created
readywidget is ready
Default value
"disabled"

thresholdOptions

autocast Property
Type
ThresholdOptions

The configuration used when the widget's visualizationType is set to "threshold".

utcOffset

Property
Type
number

The difference in hours between UTC time and the times displayed in the widget.

view

Property
Type
SceneView | null | undefined

A reference to the View. This widget is only supported in a SceneView.

visualizationType

Property
Type
ShadowVisualizationType

Type of visualization to use when showing the shadows. There are 3 types of visualization:

  • "threshold" only displays areas that receive shadows for a period longer than a given threshold value
  • "duration" displays all areas that receive shadows either in a continuous mode or in 1 hour time intervals
  • "discrete" mode displays individual shadows cast at a given time interval
Default value
"threshold"

Methods

MethodSignatureClass
getDuration(point: ScreenPoint): Promise<number>
start(): void
stop(): void

getDuration

Method
Signature
getDuration (point: ScreenPoint): Promise<number>

Returns the time (in milliseconds) spent in shadow for a certain point on the screen.

Parameters
ParameterTypeDescriptionRequired
point

The point on the screen for which shadow cast is calculated.

Returns
Promise<number>

Resolves with the time in milliseconds spent in shadow for the given screenpoint.

start

Method
Signature
start (): void

Starts the widget. While running it will automatically perform shadow accumulation.

Returns
void

stop

Method
Signature
stop (): void

Stops the widget.

Returns
void

Type definitions

ShadowCastState

deprecated Type definition
Type
"disabled" | "ready"