ViewerAPI¶
Description¶
With webVis, you can have multiple webvis-viewer elements. Therefore, functions to control the view and navigation behavior are available on the respective webvis-viewer object, and not as part of the global webVis API. If you have defined one or multiple webvis-viewer elements, you can access a particular viewer, using its ID attribute://fits view on my-viewer-23
webvisViewer("my-viewer-23").fitView();
If you are using the webvis-full convenience element, you can also specify its ID as a parameter, instead of providing the ID of a viewer://fits view on the viewer of my-webvis-full-42
webvisViewer("my-webvis-full-42").fitView();
- animateViewToViewmatrix(matrix, transitionTime)¶
Animates to the given viewmatrix
- Arguments
matrix (
Float32Array()
) – The new view matrix for the cameratransitionTime (
number()
) – Optional- Returns
Promise<void>
- animateViewToVolume(volume, view, up, transitionTime)¶
- Arguments
volume – (BoxVolume ) Optional
view (
Float32Array()
) – Optionalup (
Float32Array()
) – OptionaltransitionTime (
number()
) – Optional- Returns
Promise<void>
- applyMemorySettings()¶
- Returns
void
- changeSetting(viewerSetting, value)¶
Changes the viewer setting with the given name to the given value.
- Arguments
viewerSetting (
string()
) – Specifies a particular viewer setting which one would like to changevalue (
any()
) – A new value for the specified setting- Returns
void
- createCollectionFromGizmo(includeOverlappingNodes)¶
- Arguments
includeOverlappingNodes (
boolean()
) –- Returns
Promise<number>
- createGeometry(userGeoData)¶
- Arguments
userGeoData (
IUserGeometryData()
) –- Returns
number
- dehighlightEntity(highlightHandle)¶
Disable highlighting for the handle
- Arguments
highlightHandle (
number()
) – : number Optional- Returns
void
- destroy()¶
- Returns
void
- enableDynamicClippingPlane(flag)¶
- Arguments
flag (
boolean()
) –- Returns
void
Toggles the state of the 3D navigation (on or off).
- Arguments
flag (
boolean()
) – Optional- Returns
void
- enableSnapping(useSnapping)¶
- Arguments
useSnapping (
boolean()
) –- Returns
void
- fitToClipPlane(clipPlaneID)¶
- Arguments
clipPlaneID (
number()
) –- Returns
void
- fitView(view, up, transitionTime)¶
Positions the camera such that the whole geometry is fitting into the view. The view and up parameter allow to define a viewing direction and roll for the resulting camera pose.
- Arguments
view (
Float32Array()
) – Defines the desired viewing direction Optionalup (
Float32Array()
) – Defines the desired camera orientation in conjunction with the viewing direction OptionaltransitionTime (
number()
) – Optional- Returns
Promise<void>
- fitViewToAuxNode(nodeID, transitionTime)¶
Positions the camera such that the aux node is fitting into the view.
- Arguments
nodeID (
number()
) – The ID of the node on which one wants to fit the viewtransitionTime (
number()
) – Optional- Returns
Promise<void>
- fitViewToDirection(direction, transitionTime)¶
Positions the camera such that it looks from a specific direction.
- Arguments
direction (
ViewDirection()
) –transitionTime (
number()
) – Optional- Returns
Promise<void>
- fitViewToNode(nodeID, view, up, transitionTime)¶
Positions the camera such that the node’s bounding box is fitting into the view. The view and up parameter allow to define a viewing direction and roll for the resulting camera pose.
- Arguments
nodeID (
number()
) – The ID of the node on which one wants to fit the viewview (
Float32Array()
) – The direction in which the camera will look on the node Optionalup (
Float32Array()
) – The orientation in which the camera will look on the node OptionaltransitionTime (
number()
) – Optional- Returns
Promise<void>
- fitViewToRectangle(rectangle, transitionTime)¶
- Arguments
rectangle (
ClientRect()
) –transitionTime (
number()
) – Optional- Returns
Promise<void>
- fitViewToVolume(volume, view, up, transitionTime)¶
Positions the camera such that the view is focused onto the given volume. The view and up parameter allow to define a viewing direction and roll for the resulting camera pose.
- Arguments
volume –
(BoxVolume ) A particular volume on which the view will be fitted
view (
Float32Array()
) – Specifies the direction in which the camera will look on the volume Optionalup (
Float32Array()
) – Specifies the orientation in which the camera will look on the volume OptionaltransitionTime (
number()
) – Optional- Returns
Promise<void>
- flipAuxToView()¶
Flips the auxiliaries with respect to the current view
- Returns
void
- focusOnDoubleClick()¶
- Returns
boolean
- getActiveItem()¶
- Returns
ActiveItemInfo
- getAvailableRenderingEffects()¶
- Returns
Array<string>
- getAvailableRenderingSettings()¶
- Returns
Array<string>
- getBoundingClientRect()¶
- Returns
ClientRect
- getCameraPosition()¶
Return the current Camera position
- Returns
Float32Array – The current Camera position
- getCameraProjectionType()¶
Return the current Camera projection tyxpe
- Returns
CameraProjectionType – The current Camera projection tyxpe
- getCanvasElement()¶
- Returns
HTMLCanvasElement
- getCanvasHeight()¶
- Returns
number
- getCanvasWidth()¶
- Returns
number
- getCenterOfRotation()¶
Returns the center of rotation being the point around which the camera rotates around.
- Returns
Float32Array
- getContext()¶
- Returns
ContextAPI
- getCoordSys()¶
- Returns
string
- getCoordSysRightVector()¶
- Returns
Float32Array
- getCoordSysUpVector()¶
- Returns
Float32Array
- getCurrentGizmoType()¶
- Returns
GizmoType
- getGizmoSize()¶
- Returns
Float32Array
- getGizmoTransform()¶
- Returns
Float32Array
- getID()¶
- Returns
string
- getProjectionMatrix()¶
Returns the current projection matrix.
- Returns
Float32Array – The current projection matrix
- getValidTransformationGizmoModes()¶
- Returns
number
- getVectoresForDirection(direction, view, up)¶
- Arguments
direction (
number()
) –view (
Float32Array()
) –up (
Float32Array()
) –- Returns
void
- getViewMatrix()¶
Returns the current view matrix.
- Returns
Float32Array – The current view matrix of the camera
- hideAllLineMarkers()¶
- Returns
void
- hideAllMarkers()¶
- Returns
void
- hideAllPointMarkers()¶
- Returns
void
- hideGizmo()¶
- Returns
void
- hidePointMarker(index)¶
- Arguments
index (
number()
) – Optional- Returns
void
- highlightArc(pickedPt1, pickedPt3, center, axis, angle, measurementID)¶
- Arguments
pickedPt1 (
Float32Array()
) –pickedPt3 (
Float32Array()
) –center (
Float32Array()
) –axis (
Float32Array()
) –angle (
number()
) –measurementID (
number()
) –- Returns
number
- highlightBBox(center, size)¶
- Arguments
center (
Float32Array()
) –size (
Float32Array()
) –- Returns
number
- highlightEntity(selector, highlightParameters)¶
Enable highlighting of the entity , which matches the attributes informed in the viewerDataSelector
- Arguments
selector (
ITopologyDataSelector|PointerInfoCallback()
) – : IViewerHighlightSelectorhighlightParameters – (HighlightParameters ) Optional
- Returns
Promise<number> – the highlightHandle, which it reqed to remove the highlighting
- highlightLine(values, scale, markerIndex)¶
- Arguments
values (
Array
) –scale (
number()
) –markerIndex (
number()
) –- Returns
void
- highlightPoint(position, markerIndex)¶
- Arguments
position (
Float32Array()
) –markerIndex (
number()
) –- Returns
void
- highlightScope(nodeID)¶
- Arguments
nodeID (
number()
) –- Returns
void
- Returns
boolean
- isSnappingEnabled()¶
- Returns
boolean
- openRenderServiceDebugPage()¶
- Returns
void
- projectPoint(inVector, outVector)¶
- Arguments
inVector (
Float32Array()
) –outVector (
Float32Array()
) –- Returns
void
- projectPointToCanvas(inVector, outVector)¶
- Arguments
inVector (
Float32Array()
) –outVector (
Float32Array()
) –- Returns
void
- readSetting(viewerSetting)¶
Returns the value of a viewer setting.
- Arguments
viewerSetting (
string()
) – The name of a particular setting whose value one wants to read- Returns
any – The value of the specified setting
- registerViewerInteractionListener(listener)¶
- Arguments
listener – (IViewerInteractionListener )
- Returns
void
- removeGeometry(id)¶
- Arguments
id (
number()
) –- Returns
void
- requestScreenshot(width, height, mimeType, resetCanvasSize)¶
- Arguments
width (
number()
) – Optionalheight (
number()
) – OptionalmimeType (
string()
) – OptionalresetCanvasSize (
boolean()
) – Optional- Returns
Promise<string>
- requestTopologyDataEntry(selector)¶
- Arguments
selector (
ITopologyDataSelector()
) –- Returns
Promise<ITopologyDataEntry>
- requestTopologyDataSelector(data)¶
- Arguments
data (
IClickResult|IPointerInfo()
) –- Returns
Promise<ITopologyDataSelector>
- reset()¶
The viewer is destroyed and reinitialized with renderSetup selection
- Returns
void
- resetPerspectiveFOV()¶
- Returns
void
- restoreInitView()¶
Sets the camera to the initial position
- Returns
void
- rotateCoordSystem(frontPlaneStr, outMatrix)¶
- Arguments
frontPlaneStr (
string()
) –outMatrix (
Float32Array()
) –- Returns
Float32Array
- setCORGizmoVisible(flag)¶
- Arguments
flag (
boolean()
) –- Returns
void
- setCenterOfRotation(center)¶
Sets the center of rotation being the point around which the inspection camera rotates. If no center parameter is supplied the center of rotation is set to the center of all currently loaded models.
- Arguments
center (
Float32Array()
) – The center of rotation Optional- Returns
void
- setCursorMode(cursorMode)¶
- Arguments
cursorMode – (CursorMode )
- Returns
void
- setDynamicClippingPlaneDistance(value)¶
- Arguments
value (
number()
) –- Returns
void
- setProjectionMatrix(matrix)¶
Sets the current projection matrix.
- Arguments
matrix (
Float32Array()
) – The new projection matrix- Returns
void
- setTransformationGizmoMode(mode)¶
- Arguments
mode – (TransformationGizmoMode )
- Returns
void
- setUserInputActive(flag)¶
- Arguments
flag (
boolean()
) –- Returns
void
- setView(position, target, upVector, transitionTime)¶
Sets the camera position, its target and the up-vector. If the up-vector is not defined, the previous up-vector is kept.
- Arguments
position (
Float32Array()
) – Specifies the new position or center of the cameratarget (
Float32Array()
) – Specifies the point on which the camera will lookupVector (
Float32Array()
) – Specifies the new orientation of the camera OptionaltransitionTime (
number()
) – Optional- Returns
Promise<void>
- setViewMatrix(matrix, transitionTime)¶
Sets the camera view matrix.
- Arguments
matrix (
Float32Array()
) – The new view matrix for the cameratransitionTime (
number()
) – Optional- Returns
Promise<void>
- setVolatileHighlightEnabled(flag)¶
- Arguments
flag (
boolean()
) –- Returns
void
- showAxisMarker(values, scale, index)¶
- Arguments
values (
Float32Array|Array
) –scale (
number()
) – Optionalindex (
number()
) – Optional- Returns
void
- showClippingBoxGizmo(clipRoomID)¶
- Arguments
clipRoomID (
number()
) –- Returns
void
- showPointMarker(position, index)¶
- Arguments
position (
Float32Array|Array
) –index (
number()
) – Optional- Returns
void
- showSelectionBoxGizmo(size, transform)¶
- Arguments
size (
number|Float32Array()
) – Optionaltransform (
number|Float32Array()
) – Optional- Returns
void
- showSelectionTransformationGizmo()¶
- Returns
void
- startAreaSelection(startX, startY)¶
- Arguments
startX (
number()
) –startY (
number()
) –- Returns
Promise<ClientRect>
- takeScreenshot(callback, mimeType, width, height)¶
- Arguments
callback (
any()
) –mimeType (
string()
) – Optionalwidth (
number()
) – Optionalheight (
number()
) – Optional- Returns
void
- trimSegmentToFrustum(pt0, pt1, ignoreNear)¶
- Arguments
pt0 (
Float32Array()
) –pt1 (
Float32Array()
) –ignoreNear (
boolean()
) – Optional- Returns
boolean
- unhighlightScope(nodeID)¶
- Arguments
nodeID (
number()
) –- Returns
void
- unprojectPoint(inVector, outVector)¶
- Arguments
inVector (
Float32Array()
) –outVector (
Float32Array()
) –- Returns
void
- unprojectPointFromCanvas(inVector, outVector)¶
- Arguments
inVector (
Float32Array()
) –outVector (
Float32Array()
) –- Returns
void
- unregisterViewerInteractionListener(listener)¶
- Arguments
listener –
- Returns
void
- updateGeometry(id, data)¶
- Arguments
id (
number()
) –data (
IUserGeometryData()
) –- Returns
void