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:8091");
// Get the available streams
const streams = await serverSession.getAvailableStreams_async();

// Grab the first stream
if (streams[0]) {
    const streamId = streams[0].streamId;
    const streamModel = serverSession.createStreamModel(streamId);

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

Accessors

cee.vs.StreamModel.currentFrameIndex()
get currentFrameIndex(): number

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

Returns: number

set currentFrameIndex(frameIndex: number): void

Parameters

frameIndex: number

Returns: void

cee.vs.StreamModel.frameCount()
get frameCount(): number

Gets the number of frames in this model.

Returns: number

cee.vs.StreamModel.name()

Name of the model.

Mainly used for debugging.

get name(): string

Name of the model, primarily used for debugging.

Returns: string

set name(name: string): void

Name of the model.

Mainly used for debugging.

Parameters

name: string

Returns: void

cee.vs.StreamModel.publishTag()
get publishTag(): string

The publishTag associated with the current stream config or null if no publishTag was set.

Returns: string

cee.vs.StreamModel.streamId()
get streamId(): string

The stream id of the stream being consumed by this model

Returns: string

cee.vs.StreamModel.streamRevision()
get streamRevision(): number

The current streamRevision of the stream being consumed by this model, or undefined if no stream config has been received yet.

Returns: number

Methods

cee.vs.StreamModel.addConfigReadyCallback()
addConfigReadyCallback(callback: ConfigReadyCallback): void

Parameters

Returns: void

addConfigReadyCallback(options: CallbackOptions, callback: ConfigReadyCallback): void

Parameters

Returns: void

cee.vs.StreamModel.addConfigReadyCallbackForRevision()
addConfigReadyCallbackForRevision(streamRevision: number, callback: RevisionBoundConfigReadyCallback): void

Parameters

streamRevision: number

callback: RevisionBoundConfigReadyCallback

Returns: void

cee.vs.StreamModel.addStreamingCompleteCallback()
addStreamingCompleteCallback(callback: StreamingCompleteCallback): void

Parameters

Returns: void

addStreamingCompleteCallback(options: CallbackOptions, callback: StreamingCompleteCallback): void

Parameters

Returns: void

cee.vs.StreamModel.addStreamingCompleteCallbackForRevision()
addStreamingCompleteCallbackForRevision(streamRevision: number, callback: RevisionBoundStreamingCompleteCallback): void

Parameters

streamRevision: number

callback: RevisionBoundStreamingCompleteCallback

Returns: void

cee.vs.StreamModel.detachFromSession()
detachFromSession(): void

Detaches the model from its owner server session. This will permanently stop streaming of the model.

Returns: void

cee.vs.StreamModel.getBoundingBox()
getBoundingBox(_options: ModelBoundingBoxOptions): BoundingBox

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

Note that this method does not support any ModelBoundingBoxOptions

Parameters

Returns: BoundingBox

cee.vs.StreamModel.getDefaultCameraConfig()
getDefaultCameraConfig(): None

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

Returns: None

cee.vs.StreamModel.isStreamingActive()
isStreamingActive(): boolean

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

Returns: boolean

cee.vs.StreamModel.isStreamingComplete()
isStreamingComplete(): boolean

Returns: boolean

cee.vs.StreamModel.pollForStreamConfig_async()
pollForStreamConfig_async(): Promise

Polls for new data for this model.

Returns: Promise

cee.vs.StreamModel.rayIntersect()
rayIntersect(ray: Ray): HitItem

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

Parameters

ray: Ray

Returns: HitItem

cee.vs.StreamModel.removeAllConfigReadyCallbacks()
removeAllConfigReadyCallbacks(): void

Returns: void

cee.vs.StreamModel.removeAllStreamingCompleteCallbacks()
removeAllStreamingCompleteCallbacks(): void

Returns: void

cee.vs.StreamModel.setGuidingCamera()
setGuidingCamera(camera: Camera): void

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

Parameters

camera: Camera

Returns: void

cee.vs.StreamModel.startStreaming_async()
startStreaming_async(): Promise

Starts the streaming from the VizStreamer Service.

Returns: Promise

cee.vs.StreamModel.stopStreaming()
stopStreaming(): void

Stops the streaming from the VizStreamer Service.

Returns: void