Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Stage

Stage class, central for creating molecular scenes with NGL.

example

var stage = new Stage( "elementId", { backgroundColor: "white" } );

Hierarchy

  • Stage

Index

Constructors

constructor

Properties

animationBehavior

animationBehavior: AnimationBehavior

animationControls

animationControls: AnimationControls

compList

compList: Component[] = []

defaultFileParams

defaultFileParams: {}

Type declaration

keyBehavior

keyBehavior: KeyBehavior

keyControls

keyControls: KeyControls

lastFullscreenElement

lastFullscreenElement: HTMLElement

logList

logList: string[] = []

mouseBehavior

mouseBehavior: MouseBehavior

mouseControls

mouseControls: MouseControls

mouseObserver

mouseObserver: MouseObserver

parameters

parameters: StageParameters

pickingBehavior

pickingBehavior: PickingBehavior

pickingControls

pickingControls: PickingControls

rockAnimation

rockAnimation: Animation

spinAnimation

spinAnimation: Animation

tasks

tasks: Counter = new Counter()

Counter that keeps track of various potentially long-running tasks, including file loading and surface calculation.

tooltip

tooltip: HTMLElement

trackballControls

trackballControls: TrackballControls

Optional transformAtom

transformAtom: AtomProxy

Optional transformComponent

transformComponent: Component

viewer

viewer: Viewer

viewerControls

viewerControls: ViewerControls

Methods

addComponent

addComponentFromObject

autoView

  • autoView(duration?: undefined | number): void
  • Add a zoom and a move animation with automatic targets

    Parameters

    • Optional duration: undefined | number

      animation time in milliseconds

    Returns void

defaultFileRepresentation

  • defaultFileRepresentation(component: Component): void

dispose

  • dispose(): void

eachComponent

  • eachComponent(callback: (comp: Component) => void, type?: undefined | string): void
  • Iterator over each component and executing the callback

    Parameters

    • callback: (comp: Component) => void
    • Optional type: undefined | string

    Returns void

eachRepresentation

getBox

  • getBox(): Box3

getCenter

  • getCenter(optionalTarget?: Vector3): Vector3

getComponentsByName

getComponentsByObject

getFocus

  • getFocus(): number
  • Get the current focus from the current clipNear value expressed as 0 (full view) to 100 (completely clipped) Negative values may be returned in some cases.

    In 'camera' clipMode focus isn't applicable, this method returns 0.0

    Returns number

    focus

getParameters

  • getParameters(): { ambientColor: string | number; ambientIntensity: number; backgroundColor: string | number; cameraEyeSep: number; cameraFov: number; cameraType: "perspective" | "orthographic" | "stereo"; clipDist: number; clipFar: number; clipMode: string; clipNear: number; clipScale: string; fogFar: number; fogNear: number; hoverTimeout: number; impostor: boolean; lightColor: string | number; lightIntensity: number; mousePreset: "default" | "pymol" | "coot" | "astexviewer"; panSpeed: number; quality: "high" | "medium" | "low" | "auto"; rotateSpeed: number; sampleLevel: number; tooltip: boolean; workerDefault: boolean; zoomSpeed: number }
  • Get stage parameters

    Returns { ambientColor: string | number; ambientIntensity: number; backgroundColor: string | number; cameraEyeSep: number; cameraFov: number; cameraType: "perspective" | "orthographic" | "stereo"; clipDist: number; clipFar: number; clipMode: string; clipNear: number; clipScale: string; fogFar: number; fogNear: number; hoverTimeout: number; impostor: boolean; lightColor: string | number; lightIntensity: number; mousePreset: "default" | "pymol" | "coot" | "astexviewer"; panSpeed: number; quality: "high" | "medium" | "low" | "auto"; rotateSpeed: number; sampleLevel: number; tooltip: boolean; workerDefault: boolean; zoomSpeed: number }

    • ambientColor: string | number
    • ambientIntensity: number
    • backgroundColor: string | number
    • cameraEyeSep: number
    • cameraFov: number
    • cameraType: "perspective" | "orthographic" | "stereo"
    • clipDist: number
    • clipFar: number
    • clipMode: string
    • clipNear: number
    • clipScale: string
    • fogFar: number
    • fogNear: number
    • hoverTimeout: number
    • impostor: boolean
    • lightColor: string | number
    • lightIntensity: number
    • mousePreset: "default" | "pymol" | "coot" | "astexviewer"
    • panSpeed: number
    • quality: "high" | "medium" | "low" | "auto"
    • rotateSpeed: number
    • sampleLevel: number
    • tooltip: boolean
    • workerDefault: boolean
    • zoomSpeed: number

getRepresentationsByName

getZoom

  • getZoom(): number

getZoomForBox

  • getZoomForBox(boundingBox: Box3): number

handleResize

  • handleResize(): void

loadFile

  • Load a file onto the stage

    example

    // load from URL stage.loadFile( "http://files.rcsb.org/download/5IOS.cif" );

    example

    // load binary data in CCP4 format via a Blob var binaryBlob = new Blob( [ ccp4Data ], { type: 'application/octet-binary'} ); stage.loadFile( binaryBlob, { ext: "ccp4" } );

    example

    // load string data in PDB format via a Blob var stringBlob = new Blob( [ pdbData ], { type: 'text/plain'} ); stage.loadFile( stringBlob, { ext: "pdb" } );

    example

    // load a File object stage.loadFile( file );

    example

    // load from URL and add a 'ball+stick' representation with double/triple bonds stage.loadFile( "http://files.rcsb.org/download/1crn.cif" ).then( function( comp ){ comp.addRepresentation( "ball+stick", { multipleBond: true } ); } );

    Parameters

    • path: string | File | Blob

      either a URL or an object containing the file data

    • Default value params: Partial<StageLoadFileParams> = {}

      loading parameters

    Returns Promise<void | Component>

    A Promise object that resolves to a StructureComponent, a SurfaceComponent or a {@link ScriptComponent} object, depending on the type of the loaded file.

loadScript

  • loadScript(path: string | File | Blob): any

log

  • log(msg: string): void

makeImage

measureClear

  • measureClear(): void

measureUpdate

  • measureUpdate(): void

removeAllComponents

  • removeAllComponents(): void

removeComponent

  • removeComponent(component: Component): void

setFocus

  • setFocus(value: number): void
  • Set the focus, a value of 0 sets clipping planes to show full scene, while a value of 100 will compltely clip the scene.

    Parameters

    • value: number

      focus

    Returns void

setImpostor

  • setImpostor(value: boolean): void

setParameters

setQuality

setRock

  • setRock(flag: boolean): void
  • Set rock

    Parameters

    • flag: boolean

      if true start rocking and stop spinning

    Returns void

setSize

  • setSize(width: string, height: string): void
  • Set width and height

    Parameters

    • width: string

      CSS width value

    • height: string

      CSS height value

    Returns void

setSpin

  • setSpin(flag: boolean): void
  • Set spin

    Parameters

    • flag: boolean

      if true start rocking and stop spinning

    Returns void

toggleFullscreen

  • toggleFullscreen(element: HTMLElement): void

toggleRock

  • toggleRock(): void

toggleSpin

  • toggleSpin(): void

Object literals

signals

signals: object

clicked

clicked: Signal<T> = new Signal()

componentAdded

componentAdded: Signal<T> = new Signal()

componentRemoved

componentRemoved: Signal<T> = new Signal()

fullscreenChanged

fullscreenChanged: Signal<T> = new Signal()

hovered

hovered: Signal<T> = new Signal()

parametersChanged

parametersChanged: Signal<T> = new Signal()

Generated using TypeDoc