class sap.ui.vk.threejs.Viewport

Visiblity: public
UX Guidelines:
Implements:
Available since: N/A
Module: sap/ui/vk/threejs/Viewport
Application Component: CA-UI5-VTK

Provides a control for three.js canvas.


Constructor

Constructor for a ThreeJs viewport.

Accepts an object literal mSettings that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject#constructor for a general description of the syntax of the settings object.

new sap.ui.vk.threejs.Viewport()

Borrowed Properties

Name Type Default Value Description
backgroundColorBottom sap.ui.core.CSSColor rgba(255, 255, 255, 1)

Viewport background bottom color in the CSS Color format

Visibility: public
backgroundColorTop sap.ui.core.CSSColor rgba(50, 50, 50, 1)

Viewport background top color in the CSS Color format

Visibility: public
disableHotspotHovering boolean false

Disables hotspot hovering

Visibility: public
freezeCamera boolean false

Freeze camera

Visibility: public
height sap.ui.core.CSSSize 100%

Viewport height

Visibility: public
hotspotColor sap.ui.core.CSSColor rgba(89, 0, 0, 0.73)

Color used for highlighting hotspots in the CSS Color format

Visibility: public
hotspotColorABGR int 1493172411

Color used for highlighting hotspots in the ABGR format

Visibility: public
keepOutputSize boolean false Visibility: public
renderMode sap.ui.vk.RenderMode Default

Viewport render mode

Visibility: public
selectionDisplayMode sap.ui.vk.SelectionDisplayMode Highlight

Selection display mode

Visibility: public
selectionMode sap.ui.vk.SelectionMode Sticky

Selection mode

Visibility: public
showAllHotspots boolean false

Enables or disables showing of all hotspots

Visibility: public
showAllHotspotsTintColor sap.ui.core.CSSColor rgba(255, 255, 0, .35)

Color used to highlight all hotspots when the showAllHotspots property has a value of true.

Visibility: public
showDebugInfo boolean false

Shows or hides the debug info.

Visibility: public
showSafeArea boolean false

Shows or hides the Safe Area

Visibility: public
showSelectionBoundingBoxes boolean true

Show selection bounding boxes

Visibility: public
width sap.ui.core.CSSSize 100%

Viewport width

Visibility: public

Borrowed Aggregations

Name Cardinality Type Description
annotations 0..n sap.ui.vk.Annotation

HTML Annotations present in the active view

content 0..n sap.ui.core.Control

The controls inside the viewport.

outputSettings 0..1 sap.ui.vk.OutputSettings

Output size settings of the viewport

safeArea 0..1 sap.ui.vk.SafeArea

SafeArea control for viewport


Events Overview

Event Description
cameraChanged

This event bubbles up the control hierarchy.

frameRenderingFinished

cameraChanged

This event bubbles up the control hierarchy.

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object
position float[]

Returns a new camera position.

quaternion float[]

Returns a new camera rotation quaternion.

zoom float

Returns a new camera orthographic zoom factor.

frameRenderingFinished

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object

Methods Overview

Method Description
activateView

Activates the view based on view object passed

attachCameraChanged

Attaches event handler fnFunction to the cameraChanged event of this sap.ui.vk.threejs.Viewport.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui.vk.threejs.Viewport itself.

attachFrameRenderingFinished

Attaches event handler fnFunction to the frameRenderingFinished event of this sap.ui.vk.threejs.Viewport.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui.vk.threejs.Viewport itself.

detachCameraChanged

Detaches event handler fnFunction from the cameraChanged event of this sap.ui.vk.threejs.Viewport.

The passed function and listener object must match the ones used for event registration.

detachFrameRenderingFinished

Detaches event handler fnFunction from the frameRenderingFinished event of this sap.ui.vk.threejs.Viewport.

The passed function and listener object must match the ones used for event registration.

sap.ui.vk.threejs.Viewport.extend

Creates a new subclass of class sap.ui.vk.threejs.Viewport with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.vk.ViewportBase.extend.

fireCameraChanged

Fires event cameraChanged to attached listeners.

fireFrameRenderingFinished

Fires event frameRenderingFinished to attached listeners.

getCurrentView

Get current view - remembered when activateView function is called

getImage

Returns viewport content as an image of desired size.

sap.ui.vk.threejs.Viewport.getMetadata

Returns a metadata object for class sap.ui.vk.threejs.Viewport.

getObjectImage

Returns object as an image of desired size.

getOutputSize

Gets position and size of the viewport square. The information can be used for making calculations when restoring Redlining elements.

getScene

Gets the Viewport Scene

getViewInfo

Retrieves information about the current camera view in the scene, and saves the information in a JSON-like object. The information can then be used at a later time to restore the scene to the same camera view using the setViewInfo method.

projectToScreen

Project 3D point to screen space

queueCommand

Queues a command for execution during the rendering cycle. All gesture operations should be called using this method.

setCamera

Sets the camera for the Viewport

setScene

Attaches the scene to the Viewport for rendering.

setShouldRenderFrame
setViewInfo

Sets the current scene to use the camera view information acquired from the getViewInfo method.
Internally, the setViewInfo method activates certain steps at certain animation times, and then changes the camera position, rotation and field of view (FOV) / zoom factor.

zoomTo

Zooms the scene to a bounding box created from a particular set of nodes.

activateView

Activates the view based on view object passed

Param Type DefaultValue Description
view sap.ui.vk.View

View object definition

playViewGroup boolean

true if view activation is part of playing view group

notAnimateCameraChange boolean

true if not animating the change of camera

attachCameraChanged

Attaches event handler fnFunction to the cameraChanged event of this sap.ui.vk.threejs.Viewport.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui.vk.threejs.Viewport itself.

Param Type DefaultValue Description
oData object

An application-specific payload object that will be passed to the event handler along with the event object when firing the event

fnFunction function(sap.ui.base.Event) : void

The function to be called when the event occurs

oListener object

Context object to call the event handler with. Defaults to this sap.ui.vk.threejs.Viewport itself

attachFrameRenderingFinished

Attaches event handler fnFunction to the frameRenderingFinished event of this sap.ui.vk.threejs.Viewport.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui.vk.threejs.Viewport itself.

Param Type DefaultValue Description
oData object

An application-specific payload object that will be passed to the event handler along with the event object when firing the event

fnFunction function(sap.ui.base.Event) : void

The function to be called when the event occurs

oListener object

Context object to call the event handler with. Defaults to this sap.ui.vk.threejs.Viewport itself

detachCameraChanged

Detaches event handler fnFunction from the cameraChanged event of this sap.ui.vk.threejs.Viewport.

The passed function and listener object must match the ones used for event registration.

Param Type DefaultValue Description
fnFunction function(sap.ui.base.Event) : void

The function to be called, when the event occurs

oListener object

Context object on which the given function had to be called

detachFrameRenderingFinished

Detaches event handler fnFunction from the frameRenderingFinished event of this sap.ui.vk.threejs.Viewport.

The passed function and listener object must match the ones used for event registration.

Param Type DefaultValue Description
fnFunction function(sap.ui.base.Event) : void

The function to be called, when the event occurs

oListener object

Context object on which the given function had to be called

sap.ui.vk.threejs.Viewport.extend

Creates a new subclass of class sap.ui.vk.threejs.Viewport with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.vk.ViewportBase.extend.

Param Type DefaultValue Description
sClassName string

Name of the class being created

oClassInfo object

Object literal with information about the class

FNMetaImpl function

Constructor function for the metadata object; if not given, it defaults to the metadata implementation used by this class

fireCameraChanged

Fires event cameraChanged to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

position float[]

Returns a new camera position.

quaternion float[]

Returns a new camera rotation quaternion.

zoom float

Returns a new camera orthographic zoom factor.

fireFrameRenderingFinished

Fires event frameRenderingFinished to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

getCurrentView

Get current view - remembered when activateView function is called

getImage

Returns viewport content as an image of desired size.

Param Type DefaultValue Description
width int

Requested image width in pixels. Allowed values are 8 to 2048, default is 16

height int

Requested image height in pixels. Allowed values are 8 to 2048, default is 16

topColor string

The sap.ui.core.CSSColor to be used for top background color

bottomColor string

The sap.ui.core.CSSColor to be used for bottom background color

includeSelection boolean

Include selected nodes

sap.ui.vk.threejs.Viewport.getMetadata

Returns a metadata object for class sap.ui.vk.threejs.Viewport.

getObjectImage

Returns object as an image of desired size.

Param Type DefaultValue Description
nodeRef any

The node reference.

width int

Requested image width in pixels. Allowed values are 8 to 2048, default is 256

height int

Requested image height in pixels. Allowed values are 8 to 2048, default is 256

topColor string

The sap.ui.core.CSSColor to be used for top background color

bottomColor string

The sap.ui.core.CSSColor to be used for bottom background color

quaternion THREE.Quaternion

Optional camera rotation quaternion

margin float

The object margin

getOutputSize

Gets position and size of the viewport square. The information can be used for making calculations when restoring Redlining elements.

getScene

Gets the Viewport Scene

getViewInfo

Retrieves information about the current camera view in the scene, and saves the information in a JSON-like object. The information can then be used at a later time to restore the scene to the same camera view using the setViewInfo method.

Param Type DefaultValue Description
query object

Query object which indicates what information to be retrieved.

camera boolean object true

Indicator to retrieve camera information.

matrices boolean false

Indicator to retrieve camera view and projection matrices.

useTransitionCamera boolean false

Indicator to retrieve the transition camera properties instead of regular one's.

visibility boolean object false

Indicator to retrieve visibility information.

mode sap.ui.vk.VisibilityMode sap.ui.vk.VisibilityMode.Complete

Indicator to retrieve the complete visibility definition or just the difference.

selection boolean object false

Indicator to retrieve selection information.

projectToScreen

Project 3D point to screen space

Param Type DefaultValue Description
x float

X coordinate in world space

y float

Y coordinate in world space

z float

Z coordinate in world space

camera sap.ui.vk.Camera

Camera to be used with calculation of projection

queueCommand

Queues a command for execution during the rendering cycle. All gesture operations should be called using this method.

Param Type DefaultValue Description
command function

The command to be executed.

setCamera

Sets the camera for the Viewport

Param Type DefaultValue Description
camera sap.ui.vk.Camera

parameter

setScene

Attaches the scene to the Viewport for rendering.

Param Type DefaultValue Description
scene sap.ui.vk.threejs.Scene

The scene to attach to the Viewport.

setShouldRenderFrame

setViewInfo

Sets the current scene to use the camera view information acquired from the getViewInfo method.
Internally, the setViewInfo method activates certain steps at certain animation times, and then changes the camera position, rotation and field of view (FOV) / zoom factor.

Param Type DefaultValue Description
viewInfo object

A JSON-like object containing view information acquired using the getViewInfo method.

camera object

A JSON-like object containing the camera information.

rotation object

Rotation defined in Aircraft principal axes .

yaw float

Angle around the vertical axis in degrees.

pitch float

Angle around the lateral axis in degrees.

roll float

Angle around the longitudinal axis in degrees.

position object

Position defined in 3-dimensional space.

x float

X coordinate.

y float

Y coordinate.

z float

Z coordinate.

bindingType sap.ui.vk.CameraFOVBindingType

Camera field of view binding type.

projectionType sap.ui.vk.CameraProjectionType

Camera projection type.

fieldOfView float

Camera field of view in degrees. Applicable only to perspective cameras.

zoomFactor float

Camera zoom factor. Applicable only to orthographic cameras.

animation object

A JSON-like object containing the animation information.

stepVeId string

Step VE ID. If it is omitted then procedure and step indices are used.

procedureIndex int

Procedure index in the list of procedures.

stepIndex int

Step index in the list of steps in the procedure.

animationTime float 0

Time at which to activate the step.

visibility object

A JSON-like object containing the visibility information.

mode sap.ui.vk.VisibilityMode

If the mode equals to complete then the visible and hidden fields are defined. If the mode equals differences then the changes field is defined.

visible string[]

List of Ids of visible nodes.

hidden string[]

List of Ids of hidden nodes.

changes string[]

List of Ids of nodes with inverted visibility.

selection object

A JSON-like object containing the selection information.

selected string[]

List of Ids of selected nodes.

outlined string[]

List of Ids of outlined nodes.

flyToDuration float 0

Fly-to animation duration in seconds.

zoomTo

Zooms the scene to a bounding box created from a particular set of nodes.

Param Type DefaultValue Description
what sap.ui.vk.ZoomTo sap.ui.vk.ZoomTo[]

What set of nodes to zoom to.

nodeRef any

Is used if what == (sap.ui.vk.ZoomTo.Node || ZoomTo.NodeSetIsolation)

crossFadeSeconds float

Time to perform the "fly to" animation. Set to 0 to do this immediately.

margin float

Margin. Set to 0 to zoom to the entire screen.