Options
All
  • Public
  • Public/Protected
  • All
Menu

Class WWTControl

The primary WWT engine state object.

The main state of the WWT rendering engine is stored in a global WWTControl singleton object. As such, this class has APIs relating to nearly every single feature offered by WWT. The ScriptInterface object adds a few additional features, but it primarily delegates its work to this class.

Rendering

UI Plumbing

Basic Camera Controls

Core Datasets

Tours

Other Settings

Hierarchy

  • WWTControl

Index

Constructors

constructor

Properties

renderContext

renderContext: RenderContext

State of the WWT rendering engine.

renderType

renderType: ImageSetType

The current mode that the renderer is in.

This value tracks the type of the background imageset. It is updated at the beginning of renderOneFrame, not immediately upon alteration of the background image set.

tourEdit

tourEdit: TourEditTab

TourEditTab

uiController

uiController: null | UiController

Special UI state that may be active such as a TourPlayer.

Methods

_tilt

  • _tilt(x: number, y: number): void

addCatalogHips

  • addCatalogHips(imageset: Imageset): void

addCatalogHipsByName

  • addCatalogHipsByName(name: string): void

addCatalogHipsByNameWithCallback

  • addCatalogHipsByNameWithCallback(name: string, onLoad: Action): void
  • Add a "catalog HiPS" dataset to the current view, by name, with a callback.

    Same as addCatalogHipsByName, with the addition that the onLoad callback will be called once the initial data loading of the catalog HiPS data has completed. See also addCatalogHips.

    Parameters

    Returns void

createTour

getCoordinatesForScreenPoint

  • getCoordinatesForScreenPoint(x: number, y: number): { x: number; y: number }
  • Given x and y coordinates on the screen, returns the RA and Dec

    Parameters

    • x: number
    • y: number

    Returns { x: number; y: number }

    • x: number
    • y: number

getCurrentReferenceFrame

  • getCurrentReferenceFrame(): string
  • Get the name of the reference frame associated with the current view.

    The current reference frame defines the physical coordinates of the view and the list of layers that are included in the current rendering process. The return value of this function can be indexed into LayerManager.get_allMaps to find the root LayerMap that is used to determine what gets rendered in the current view.

    In standard 2D sky mode, the return value will be "Sky".

    Returns string

    The name of the current reference frame.

getDefaultImageset

  • getDefaultImageset(type: ImageSetType, bandpass: BandPass): Imageset
  • Find a "default" imageset for the specified type and bandpass.

    This function searches the control’s database of imagery and returns a "default" imageset for the given settings. First preference is given to an imageset with matching type and bandpass that has a Imageset.get_defaultSet of true (corresponding to the StockSet XML attribute). If no such set exists, the first set with matching type and bandpass is returned, regardless of its defaultSet setting. If there is still no such result, the first imageset with the same type, ignoring bandpass, is returned. Finally if all else fails, the first imageset in the database is returned.

    Parameters

    • type: ImageSetType

      The type of imageset to search.

    • bandpass: BandPass

      The bandpass to prefer.

    Returns Imageset

    The chosen default imageset.

getImagesetByName

  • getImagesetByName(imagesetName: string): null | Imageset
  • Look up an imageset by its name.

    The name matching is case-insensitive, matches on substrings, and moves through a list of imagesets that may be populated in an unpredictable order. Therefore even if you provide a name that is an exact match for an existing imageset, you might get a different one than you expect.

    Parameters

    • imagesetName: string

      The name to look up.

    Returns null | Imageset

    An imageset with a matching name, or null if none was found.

getScreenPointForCoordinates

  • getScreenPointForCoordinates(ra: number, dec: number): { x: number; y: number }
  • Given RA and Dec, return the x and y coordinates of the corresponding screen point

    Parameters

    • ra: number
    • dec: number

    Returns { x: number; y: number }

    • x: number
    • y: number

gotoRADecZoom

  • gotoRADecZoom(ra_hours: number, dec_deg: number, zoom: number, instant: boolean, roll_deg?: number): void
  • Start navigating the view to the specified position.

    Parameters

    • ra_hours: number

      The target right ascension, in hours.

    • dec_deg: number

      The target declination, in degrees.

    • zoom: number

      The target zoom level (see below)

    • instant: boolean

      Whether to snap the view instantly or move gradually.

    • Optional roll_deg: number

      Optional, The roll of the camera, in degrees.

      If instant is true or the commanded camera position is extremely close to the current camera position, the view will update instantly. Otherwise it will scroll there smoothly, taking an unpredictable amount of time to arrive.

      The zoom level is the height of the viewport in degrees, times six.

      Navigating the view in this way ends any "tracking" status of the current view.

    Returns void

gotoTarget

  • gotoTarget(place: Place, noZoom: boolean, instant: boolean, trackObject: boolean): void
  • Start navigating the view to the specified Place.

    Parameters

    • place: Place

      The destination of the view

    • noZoom: boolean

      If true, the zoom, angle, and rotation of the target camera position will be set to match the current camera position. Otherwise, these parameters will be reset to reasonable defaults.

    • instant: boolean

      If true, the view camera will immediately snap to the destination position. Otherwise, it will gradually move.

    • trackObject: boolean

      If true, the camera will continue tracking the view target as it moves with the progression of the WWT internal clock.

    Returns void

loadTour

  • loadTour(url: string): void
  • Start loading the tour stored at the specified URL.

    When loading is complete, a tourReady event will be issued, which you can listen for using the add_tourReady method. You can then get access to a TourPlayer by casting the uiController property of this WWTControl:

    if (ctl.uiController !== null && ctl.uiController instanceof TourPlayer) {
      const player: TourPlayer = ctl.uiController;
      // ...
    }
    

    Parameters

    • url: string

    Returns void

move

  • move(x: number, y: number): void

pauseCurrentTour

  • pauseCurrentTour(): void

playCurrentTour

  • playCurrentTour(): void

playTour

  • playTour(url: string): void
  • Load the tour stored at the specified URL and start playing it.

    When loading is complete, a tourReady event will be issued, which you can listen for using the add_tourReady method.

    See also loadTour, which provides more flexibility to the caller.

    Parameters

    • url: string

    Returns void

removeCatalogHipsByName

  • removeCatalogHipsByName(name: string): void
  • Remove a previously loaded "catalog HiPS" dataset from the view.

    Parameters

    • name: string

    Returns void

renderOneFrame

  • renderOneFrame(): void
  • Render the view.

    Note that there also exists a similar method named render, but it automatically runs itself in a rendering loop outside of control of the caller, so its use is discouraged.

    Returns void

setBackgroundImageByName

  • setBackgroundImageByName(imagesetName: string): void
  • Set the background imageset using a name-based lookup.

    This function may change the viewer mode (e.g. sky, panorama, 3D solar system, etc.). To avoid display artifacts when switching to a planetary mode, set the foreground imageset to the same value using setForegroundImageByName.

    The imageset lookup is done using getImagesetByName. If the imageset is not found, this function silently does nothing.

    Parameters

    • imagesetName: string

    Returns void

setForegroundImageByName

  • setForegroundImageByName(imagesetName: string): void
  • Set the foreground imageset using a name-based lookup.

    The imageset lookup is done using getImagesetByName. If the imageset is not found, this function silently does nothing.

    Note that this function does not alter the camera in any way. You will need to use additional API calls if you want to navigate the view to the imageset in question.

    Parameters

    • imagesetName: string

    Returns void

setSolarSystemMaxZoom

  • setSolarSystemMaxZoom(limit: number): void
  • Set the maximum allowed user zoom level in 3D ("solar system") mode.

    Parameters

    • limit: number

      The new zoom limit.

      This sets how far the user can zoom out when operating in the 3D mode. XXX: I do not know what units this value is measured in! The default value is 10^16.

    Returns void

setSolarSystemMinZoom

  • setSolarSystemMinZoom(limit: number): void
  • Set the minimum allowed user zoom level in 3D ("solar system") mode.

    Parameters

    • limit: number

      The new zoom limit.

      This sets how far the user can zoom in when operating in the 3D mode. XXX: I do not know what units this value is measured in! The default value is 10^-8.

    Returns void

set_zoomMax

  • set_zoomMax(limit: number): number
  • Set the maximum allowed user zoom level in 2D modes.

    Parameters

    • limit: number

      The new zoom limit.

      This sets how far the user can zoom out when operating in a 2D mode such as Sky mode. The zoom number is the angular height of the viewport, measured in degrees, times 6. The default value is 360, corresponding to a viewport height of 60 degrees.

    Returns number

set_zoomMin

  • set_zoomMin(limit: number): number
  • Set the minimum allowed user zoom level in 2D modes.

    Parameters

    • limit: number

      The new zoom limit.

      Note, this limit is not enforced when the user is manually zooming the view in and out. It is only enforced for programmatic moves such a loading a new Place.

      This sets how far the user can zoom in when operating in a 2D mode such as Sky mode. The zoom number is the angular height of the viewport, measured in degrees, times 6. The default value corresponds to a viewport height of 47 arcseconds.

    Returns number

stopCurrentTour

  • stopCurrentTour(): void

zoom

  • zoom(factor: number): void
  • Change the zoom of the current view. The change is not necessarily instantaneous, depending on whether the "smooth pan" setting is activated.

    Parameters

    • factor: number

      The multiplicative factor by which to change the zoom level. A number larger than one causes the field of view to increase, i.e. a zoom out.

    Returns void

Static getImageSets

Generated using TypeDoc