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 to this viewport.

Parameters:
Name Type Description
matrix ApiSceneInterface#Transformation

The transformation matrix

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

destroy()

Destroys the current viewport. This api will be invalid after this operation.

Inherited From:
Overrides:

getContainer()

Returns the container in which the viewer is.

Inherited From:
Overrides:
Returns:
Type Description
HTMLElement

the container of the viewer

| Object

getRuntimeId()

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

getScreenshot()

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
String

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

getSelected()

Get scene paths of selected objects.

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

getSize()

Return the current size of the viewport.

Inherited From:
Overrides:
Returns:
Type Description
Object

API response with a data array of type matrix.

getTransformation()

Returns the 4x4 transformation matrix for this viewport.

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

API response with a data array of type matrix.

onResize(width, height)

The viewer was resized, resize the viewport.

Parameters:
Name Type Description
width Number
height Number
Inherited From:
Overrides:

pause()

Pause the rendering.

Inherited From:
Overrides:

reload()

Destroys the current viewport and reloads it directly afterwars.

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 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:
Inherited From:
Overrides:

setTransformation(matrix)

Sets a 4x4 transformation matrix for this viewport.

Parameters:
Name Type Description
matrix ApiSceneInterface#Transformation

The transformation matrix

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

API response with a data array of type boolean.

updateSelected()

Update selection status of objects.

See:
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.

Members

camera :CameraApi

The camera api.

Type:
Overrides:

lights :LightApi

The light api.

Type:
Overrides:

<inner> _api :ApiInterfaceV2

Type:

<inner> _listeners

To Do:
  • restructure this like original api

<inner> _references :Object

Type:
  • Object

<inner> _threeDManager :module:ThreeDManagerDefault~ThreeDManager

Type:
  • module:ThreeDManagerDefault~ThreeDManager

<inner> _viewportApiHelpers :module:ViewportApiHelpers~ViewportApiHelpers

Type:
  • module:ViewportApiHelpers~ViewportApiHelpers

<inner> _viewportManager :module:ViewportManager~ViewportManager

Type:
  • module:ViewportManager~ViewportManager

<inner, constant> CameraApi :CameraApi

Type:

<inner, constant> LightApi :LightApi

Type:

<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.5.5 on Wed May 22nd 2019 using the DocStrap template.