StreamModel

class cee.vs.StreamModel()

A remote Visualization Streamer (VizStreamer) model that can be displayed in the Viewer.

The StreamModel class supports an efficient streaming and rendering of 3D data. The data to this model is sent from the VizStreamer Service, to which data is sent using GRPC or a C++ interface.

To create a new instance of the StreamModel, the ServerSession object needs to be created first. Afterwards, use the ServerSession.createStreamModel method to create a model linked to the stream. By default, the model starts streaming immediately.

The streaming to this model is controlled with the startStreaming and stopStreaming methods. You can also check whether streaming is active with the isStreamingActive method.

The current frame of the StreamModel can be set with the currentFrameIndex property.

Example:

Create a StreamModel and add it to the view.
// create a cloud session first, viewer and a view
const cloudSession = new cee.CloudSession();
const viewer = cloudSession.addViewer(htmlCanvasElement, { useOperators: false });
const view = viewer.addView()

// Connect to the server session at the given url.
const serverSession = await cee.vs.ServerSession.createInstance_async("http://localhost:8080");
// Get the available streams
const streams = await serverSession.getAvailableStreams_async();

// grab the first stream in the server
if (streams[0]) {
    const streamName = streams[0].streamName;
    const streamModel = serverSession.createStreamModel(streamName);

    // Add the model to the cee.View
    view.addModel(streamModel);
    // Start the streaming if not already started.
    if (!streamModel.isStreamingActive()) {
        streamModel.startStreaming();
    }
}

Accessors

StreamModel.currentFrameIndex()

Gets/sets the current frame index displayed in this model.

Return type:number
StreamModel.currentFrameIndex(frameIndex)
Arguments:
  • frameIndex (number) – None
Return type:

void

StreamModel.frameCount()

Gets the number of frames in this model.

Return type:number
StreamModel.name()

Name of the model, primarily used for debugging.

Return type:string
StreamModel.name(name)
Arguments:
  • name (string) – None

Name of the model.

Mainly used for debugging.

Return type:void
StreamModel.streamName()

Name of the stream being consumed by this model

Return type:string

Methods

getBoundingBox

StreamModel.getBoundingBox([_options])
Arguments:
  • _options (ModelBoundingBoxOptions) – optional None

Returns the BoundingBox (in world coordinates) of the current contents of the model

Note that this method does not support any ModelBoundingBoxOptions

Return type:BoundingBox

getDefaultCameraConfig

StreamModel.getDefaultCameraConfig()

Returns default camera configuration, which is always null for this model.

Return type:unknown

isStreamingActive

StreamModel.isStreamingActive()

Checks whether the streaming to the model is enabled or not.

Return type:boolean

pollForStreamConfig_async

StreamModel.pollForStreamConfig_async()

Polls for new data for this model.

Return type:Promise <void>

rayIntersect

StreamModel.rayIntersect(ray)
Arguments:
  • ray (Ray) – None

Performs picking on the model using the current frame. Returns null when nothing is hit.

Return type:HitItem

setGuidingCamera

StreamModel.setGuidingCamera(camera)
Arguments:
  • camera (Camera) – None

Sets the guiding camera by watching its changes and using it to guide the streaming.

Return type:void

startStreaming

StreamModel.startStreaming()

Starts the streaming from the VizStreamer Service.

Return type:void

stopStreaming

StreamModel.stopStreaming()

Stops the streaming from the VizStreamer Service.

Return type:void