PipelineState
PipelineState represents a pipeline model which is used inside
Widgets and ImageBuilders to keep track of the configuration that should be
used to render an image for a given pipeline configuration.
The class is imported using the following:
var PipelineState = require('paraviewweb/src/Common/State/PipelineState'), |
constructor(json)
Creates an instance of a pipeline model which keeps track of the
state of the pipeline.
The provided JSON object should have the following type of structure:
{ |
onChange(callback) : subscription
Callback function will be called with the pipeline query as the first argument.
As we rely on Monologue.js, you get a subscription object as a
response which allows for easy unsubscription.
TopicChange() : ‘pipeline.change’
Returns the name of the topic used for the pipeline change notification.
triggerChange()
Triggers a change event. The event triggered is a string
that represents the pipeline encoding.
isLayerActive(layerId) : Boolean
Returns true if the given layer is set to active.
By default, every layer is active.
setLayerActive(layerId, active)
Updates the active state of a layer.
If the internal state has changed, the model will trigger a change event.
toggleLayerActive(layerId)
Toggles the active state of the given layer and trigger a change event.
isLayerVisible(layerId)
Returns true if the given layer is set to visible. By default, every layer is visible.
setLayerVisible(layerId, visible)
Updates the visible state of a layer.
If the internal state has changed, the model will trigger a change event.
toggleLayerVisible(layerId)
Toggles the visible state of the given layer and triggers a change event.
isLayerInEditMode(layerId)
Returns true if the given layer is in edit mode. By default, none of the layers are in edit mode.
toggleEditMode(layerId)
Toggles the edit mode state of the given layer and triggers a change event.
getColor(layerId) : Array
Returns the set of color codes that given layer can have.
getColor('E') => ['B', 'A'] |
getColorToLabel(colorCode) : String
Returns the label associated to a given color code.
getColorToLabel('B') => 'temperature' |
isActiveColor(layerId, colorCode) : Boolean
Returns true if the given layer is colored by the
given color code, returns false otherwise.
setActiveColor(layerId, colorCode)
Updates which ColorBy field should be used for a given layer.
getPipelineQuery() : String
Returns the current pipeline configuration as an encoded string.
getPipelineDescription()
Returns the pipeline tree defined inside the JSON object under the path JSON.CompositePipeline.pipeline.
Source
import Monologue from 'monologue.js'; |