DWVv0.37.0

Stage

Source: stage.js:14

Stage: controls a list of layer groups and their synchronisation.


Constructor

new Stage(): Stage

Instance Methods

getLayerGroup(index: number): LayerGroup | undefined

Get the layer group at the given index.

Parameters

  • index (number) — The index.

Returns

getNumberOfLayerGroups(): number

Get the number of layer groups that form the stage.

Returns

  • number — The number of layer groups.

getActiveLayerGroup(): LayerGroup | undefined

Get the active layer group.

Returns

setActiveLayerGroup(index: number)

Set the active layer group.

Parameters

  • index (number) — The layer group index.

getViewLayersByDataId(dataId: string): Array.<ViewLayer>

Get the view layers associated to a data id.

Parameters

  • dataId (string) — The data id.

Returns

getViewLayers(callbackFn?: function): Array.<ViewLayer>

Get a list of view layers according to an input callback function.

Parameters

  • callbackFn (function, optional) — A function that takes a ViewLayer as input and returns a boolean. If undefined, returns all view layers.

Returns

  • Array.<ViewLayer> — The layers that satisfy the callbackFn.

getDrawLayersByDataId(dataId: string): Array.<DrawLayer>

Get the draw layers associated to a data id.

Parameters

  • dataId (string) — The data id.

Returns

getDrawLayers(callbackFn?: function): Array.<DrawLayer>

Get a list of draw layers according to an input callback function.

Parameters

  • callbackFn (function, optional) — A function that takes a DrawLayer as input and returns a boolean. If undefined, returns all draw layers.

Returns

  • Array.<DrawLayer> — The layers that satisfy the callbackFn.

addLayerGroup( htmlElement: object, withInfoOverlay?: boolean, ): LayerGroup

Add a layer group to the list.

The new layer group will be marked as the active layer group.

Parameters

  • htmlElement (object) — The HTML element of the layer group.
  • withInfoOverlay (boolean, optional) — Optional with info overlay flag, default to false.

Returns

getLayerGroupByDivId(id: string): LayerGroup | undefined

Get a layer group from an HTML element id.

Parameters

  • id (string) — The element id to find.

Returns

setBinders(list: Array)

Set the layer groups binders.

Parameters

  • list (Array) — The list of binder objects.

empty()

Empty the layer group list.

removeLayersByDataId(dataId: string)

Remove all layers for a specific data.

Parameters

  • dataId (string) — The data to remove its layers.

removeLayerGroup(layerGroup: LayerGroup)

Remove a layer group from this stage.

Parameters

  • layerGroup (LayerGroup) — The layer group to remove.

reset()

deprecated
stage.js:262

Reset the stage: calls reset on all layer groups.

Since v0.35, prefer resetZoomPan.

resetZoomPan()

Reset the zoom and pan of all layer groups.

resetViews()

Reset the position and window level of all layer groups.

draw()

Draw the stage: calls draw on all layer groups.

fitToContainer()

Fit to container: synchronise the div to world size ratio of the group layers.

bindLayerGroups()

Bind the layer groups of the stage.

unbindLayerGroups()

Unbind the layer groups of the stage.

setImageSmoothing(flag: boolean)

Set the imageSmoothing flag value.

Parameters

  • flag (boolean) — True to enable smoothing.