LayerGroup

dwv.gui. LayerGroup

new LayerGroup(containerDiv, groupId)

Source:

Layer group.

Display position: {x,y} Plane position: Index (access: get(i)) (world) Position: Point3D (access: getX, getY, getZ)

Display -> World: planePos = viewLayer.displayToPlanePos(displayPos) -> compensate for layer scale and offset pos = viewController.getPositionFromPlanePoint(planePos)

World -> display planePos = viewController.getOffset3DFromPlaneOffset(pos) no need yet for a planePos to displayPos...

Parameters:
Name Type Description
containerDiv object

The associated HTML div.

groupId number

The group id.

Methods

addDrawLayer() → {object}

Source:

Add a draw layer.

Returns:

The created layer.

Type
object

addEventListener(type, callback)

Source:

Add an event listener to this class.

Parameters:
Name Type Description
type string

The event type.

callback object

The method associated with the provided event type, will be called with the fired event.

addScale(scaleStep, center)

Source:

Add scale to the layers. Scale cannot go lower than 0.1.

Parameters:
Name Type Description
scaleStep number

The scale to add.

center dwv.math.Point3D

The scale center Point3D.

addTranslation(translation)

Source:

Add translation to the layers.

Parameters:
Name Type Description
translation object

The translation as {x,y,z}.

addViewLayer() → {object}

Source:

Add a view layer.

Returns:

The created layer.

Type
object

display(flag)

Source:

Display the layer.

Parameters:
Name Type Description
flag boolean

Whether to display the layer or not.

draw()

Source:

Draw the layer.

empty()

Source:

Empty the layer list.

fitToContainer()

Source:

Fit the display to the size of the container. To be called once the image is loaded.

getActiveDrawLayer() → {object}

Source:

Get the active draw layer.

Returns:

The layer.

Type
object

getActiveViewLayer() → {object}

Source:

Get the active image layer.

Returns:

The layer.

Type
object

getAddedScale() → {object}

Source:

Get the added scale: the scale added to the base scale

Returns:

The scale as {x,y,z}.

Type
object

getBaseScale() → {object}

Source:

Get the base scale.

Returns:

The scale as {x,y,z}.

Type
object

getDrawLayersByDataIndex(index) → {Array}

Source:

Get the draw layers associated to a data index.

Parameters:
Name Type Description
index number

The data index.

Returns:

The layers.

Type
Array

getElementId() → {string}

Source:

Get the Id of the container div.

Returns:

The id of the div.

Type
string

getGroupId() → {number}

Source:

Get the layer group id.

Returns:

The id.

Type
number

getNumberOfLayers() → {number}

Source:

Get the number of layers handled by this class.

Returns:

The number of layers.

Type
number

getOffset() → {object}

Source:

Get the layer offset.

Returns:

The offset as {x,y,z}.

Type
object

getScale() → {object}

Source:

Get the layer scale.

Returns:

The scale as {x,y,z}.

Type
object

getTargetOrientation() → {dwv.math.Matrix33}

Source:

Get the target orientation.

Returns:

The orientation matrix.

Type
dwv.math.Matrix33

getViewLayersByDataIndex(index) → {Array}

Source:

Get the view layers associated to a data index.

Parameters:
Name Type Description
index number

The data index.

Returns:

The layers.

Type
Array

removeEventListener(type, callback)

Source:

Remove an event listener from this class.

Parameters:
Name Type Description
type string

The event type.

callback object

The method associated with the provided event type.

reset()

Source:

Reset the stage to its initial scale and no offset.

setActiveDrawLayer(index)

Source:

Set the active draw layer.

Parameters:
Name Type Description
index number

The index of the layer to set as active.

setActiveDrawLayerByDataIndex(index)

Source:

Set the active draw layer with a data index.

Parameters:
Name Type Description
index number

The data index.

setActiveViewLayer(index)

Source:

Set the active view layer.

Parameters:
Name Type Description
index number

The index of the layer to set as active.

setActiveViewLayerByDataIndex(index)

Source:

Set the active view layer with a data index.

Parameters:
Name Type Description
index number

The data index.

setOffset(newOffset)

Source:

Set the layers' offset.

Parameters:
Name Type Description
newOffset object

The offset as {x,y,z}.

Fires:

setScale(newScale)

Source:

Set the layers' scale.

Parameters:
Name Type Description
newScale object

The scale to apply as {x,y,z}.

Fires:

setTargetOrientation(orientation)

Source:

Set the target orientation.

Parameters:
Name Type Description
orientation dwv.math.Matrix33

The orientation matrix.

updateLayersToPositionChange(event)

Source:

Update layers (but not the active view layer) to a position change.

Parameters:
Name Type Description
event object

The position change event.

(inner) bindViewLayer(viewLayer)

Source:

Bind view layer events to this.

Parameters:
Name Type Description
viewLayer object

The view layer to bind.

(inner) getNextLayerDiv() → {HTMLElement}

Source:

Get the next layer DOM div.

Returns:

A DOM div.

Type
HTMLElement