Manual Reference Source
import Scene3D from 'modelo3d/doc/View/Scene3D.js'
public class | source

Scene3D

Constructor Summary

Public Constructor
public

Method Summary

Public Methods
public

Get the scene's clipping data.

public

getElementName(elementIndex: number): string

Get the element name, i.e., doc name + element id with element index in this cene.

public

Return all elements' names.

public

Get the number of elements inside this scene.

public

Whether this scene has any BIM data.

public

Whether this scene contains any contour lines.

public

Whether this scene contain any lines

public

Whether this scene contain any surfaces.

public

Check element's visibility.

public

Restore the elements color.

public

rotateModel(modelId: string, angle: number, axis: Array[number], point: Array[number])

Rotate the model with angle in radians round line given by axis (the direction) and point on the line.

public

setElementsColor(elementNames: Array<string>, color: Array<number>)

Set the elements' color. Notice that currently, Modelo supports 127 different custom colors.

public

setElementsVisibility(elementNames: Array<string>, visible: boolean)

Set the elements' visibility.

public

setLayersVisible(layers: array, visible: boolean)

Set the visibilities of layers

public

setModelVisiblity(modelId: string, visible: boolean)

Set the visibilities of all the elements in the model.

public

Set the visibility of the terrain

public

Set the callback function when rendering is about to happen.

public

translateModel(modelId: string, dx: number, dy: number, dz: number)

Translate the model.

Public Constructors

public constructor() source

Public Methods

public getClippingData(): object source

Get the scene's clipping data.

Return:

object

The current clipping status. If current clipping is disabled, it returns zero. Otherwise, it returns {"planes": 6 clipping planes, "points": 8 clipping vertices}.

public getElementName(elementIndex: number): string source

Get the element name, i.e., doc name + element id with element index in this cene.

Params:

NameTypeAttributeDescription
elementIndex number

The ID of the element to query

Return:

string

The element name.

public getElementsNames(): Array<string> source

Return all elements' names.

Return:

Array<string>

The names of all elements in the scene.

public getElementsNumber(): number source

Get the number of elements inside this scene.

Return:

number

The number of elements.

public hasBIM(): boolean source

Whether this scene has any BIM data.

Return:

boolean

True for yes.

public hasContours(): boolean source

Whether this scene contains any contour lines.

Return:

boolean

True if the scene contains contour lines.

public hasLines(): boolean source

Whether this scene contain any lines

Return:

boolean

True if the scene contains lines.

public hasSurfaces(): boolean source

Whether this scene contain any surfaces.

Return:

boolean

True if the scene contains surfaces.

public isElementVisible(elementName: string): boolean source

Check element's visibility.

Params:

NameTypeAttributeDescription
elementName string

The name of an element.

Return:

boolean

true if visible.

public restoreElementsColor(elementNames: Array<string>) source

Restore the elements color.

Params:

NameTypeAttributeDescription
elementNames Array<string>

An array of element names. Each element name is a composition of doc id and element ID, e.g., "0/100231". Note that for a single document, the doc id is always 0.

public rotateModel(modelId: string, angle: number, axis: Array[number], point: Array[number]) source

Rotate the model with angle in radians round line given by axis (the direction) and point on the line. The rotation direction is righ-hand (ccw).

Params:

NameTypeAttributeDescription
modelId string

The id of the model to rotate.

angle number

Then rotating angle in degree.

axis Array[number]

The direcion to rotating around. eg, [1, 0, 0].

point Array[number]

The anchor point of the rotating axis.

public setElementsColor(elementNames: Array<string>, color: Array<number>) source

Set the elements' color. Notice that currently, Modelo supports 127 different custom colors.

Params:

NameTypeAttributeDescription
elementNames Array<string>

An array of element names. Each element name is a composition of doc id and element ID, e.g., "0/100231". Note that for a single document, the doc id is always 0.

color Array<number>

The target color represent by a array of 3 numbers range form 0.0-1.0 indicates the r, g, b value, e.g., [1.0, 0.0, 0.0].

public setElementsVisibility(elementNames: Array<string>, visible: boolean) source

Set the elements' visibility.

Params:

NameTypeAttributeDescription
elementNames Array<string>

An array of element names. Each element name is a composition of doc id and element ID, e.g., "0/100231". Note that for a single document, the doc id is always 0.

visible boolean

true to show and false to hide.

public setLayersVisible(layers: array, visible: boolean) source

Set the visibilities of layers

Params:

NameTypeAttributeDescription
layers array

the indices of layers needs to be changed.

visible boolean

public setModelVisiblity(modelId: string, visible: boolean) source

Set the visibilities of all the elements in the model.

Params:

NameTypeAttributeDescription
modelId string

The id of the model you want to hide/show.

visible boolean

True to show the model and false to hide.

public setTerrainVisibility(visible: boolean) source

Set the visibility of the terrain

Params:

NameTypeAttributeDescription
visible boolean

public setUpdateCallback(cbk: function) source

Set the callback function when rendering is about to happen. Application can provide an update callback here to manipulate the scene objects so that rendering can reflect the application behaviour.

Params:

NameTypeAttributeDescription
cbk function

public translateModel(modelId: string, dx: number, dy: number, dz: number) source

Translate the model.

Params:

NameTypeAttributeDescription
modelId string

The id of the model to translate.

dx number

Translation.x

dy number

Translation.y

dz number

Translation.z