Class: ViewportApi

viewportApi

Add a callback to be invoked when a certain event occurs

Parameters:
Name Type Description
type ApiEventType

Type of event to subscribe to

callback EventListenerCallback

Function to be called when the event fires

Inherited From:
Overrides:
Returns:
Type Description
APIResponse

APIResponse with an EventListenerToken object. The event listener token can be used to remove the event listener by calling removeEventListener.

applyTransformation(matrix)

Applies a 4x4 transformation matrix or an array of transformation matrices to this viewport.

Parameters:
Name Type Description
matrix ApiSceneInterface#Transformation | Array.<ApiSceneInterface#Transformation>

The transformation matrix or an array of matrices

Inherited From:
Overrides:
Returns:
Type Description
Promise.<APIResponse>

API response with a data array of type boolean.

convertTo2D(position)

Converts the given 3D coordinates into various 2D coordinates

See:
  • ApiSceneInterface#2DCoordinateSummary
Parameters:
Name Type Description
position Point3d

The 3D point to convert

Inherited From:
Overrides:
Returns:
Type Description
ApiSceneInterface#2DCoordinateSummary

A summary of the different 2D coordinates

getContainer()

Returns the container in which the viewer is.

Inherited From:
Overrides:
Returns:
Type Description
HTMLElement

the container of the viewer

| Object

getScreenshot()

Inherited From:
Overrides:
Deprecated:
  • This method is deprecated, please use getScreenshotAsync instead. Get screenshot as a png data URI. Returns a screenshot of the viewer canvas without any control elements as a data URI using the png image format.
Returns:
Type Description
String

Data URI representing the png screeshot image (data:image/png;base64,...).

getScreenshotAsync()

Get screenshot as a png data URI. Returns a screenshot of the viewer canvas without any control elements as a data URI using the png image format.

Inherited From:
Overrides:
Returns:
Type Description
Promise.<APIResponse>

APIResponse whose data property will be a Data URI representing the png screeshot image (data:image/png;base64,...).

getSelected()

Get scene paths of selected objects.

See:
  • ApiSceneInterface#getSelected
Inherited From:
Overrides:

getSetting(key)

Provides a copy of an individual setting

Parameters:
Name Type Description
key String

name of setting (e.g. 'scene.render.shadows')

Inherited From:
Overrides:
Returns:
Type Description
*

a copy of the setting, undefined if not found

getSettingDefinitions()

Provides an object describing all available settings

Inherited From:
Overrides:
Returns:
Type Description
Object

object describing all available settings, their type, and constraints

getSettings( [keys])

Provides a copy of all or multiple settings

See:
Parameters:
Name Type Argument Description
keys Array.<String> <optional>

optional array of keys, keys which don't exist are ignored, if omitted all settings will be returned

Inherited From:
Overrides:
Returns:
Type Description
Object

object containing a copy of the settings

getTransformation()

Returns the 4x4 transformation matrix or an array of them for this viewport.

Inherited From:
Overrides:
Returns:
Type Description
Promise.<APIResponse>

API response with a data array of type matrix or an array of matrices.

getViewportRuntimeId()

Get the runtime id used for this API object. The runtime id can optionally be specified as a setting when creating the API object, otherwise a random one will be created.

Inherited From:
Overrides:
Returns:
Type Description
String

runtime id used for API instance, should be unique

pause()

Pause the rendering.

Inherited From:
Overrides:

removeEventListener(token)

Remove an event listener

Parameters:
Name Type Description
token EventListenerToken

event listener token for event listener to be removed

Inherited From:
Overrides:
Returns:
Type Description
APIResponse

APIResponse with a Boolean data, indicating whether the event listener could be removed.

render()

Render the scene.

Inherited From:
Overrides:

resetTransformation()

Resets the 4x4 transformation matrix or the array of transformation matrices for this viewport.

Inherited From:
Overrides:
Returns:
Type Description
Promise.<APIResponse>

API response with a data array of type boolean.

resume()

Resume the rendering.

Inherited From:
Overrides:

<abstract> setLiveTransformation()

Set a live transformation for this viewport.

See:
  • ApiSceneInterface#setLiveTransformation
Inherited From:
Overrides:

setTransformation(matrix)

Sets a 4x4 transformation matrix for this viewport.

Parameters:
Name Type Description
matrix ApiSceneInterface#Transformation | Array.<ApiSceneInterface#Transformation>

The transformation matrix or an array of transformation matrices

Inherited From:
Overrides:
Returns:
Type Description
Promise.<APIResponse>

API response with a data array of type boolean.

startContinuousRendering()

Starts continously rendering the scene until stopContinuousRendering is called.

Inherited From:
Overrides:

startExternalDragEvent()

Start an external drag event for an object with a certain path.

See:
  • ApiSceneInterface#startExternalDragEvent
Inherited From:
Overrides:

stopContinuousRendering()

Stops continously rendering the scene if startContinuousRendering was called.

Inherited From:
Overrides:

toggleGeometry()

Show or hide geometry based on its scene path.

See:
  • ApiSceneInterface#toggleGeometry
Inherited From:
Overrides:

updateSelected()

Update selection status of objects.

See:
  • ApiSceneInterface#updateSelected
Inherited From:
Overrides:

updateSettingAsync(key, val)

Update an individual setting, if allowed.

See:
Parameters:
Name Type Description
key String

name of setting

val Object

new value of setting

Inherited From:
Overrides:
Returns:
Type Description
Promise.<APIResponse>

APIResponse whose data property will be true if setting could be changed, false if not.

updateSettingsAsync(settings)

Update a bunch of settings according to the enumerable properties of an object, if allowed.

Parameters:
Name Type Description
settings Object

object whose own properties should be used as settings

Inherited From:
Overrides:
Returns:
Type Description
Promise.<APIResponse>

APIResponse whose data property will be set to a copy of the input object, whose property values are replaced by true or false depending on whether the corresponding setting could be updated.

updateShadowMap()

Updates the shadow map if needed. Normally, all updates should be covered.

Inherited From:
Overrides:

Members

camera :module:CameraApiInterface~CameraApiInterface

The camera api for the corresponding viewport api.

Type:
Inherited From:

lights :module:LightApiInterface~LightApiInterface

The light api for the corresponding viewport api.

Type:
Inherited From:

<inner> _api :ApiInterfaceV2

Type:

<inner> _threeDManager :module:ThreeDManagerDefault~ThreeDManager

Type:
  • module:ThreeDManagerDefault~ThreeDManager

<inner> _viewportManager :module:ViewportManager~ViewportManager

Type:
  • module:ViewportManager~ViewportManager

<inner, constant> CameraApi :module:CameraApiDefault~CameraApi

Type:
  • module:CameraApiDefault~CameraApi

<inner, constant> LightApi :module:LightApiDefault~LightApi

Type:
  • module:LightApiDefault~LightApi

<inner, constant> THREE_D_MANAGER_CONSTANTS :module:ThreeDManagerConstantsDefault~ThreeDManagerConstants

Type:
  • module:ThreeDManagerConstantsDefault~ThreeDManagerConstants

<inner, constant> ViewportApiInterface :module:ViewportApiInterface~ViewportApiInterface

Type:
ShapeDiver 3D Viewer, Copyright © 2015-2019 ShapeDiver GmbH. Documentation generated by JSDoc 3.6.5 on Tue Sep 8th 2020 using the DocStrap template.