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

Constructors

Properties

renderContext: RenderContext

State of the WWT rendering engine.

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: TourEditTab

TourEditTab

uiController: null | UiController

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

Methods

  • Tilts the position of the view

    Parameters

    • x: number
    • y: number

    Returns 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

  • Capture the current frame as an image.

    Parameters

    • blobReady: BlobCallback

      A callback function to execute on the Blob representing the captured image.

    • width: number

      The desired image width.

    • height: number

      The desired image height.

    • format: string

      The desired image format (e.g. "image/jpeg")

    Returns void

  • Capture a video as a sequence of images

    Parameters

    • blobReady: BlobCallback

      A callback function to execute on each Blob representing a captured frame.

    • width: number

      The desired frame width.

    • height: number

      The desired frame height.

    • framesPerSecond: number

      The number of frames captured per second.

    • totalFrames: number

      The total number of frames to capture.

    • format: string

      The desired image format (e.g. "image/jpeg")

    Returns void

  • 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
  • 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.

  • 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.

  • 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.

  • 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
  • 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

  • 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

  • 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 ScriptInterface.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

  • Moves the position of the view

    Parameters

    • x: number
    • y: number

    Returns 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 ScriptInterface.add_tourReady method.

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

    Parameters

    • url: string

    Returns void

  • Remove a previously loaded "catalog HiPS" dataset from the view.

    Parameters

    • name: string

    Returns 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

  • 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

  • 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

  • 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

  • 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 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 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

  • Returns how long moving to the given position will take, in seconds.

    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)

    • Optional roll_deg: number

      Optional, The roll of the camera, in degrees.

    Returns number

  • 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

  • Add an imageset directly into the engine's database.

    If another imageset with the same image URL is already loaded, this is a no-op, and the pre-existing imageset is returned. The difference might matter for future name-based lookups.

    Parameters

    Returns Imageset

    Either the input imageset, or the pre-existing imageset in the no-op condition.

Generated using TypeDoc