This is a helper base class for Vue components that wish to interact with a
WWTComponent through the Pinia state management system. It is only
recommended for using using Vue’s “options API”. If you are
instead using the “composition API”, it is recommended to use
engineStore directly.
This class doesn’t implement any special functionality itself. All it does is
provide a set of state variables and methods that are pre-connected to the
WWT Pinia interface. A component inheriting from this class can
use whichever ones it needs without having to set up that integration itself.
For that reason, the detailed API associated with this class is
intentionally undocumented, so that the in-depth documentation can be
centralized in one place: see the API summary associated with
the engineStore function.
Say that you are creating a simple WWT-powered app with a main App.vue
component that includes a WWT sub-component and a readout of the current
coordinates of the WWT view center. Your app Vue file might look like this:
exportdefaultApp = defineComponent({ extends:WWTAwareComponent, // <== we are extending WWTAwareComponent
computed: { coordText() { // We don't have to define `wwtRARad` and `wwtDecRad` ourselves: return`${fmtHours(this.wwtRARad)}${fmtDegLat(this.wwtDecRad)}`; } } }); </script>
Because this component extends WWTAwareComponent, it automatically
has getters for wwtRARad and wwtDecRad that can be used to
set up the coordinate readout easily.
The strings "number", "string", or "default" to specify what primitive to return.
Returns string | number
A number if 'hint' was "number", a string if 'hint' was "string" or "default".
Throws
If 'hint' was given something other than "number", "string", or "default".
getDate:function
getDate(): number
Gets the day-of-the-month, using local time.
Returns number
getDay:function
getDay(): number
Gets the day of the week, using local time.
Returns number
getFullYear:function
getFullYear(): number
Gets the year, using local time.
Returns number
getHours:function
getHours(): number
Gets the hours in a date, using local time.
Returns number
getMilliseconds:function
getMilliseconds(): number
Gets the milliseconds of a Date, using local time.
Returns number
getMinutes:function
getMinutes(): number
Gets the minutes of a Date object, using local time.
Returns number
getMonth:function
getMonth(): number
Gets the month, using local time.
Returns number
getSeconds:function
getSeconds(): number
Gets the seconds of a Date object, using local time.
Returns number
getTime:function
getTime(): number
Gets the time value in milliseconds.
Returns number
getTimezoneOffset:function
getTimezoneOffset(): number
Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC).
Returns number
getUTCDate:function
getUTCDate(): number
Gets the day-of-the-month, using Universal Coordinated Time (UTC).
Returns number
getUTCDay:function
getUTCDay(): number
Gets the day of the week using Universal Coordinated Time (UTC).
Returns number
getUTCFullYear:function
getUTCFullYear(): number
Gets the year using Universal Coordinated Time (UTC).
Returns number
getUTCHours:function
getUTCHours(): number
Gets the hours value in a Date object using Universal Coordinated Time (UTC).
Returns number
getUTCMilliseconds:function
getUTCMilliseconds(): number
Gets the milliseconds of a Date object using Universal Coordinated Time (UTC).
Returns number
getUTCMinutes:function
getUTCMinutes(): number
Gets the minutes of a Date object using Universal Coordinated Time (UTC).
Returns number
getUTCMonth:function
getUTCMonth(): number
Gets the month of a Date object using Universal Coordinated Time (UTC).
Returns number
getUTCSeconds:function
getUTCSeconds(): number
Gets the seconds of a Date object using Universal Coordinated Time (UTC).
Returns number
setDate:function
setDate(date): number
Sets the numeric day-of-the-month value of the Date object using local time.
Parameters
date: number
A numeric value equal to the day of the month.
Returns number
setFullYear:function
setFullYear(year, month?, date?): number
Sets the year of the Date object using local time.
Parameters
year: number
A numeric value for the year.
Optionalmonth: number
A zero-based numeric value for the month (0 for January, 11 for December). Must be specified if numDate is specified.
Optionaldate: number
A numeric value equal for the day of the month.
Returns number
setHours:function
setHours(hours, min?, sec?, ms?): number
Sets the hour value in the Date object using local time.
Parameters
hours: number
A numeric value equal to the hours value.
Optionalmin: number
A numeric value equal to the minutes value.
Optionalsec: number
A numeric value equal to the seconds value.
Optionalms: number
A numeric value equal to the milliseconds value.
Returns number
setMilliseconds:function
setMilliseconds(ms): number
Sets the milliseconds value in the Date object using local time.
Parameters
ms: number
A numeric value equal to the millisecond value.
Returns number
setMinutes:function
setMinutes(min, sec?, ms?): number
Sets the minutes value in the Date object using local time.
Parameters
min: number
A numeric value equal to the minutes value.
Optionalsec: number
A numeric value equal to the seconds value.
Optionalms: number
A numeric value equal to the milliseconds value.
Returns number
setMonth:function
setMonth(month, date?): number
Sets the month value in the Date object using local time.
Parameters
month: number
A numeric value equal to the month. The value for January is 0, and other month values follow consecutively.
Optionaldate: number
A numeric value representing the day of the month. If this value is not supplied, the value from a call to the getDate method is used.
Returns number
setSeconds:function
setSeconds(sec, ms?): number
Sets the seconds value in the Date object using local time.
Parameters
sec: number
A numeric value equal to the seconds value.
Optionalms: number
A numeric value equal to the milliseconds value.
Returns number
setTime:function
setTime(time): number
Sets the date and time value in the Date object.
Parameters
time: number
A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT.
Returns number
setUTCDate:function
setUTCDate(date): number
Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC).
Parameters
date: number
A numeric value equal to the day of the month.
Returns number
setUTCFullYear:function
setUTCFullYear(year, month?, date?): number
Sets the year value in the Date object using Universal Coordinated Time (UTC).
Parameters
year: number
A numeric value equal to the year.
Optionalmonth: number
A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. Must be supplied if numDate is supplied.
Optionaldate: number
A numeric value equal to the day of the month.
Returns number
setUTCHours:function
setUTCHours(hours, min?, sec?, ms?): number
Sets the hours value in the Date object using Universal Coordinated Time (UTC).
Parameters
hours: number
A numeric value equal to the hours value.
Optionalmin: number
A numeric value equal to the minutes value.
Optionalsec: number
A numeric value equal to the seconds value.
Optionalms: number
A numeric value equal to the milliseconds value.
Returns number
setUTCMilliseconds:function
setUTCMilliseconds(ms): number
Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC).
Parameters
ms: number
A numeric value equal to the millisecond value.
Returns number
setUTCMinutes:function
setUTCMinutes(min, sec?, ms?): number
Sets the minutes value in the Date object using Universal Coordinated Time (UTC).
Parameters
min: number
A numeric value equal to the minutes value.
Optionalsec: number
A numeric value equal to the seconds value.
Optionalms: number
A numeric value equal to the milliseconds value.
Returns number
setUTCMonth:function
setUTCMonth(month, date?): number
Sets the month value in the Date object using Universal Coordinated Time (UTC).
Parameters
month: number
A numeric value equal to the month. The value for January is 0, and other month values follow consecutively.
Optionaldate: number
A numeric value representing the day of the month. If it is not supplied, the value from a call to the getUTCDate method is used.
Returns number
setUTCSeconds:function
setUTCSeconds(sec, ms?): number
Sets the seconds value in the Date object using Universal Coordinated Time (UTC).
Parameters
sec: number
A numeric value equal to the seconds value.
Optionalms: number
A numeric value equal to the milliseconds value.
Returns number
toDateString:function
toDateString(): string
Returns a date as a string value.
Returns string
toISOString:function
toISOString(): string
Returns a date as a string value in ISO format.
Returns string
toJSON:function
toJSON(key?): string
Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization.
Parameters
Optionalkey: any
Returns string
toLocaleDateString:function
toLocaleDateString(): string
Returns a date as a string value appropriate to the host environment's current locale.
Returns string
toLocaleDateString(locales?, options?): string
Converts a date to a string by using the current or specified locale.
Parameters
Optionallocales: string | string[]
A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
Optionaloptions: DateTimeFormatOptions
An object that contains one or more properties that specify comparison options.
Returns string
toLocaleDateString(locales?, options?): string
Converts a date to a string by using the current or specified locale.
Parameters
Optionallocales: LocalesArgument
A locale string, array of locale strings, Intl.Locale object, or array of Intl.Locale objects that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
Optionaloptions: DateTimeFormatOptions
An object that contains one or more properties that specify comparison options.
Returns string
toLocaleString:function
toLocaleString(): string
Returns a value as a string value appropriate to the host environment's current locale.
Returns string
toLocaleString(locales?, options?): string
Converts a date and time to a string by using the current or specified locale.
Parameters
Optionallocales: string | string[]
A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
Optionaloptions: DateTimeFormatOptions
An object that contains one or more properties that specify comparison options.
Returns string
toLocaleString(locales?, options?): string
Converts a date and time to a string by using the current or specified locale.
Parameters
Optionallocales: LocalesArgument
A locale string, array of locale strings, Intl.Locale object, or array of Intl.Locale objects that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
Optionaloptions: DateTimeFormatOptions
An object that contains one or more properties that specify comparison options.
Returns string
toLocaleTimeString:function
toLocaleTimeString(): string
Returns a time as a string value appropriate to the host environment's current locale.
Returns string
toLocaleTimeString(locales?, options?): string
Converts a time to a string by using the current or specified locale.
Parameters
Optionallocales: string | string[]
A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
Optionaloptions: DateTimeFormatOptions
An object that contains one or more properties that specify comparison options.
Returns string
toLocaleTimeString(locales?, options?): string
Converts a time to a string by using the current or specified locale.
Parameters
Optionallocales: LocalesArgument
A locale string, array of locale strings, Intl.Locale object, or array of Intl.Locale objects that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
Optionaloptions: DateTimeFormatOptions
An object that contains one or more properties that specify comparison options.
Returns string
toString:function
toString(): string
Returns a string representation of a date. The format of the string depends on the locale.
Returns string
toTimeString:function
toTimeString(): string
Returns a time as a string value.
Returns string
toUTCString:function
toUTCString(): string
Returns a date converted to a string using Universal Coordinated Time (UTC).
Returns string
valueOf:function
valueOf(): number
Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC.
Add a "catalog HiPS" dataset to the current view, by name.
If the catalog name is not in the engine's registry, the promise rejects.
Parameters
options: AddCatalogHipsByNameOptions
Returns Promise<Imageset>
addImageSetLayer
addImageSetLayer(options): Promise<ImageSetLayer>
Request the creation of a image layer. Either a single FITS or an image set.
The action resolves to a new ImageSetLayer instance.
It’s asynchronous because the requested url has to be downloaded.
Parameters
options: AddImageSetLayerOptions
Returns Promise<ImageSetLayer>
addImagesetToRepository
addImagesetToRepository(imgset): Imageset
Add an imageset directly into the engine's database.
If an imageset with the same URL has already been loaded, this is a
no-op.
This returns the imageset that ultimately resides in the engine's
database. It could either be the input argument, if it was newly added,
or a pre-existing imageset in the no-op condition.
Parameters
imgset: Imageset
Returns Imageset
applyFitsLayerSettings
applyFitsLayerSettings(options): void
Alter one or more settings of the specified FITS image layer as specified
in the options.
Alter one or more settings of the specified tabular data layers as specified
in the options.
Parameters
options: ApplyTableLayerSettingsOptions
Returns void
captureFrame
captureFrame(options): Promise<null | Blob>
Capture the current frame as an image Blob with the desired width, height, and format.
The first argument is a callback function to execute on the created Blob.
Capture a video as a stream of image Blobs with the desired width, height and format.
The number of frames per second and total frame count are specified as well.
Clear the current cache of tiles.
The intended use case here is if a network issue caused a necessary tile to not load.
This should only be used when necessary, as any previously downloaded tiles will need
to be re-fetched.
Returns void
closeTourPlayer
closeTourPlayer(): void
Close the active tour player, if there is one active.
Any tour that is currently playing will be stopped.
Request the engine to load the specified image collection.
The image collection is a WTML file
Images in collections loaded this way become usable for name-based lookup
by interfaces such as setForegroundImageByName.
The action resolves to a Folder instance.
It’s asynchronous because the specified WTML file has to be downloaded.
Remove a "catalog HiPS" dataset to the current view, by name.
Parameters
name: string
Returns void
seekToTourTimecode
seekToTourTimecode(value): void
Seek tour playback to the specified timecode.
See tourTimecode for a definition of the tour timecode.
An important limitation is that the engine can only seek to the very
beginning of a tour stop. If you request a timecode in the middle of a
slide, the seek will actually occur to the start time of that slide.
Parameters
value: number
Returns void
setBackgroundImageByName
setBackgroundImageByName(imagesetName): void
Set the current background Imageset
based on its name.
The name lookup here is effectively done using lookupImageset. If
the name is not found, the current background imageset remains unchanged.
Changing the background imageset may change the value of renderType,
and the overall "mode" of the WWT renderer.
Parameters
imagesetName: string
Returns void
setClockRate
setClockRate(rate): void
Set the rate at which the WWT clock progresses compared to wall-clock time.
A value of 10 means that the WWT clock progresses ten times faster than
real time. A value of -0.1 means that the WWT clock moves backwards, ten
times slower than real time.
Altering this causes an increment in clockDiscontinuities.
Parameters
rate: number
Returns void
setClockSync
setClockSync(isSynced): void
Set whether the WWT clock should progress with real time.
Set whether the renderer settings of tours should remain applied after
those tours finish playing back.
This specialized option helps avoid jarring visual effects when tours
finish playing. If a tour activates a renderer option like "local horizon
mode", by default that option will turn off when the tour finishes, causing
the view to suddenly change. If this option is set to True, that setting
will remain active, preventing the sudden change.
Parameters
value: boolean
Returns void
setTrackedObject
setTrackedObject(obj): void
Set the "tracked object" in the 3D solar system view.
Set up the background and foreground imagesets according to
the options
The main use of this interface is that it provides a mechanism to guess
the appropriate background imageset given a foreground imageset that you
want to show.
Update the contents of a tabular data layer according to
the options.
Parameters
options: UpdateTableLayerOptions
Returns void
viewAsTourXml
viewAsTourXml(name): Promise<null | string>
Get the current view as a one-slide tour, serialized to XML
Parameters
name: string
Returns Promise<null | string>
waitForReady
waitForReady(): Promise<void>
Wait for the WWT engine to become ready for usage.
You should invoke this action and wait for is completion before trying to
do anything else with a WWT-aware component. The action resolves when the
WWT engine has completed its initialization, which involes the download of
some supporting data files.
Returns Promise<void>
zoom
zoom(factor): void
Set the zoom level of the view.
This action may result in an action that takes a perceptible amount of
time to resolve, if the "smooth pan" renderer option is enabled. To have
proper asynchronous feedback about when the zoom operation completes, use
gotoRADecZoom.
This is a helper base class for Vue components that wish to interact with a WWTComponent through the Pinia state management system. It is only recommended for using using Vue’s “options API”. If you are instead using the “composition API”, it is recommended to use engineStore directly.
This class doesn’t implement any special functionality itself. All it does is provide a set of state variables and methods that are pre-connected to the WWT Pinia interface. A component inheriting from this class can use whichever ones it needs without having to set up that integration itself. For that reason, the detailed API associated with this class is intentionally undocumented, so that the in-depth documentation can be centralized in one place: see the API summary associated with the engineStore function.
Example
Say that you are creating a simple WWT-powered app with a main
App.vue
component that includes a WWT sub-component and a readout of the current coordinates of the WWT view center. Your app Vue file might look like this:Because this component extends WWTAwareComponent, it automatically has getters for wwtRARad and wwtDecRad that can be used to set up the coordinate readout easily.
Note that the
extends
option is not recommended (or easily used) in the Composition API, which is why it is recommended to use engineStore directly instead.