ShadowCastViewModel

AMD: require(["esri/widgets/ShadowCast/ShadowCastViewModel"], (ShadowCastViewModel) => { /* code goes here */ });
ESM: import ShadowCastViewModel from "@arcgis/core/widgets/ShadowCast/ShadowCastViewModel.js";
Class: esri/widgets/ShadowCast/ShadowCastViewModel
Inheritance: ShadowCastViewModel→Accessor
Since: ArcGIS Maps SDK for JavaScript 4.21

Provides the logic for the ShadowCast widget.

See also

Constructors

ShadowCastViewModel

Constructor
new ShadowCastViewModel(properties)
Parameter
properties Object
optional

See the properties for a list of all the properties that may be passed into the constructor.

Property Overview

Any properties can be set, retrieved or listened to. See the Working with Properties topic.
Show inherited properties Hide inherited properties
Name Type Summary Class

The calendar date used to calculate the shadow cast.

ShadowCastViewModel

The name of the class.

Accessor

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

ShadowCastViewModel

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

ShadowCastViewModel

Time (in milliseconds from midnight of the date) when the shadow cast computation should stop.

ShadowCastViewModel

Time (in milliseconds from midnight of the date) when the shadow cast computation should start.

ShadowCastViewModel

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

ShadowCastViewModel

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

ShadowCastViewModel

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

ShadowCastViewModel

A reference to the View.

ShadowCastViewModel

Type of visualization to use when showing the shadows.

ShadowCastViewModel

Property Details

date

Property
date 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

Inherited
Property
declaredClass Stringreadonly
Inherited from Accessor

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

discreteOptions

Property
discreteOptions Accessor

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

Properties
color Color
optional
Default Value:[50, 50, 50, 0.7]

Color of the shadow visualization. The opacity of the visualization is mapped to the number of overlapping shadows. No shadow corresponds to opacity 0 and maximum number of shadows corresponds to the opacity set in this color value.

interval Number
optional
Default Value:15 * 60 * 1000

Individual shadows are displayed at this time interval, starting with the startTimeOfDay. The interval is expressed in milliseconds. By default it is set to 15 minutes (15 * 60 * 1000). If set to 0, we'll use the smallest possible interval, up to a maximum of 256 samples.

intervalOptions Collection<number>
optional

Values (in milliseconds) selectable in the UI for the interval used to display shadows.

durationOptions

Property
durationOptions Accessor

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

Properties
color Color
optional
Default Value:[0, 0, 255, 0.7]

Color of the shadow cast. The opacity is mapped to the time spent in shadow. Areas that don't receive any shadow are displayed with zero opacity and areas that receive shadows for the entire time range are displayed with the opacity specified in this property.

mode String
optional
Default Value:"continuous"

Mode in which the cumulative shadow duration should be displayed: as a continuous surface or as an hourly aggregation of values.

Possible Values:"continuous"|"hourly"

endTimeOfDay

Property
endTimeOfDay 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
startTimeOfDay 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

Property
state Stringreadonly

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

Value Description
disabled widget is being created
ready widget is ready

Possible Values:"disabled" |"ready"

Default Value:"disabled"

thresholdOptions

Property
thresholdOptions Accessor

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

Properties
color Color
optional
Default Value:[255, 0 , 0, 0.7]

Color of the shadow visualization. The areas with cumulative shadow time longer than the threshold value are displayed with this color.

value Number
optional
Default Value:4 * 3600 * 1000

Time period in milliseconds. Only shadows cast for more time than this value are displayed.

minValue Number
optional
Default Value:0

The minimum time period (in milliseconds) selectable in the UI for the threshold value. The values in the widget slider are displayed in hours.

maxValue Number
optional
Default Value:8 * 3600 * 1000

The maximum time period (in milliseconds) selectable in the UI for the threshold value. The values in the widget slider are displayed in hours.

utcOffset

Property
utcOffset Number

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

view

Property
view SceneView

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

visualizationType

Property
visualizationType String

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

Possible Values:"threshold" |"duration" |"discrete"

Default Value:"threshold"

Method Overview

Show inherited methods Hide inherited methods
Name Return Type Summary Class

Adds one or more handles which are to be tied to the lifecycle of the object.

Accessor

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

ShadowCastViewModel

Returns true if a named group of handles exist.

Accessor

Removes a group of handles owned by the object.

Accessor

Starts the widget.

ShadowCastViewModel

Stops the widget.

ShadowCastViewModel

Method Details

addHandles

Inherited
Method
addHandles(handleOrHandles, groupKey)
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25 Accessor since 4.0, addHandles added at 4.25.

Adds one or more handles which are to be tied to the lifecycle of the object. The handles will be removed when the object is destroyed.

// Manually manage handles
const handle = reactiveUtils.when(
  () => !view.updating,
  () => {
    wkidSelect.disabled = false;
  },
  { once: true }
);

this.addHandles(handle);

// Destroy the object
this.destroy();
Parameters
handleOrHandles WatchHandle|WatchHandle[]

Handles marked for removal once the object is destroyed.

groupKey *
optional

Key identifying the group to which the handles should be added. All the handles in the group can later be removed with Accessor.removeHandles(). If no key is provided the handles are added to a default group.

getDuration

Method
getDuration(point){Number}

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

Parameter
point ScreenPoint

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

Returns
Type Description
Number The time in milliseconds spent in shadow for the given screenpoint.

hasHandles

Inherited
Method
hasHandles(groupKey){Boolean}
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25 Accessor since 4.0, hasHandles added at 4.25.

Returns true if a named group of handles exist.

Parameter
groupKey *
optional

A group key.

Returns
Type Description
Boolean Returns true if a named group of handles exist.
Example
// Remove a named group of handles if they exist.
if (obj.hasHandles("watch-view-updates")) {
  obj.removeHandles("watch-view-updates");
}

removeHandles

Inherited
Method
removeHandles(groupKey)
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25 Accessor since 4.0, removeHandles added at 4.25.

Removes a group of handles owned by the object.

Parameter
groupKey *
optional

A group key or an array or collection of group keys to remove.

Example
obj.removeHandles(); // removes handles from default group

obj.removeHandles("handle-group");
obj.removeHandles("other-handle-group");

start

Method
start()

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

stop

Method
stop()

Stops the widget.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.