NGL@1.0.0-beta.7 Home Manual Reference Source Gallery
import Component from 'ngl/src/component/component.js'
public interface | source

Component

Base class for components

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public
public
public
public
public
public
public
public
public

Events emitted by the component

public
public
public
public get
public
public
public

Method Summary

Public Methods
public

addAnnotation(position: Vector3, content: String | Element, params: Object): Annotation

Add an anotation object

public
public

Add a new representation to the component

public

autoView(duration: Integer): undefined

Automatically center and zoom the component

public
public

Iterator over each annotation and executing the callback

public

Iterator over each representation and executing the callback

public
public abstract
public
public
public
public
public

Remove all annotations from the component

public

Removes all representation components

public

Remove the give annotation from the component

public

Removes a representation component

public
public

Set position transform

public

Set rotation transform

public

Set scale transform

public
public

Set general transform.

public

Set the visibility of the component, including added representations

public
public

Public Constructors

public constructor(stage: Stage, params: ComponentParameters) source

Params:

NameTypeAttributeDescription
stage Stage

stage object the component belongs to

params ComponentParameters

parameter object

Public Members

public annotationList source

public controls source

public matrix source

public name source

public position source

public quaternion source

public reprList source

public scale source

public signals: ComponentSignals source

Events emitted by the component

public stage source

public status source

public transform source

public get type source

public uuid source

public viewer source

public visible source

Public Methods

public addAnnotation(position: Vector3, content: String | Element, params: Object): Annotation source

Add an anotation object

Params:

NameTypeAttributeDescription
position Vector3

the 3d position

content String | Element

the HTML content

params Object
  • optional

parameters

params.offsetX Integer

2d offset in x direction

params.offsetY Integer

2d offset in y direction

Return:

Annotation

the added annotation object

public addBufferRepresentation() source

public addRepresentation(type: String, object: Object, params: RepresentationParameters): RepresentationComponent source

Add a new representation to the component

Params:

NameTypeAttributeDescription
type String

the name of the representation

object Object

the object on which the representation should be based

params RepresentationParameters
  • optional

representation parameters

Return:

RepresentationComponent

the created representation wrapped into a representation component object

public autoView(duration: Integer): undefined source

Automatically center and zoom the component

Params:

NameTypeAttributeDescription
duration Integer
  • optional

duration of the animation, defaults to 0

Return:

undefined

public dispose() source

public eachAnnotation(callback: Function): undefined source

Iterator over each annotation and executing the callback

Params:

NameTypeAttributeDescription
callback Function

function to execute

Return:

undefined

public eachRepresentation(callback: Function): undefined source

Iterator over each representation and executing the callback

Params:

NameTypeAttributeDescription
callback Function

function to execute

Return:

undefined

public getBox(): Box3 source

Return:

Box3

the component's bounding box

public abstract getBoxUntransformed(): Box3 source

Return:

Box3

the untransformed component's bounding box

public getCenter(): Vector3 source

Return:

Vector3

the component's center position

public getCenterUntransformed() source

public getZoom() source

public hasRepresentation() source

public removeAllAnnotations(): undefined source

Remove all annotations from the component

Return:

undefined

public removeAllRepresentations(): undefined source

Removes all representation components

Return:

undefined

public removeAnnotation(annotation: Annotation): undefined source

Remove the give annotation from the component

Params:

NameTypeAttributeDescription
annotation Annotation

the annotation to remove

Return:

undefined

public removeRepresentation(repr: RepresentationComponent): undefined source

Removes a representation component

Params:

NameTypeAttributeDescription
repr RepresentationComponent

the representation component

Return:

undefined

public setName() source

public setPosition(p: Vector3 | Array): Component source

Set position transform

Params:

NameTypeAttributeDescription
p Vector3 | Array

the coordinates

Return:

Component

this object

Example:

// translate by 25 angstrom along x axis
component.setPosition( [ 25, 0, 0 ] );

public setRotation(r: Quaternion | Euler | Array): Component source

Set rotation transform

Params:

NameTypeAttributeDescription
r Quaternion | Euler | Array

the rotation

Return:

Component

this object

Example:

// rotate by 2 degree radians on x axis
component.setRotation( [ 2, 0, 0 ] );

public setScale(s: Number): Component source

Set scale transform

Params:

NameTypeAttributeDescription
s Number

the scale

Return:

Component

this object

Example:

// scale by factor of two
component.setScale( 2 );

public setStatus() source

public setTransform(m: Matrix4): Component source

Set general transform. Is applied before and in addition to the position, rotation and scale transformations

Params:

NameTypeAttributeDescription
m Matrix4

the matrix

Return:

Component

this object

Example:

component.setTransform( matrix );

public setVisibility(value: Boolean): Component source

Set the visibility of the component, including added representations

Params:

NameTypeAttributeDescription
value Boolean

visibility flag

Return:

Component

this object

public updateMatrix() source

public updateRepresentations() source