View

class cee.View()

A View represents a viewport where you can show models and overlay items.

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.

A viewer can have one or more views. The views can operate independently or be set up for synchronized viewing. Changes to a model object shared between multiple views will be reflected in all views. The MultipleViews example project shows how you can create, manage, and synchronize multiple views.

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

Accessors

cee.View.ambientOcclusion()
get ambientOcclusion(): AmbientOcclusion

The ambient occlusion configuration object for the view

Returns: AmbientOcclusion

cee.View.background()
get background(): Background

The background config of the view

Returns: Background

cee.View.camera()
get camera(): 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.

Returns: Camera

cee.View.clipping()
get clipping(): Clipping

The clipping controller for the view

Returns: Clipping

cee.View.haloHighlightColor()
get haloHighlightColor(): Color3Like

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

Returns: Color3Like

set haloHighlightColor(highlightColor: Color3Like): void

Parameters

highlightColor: Color3Like

Returns: void

cee.View.modelCount()
get modelCount(): number

The number of models in the view.

Returns: number

cee.View.name()
get name(): string

The name of the view (used for debugging)

Returns: string

set name(name: string): void

Parameters

name: string

Returns: void

cee.View.navigation()
get navigation(): Navigation

Deprecated

Returns: Navigation

cee.View.nonHighlightedDimFactor()
get nonHighlightedDimFactor(): number

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.

Returns: number

set nonHighlightedDimFactor(factor: number): void

Parameters

factor: number

Returns: void

cee.View.operators()
get operators(): OperatorStack

The operator stack for the view.

Returns: OperatorStack

cee.View.overlay()
get overlay(): Overlay

The 2d overlay controller for the view.

Returns: Overlay

cee.View.ownerViewer()
get ownerViewer(): Viewer

The owner Viewer.

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

Returns: Viewer

Methods

cee.View.addModel()
addModel(model: Model): void

Adds a model to the view.

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

Parameters

model: Model

Returns: void

cee.View.getBoundingBox()
getBoundingBox(modelBoundingBoxOptions: ModelBoundingBoxOptions): BoundingBox

Returns the combined bounding box of all models in the view

See Model.getBoundingBox and ModelBoundingBoxOptions for more information on how the bounding box is calculated and what options are available.

Parameters

modelBoundingBoxOptions: ModelBoundingBoxOptions

Returns: BoundingBox

cee.View.getIndexOfModel()
getIndexOfModel(model: Model): number

Returns the zero-based index of the given model

Parameters

model: Model

Returns: number

cee.View.getModelArray()
getModelArray(): readonly  Model[]

Returns a read only array with all models in the view

Returns: readonly  Model[]

cee.View.getModelAt()
getModelAt(index: number): Model

Returns the model at the given zero-based index

Parameters

index: number

Returns: Model

cee.View.getRayThroughPoint()
getRayThroughPoint(point: Vec3): Ray

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

Returns null if no ray can be found.

Parameters

point: Vec3

Returns: Ray

cee.View.rayIntersect()
rayIntersect(ray: Ray, ignoreLabels: boolean?): Vec3

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

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

Parameters

ray: Ray

ignoreLabels: boolean = false

Returns: Vec3

cee.View.removeAllModels()
removeAllModels(): void

Removes all models from the view.

Returns: void

cee.View.removeModel()
removeModel(model: Model): void

Removes the given model from the view.

Parameters

model: Model

Returns: void

cee.View.removeModelAt()
removeModelAt(modelIndex: number): void

Removes the model at the given index from the view.

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

Parameters

modelIndex: number

Returns: void

cee.View.requestRedraw()
requestRedraw(): void

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

Returns: void

cee.View.setViewport()
setViewport(x: number, y: number, width: number, height: number): void

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

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

Parameters

x: number

y: number

width: number

height: number

Returns: void