View

class cee.View()

A View represents a viewport where you can show models and overlay items. A viewer can have one or more views.

A view has a collection of models that are shown in the view. You add a model to a view with the addModel function and remove it with the removeModel function.

You can access the Camera from the View with the camera property. The camera can be used to manually control the view point, projection and other view related settings.

You can manage overlay items (legends, text boxes, navigation cube, etc) with the overlay object.


Accessors

cee.View.ambientOcclusion

The ambient occlusion configuration object for the view

cee.View.background

The background config of the view

cee.View.backgroundColor

The background color of the view.

Deprecated! Use view.background.setSingleColor()

cee.View.camera

The Camera used in the View.

The camera can be used to specify the View’s viewpoint, orientation, direction, projection, clipping, and other viewport related properties.

Note: This returns a reference to the real object, not a copy, so any changes to the returned object will be applied to the 3D view.

cee.View.clipping

The clipping controller for the view

cee.View.haloHighlightColor

The color used to draw the halo around highlighted parts in the view.

cee.View.modelCount

The number of models in the view.

cee.View.name

The name of the view (used for debugging)

cee.View.navigation

The navigation controller for the view.

cee.View.nonHighlightedDimFactor

The amount to dim the areas of the screen that does not contain highlighted parts. Default value is 0.5. Setting a value of 0 disables dimming.

cee.View.overlay

The 2d overlay controller for the view.

cee.View.ownerViewer

The owner Viewer

A View can only be in one Viewer. The Viewer creates and manages the View.

Methods

addModel

cee.View.addModel(model)

Adds a model to the view.

Arguments
Return type

void

While a model can be shown in any number of views, it can only be added to a particular view once.

getBoundingBox

cee.View.getBoundingBox()

Returns the combined bounding box of all models in the view

Return type

cee.BoundingBox

getBoundingBoxVisibleParts

cee.View.getBoundingBoxVisibleParts()

Returns the combined bounding box of all models in the view

Return type

cee.BoundingBox

getIndexOfModel

cee.View.getIndexOfModel(model)

Returns the zero-based index of the given model

Arguments
Return type

number

getModelArray

cee.View.getModelArray()

Returns a read only array with all models in the view

Return type

ReadonlyArray[cee.Model]

getModelAt

cee.View.getModelAt(index)

Returns the model at the given zero-based index

Arguments
  • index (number) –

Return type

cee.Model

getRayThroughPoint

cee.View.getRayThroughPoint(point)

Returns a ray that intersects the given point (in world coordinates) and starts at the point’s projection onto the screen.

Arguments
Return type

cee.Ray

rayIntersect

cee.View.rayIntersect(ray, ignoreLabels)

Do a ray intersect with all the models in the view.

Arguments
  • ray (cee.Ray) –

  • ignoreLabels (boolean) –

Return type

cee.Vec3

Returns the intersection point if there was a hit, and null if there was not a hit.

Labels have a “special treatment” ray intersect where hitting the label will cause a hit on the label attachment point. This is not always what is intended, e.g. when doing zoom to cursor. Set ignoreLabels to true to skip labels when doing ray intersect. This only applies to PartLabels in the MarkupModel

removeAllModels

cee.View.removeAllModels()

Removes all models from the view.

Return type

void

removeModel

cee.View.removeModel(model)

Removes the given model from the view.

Arguments
Return type

void

removeModelAt

cee.View.removeModelAt(modelIndex)

Removes the model at the given index from the view.

Arguments
  • modelIndex (number) –

Return type

void

The index must be zero-based and between 0 and modelCount - 1

requestRedraw

cee.View.requestRedraw()

Requests a redraw of the viewer. This will force a redraw on the next CloudSession.handleAnimationFrameCallback event.

Return type

void

setViewport

cee.View.setViewport(x, y, width, height)

Sets the viewport to the given position and size in OpenGL window coordinates.

Arguments
  • x (number) –

  • y (number) –

  • width (number) –

  • height (number) –

Return type

void

This method cannot be called when OwnerViewer.viewLayoutMode is set to ViewLayoutMode.Auto