Draw

dwv.tool. Draw

new Draw(app)

Source:

Drawing tool.

This tool is responsible for the draw layer group structure. The layout is:

drawLayer |_ positionGroup: name="position-group", id="#2-0##3-1"" | shapeGroup: name="{shape name}-group", id="#" |_ shape: name="shape" |_ label: name="label" |_ extra: line tick, protractor arc...

Discussion:

  • posGroup > shapeGroup pro: slice/frame display: 1 loop cons: multi-slice shape splitted in positionGroups
  • shapeGroup > posGroup pros: more logical cons: slice/frame display: 2 loops
Parameters:
Name Type Description
app dwv.App

The associated application.

Members

shapeFactoryList :object

Source:

Shape factory list

Type:
  • object

shapeName :string

Source:

Shape name.

Type:
  • string

style :dwv.gui.Style

Source:

Drawing style.

Type:

Methods

activate(flag)

Source:

Activate the tool.

Parameters:
Name Type Description
flag boolean

The flag to activate or not.

addEventListener(type, listener)

Source:

Add an event listener on the app.

Parameters:
Name Type Description
type string

The event type.

listener object

The method associated with the provided event type.

dblclick(event)

Source:

Handle double click event.

Parameters:
Name Type Description
event object

The mouse up event.

getHelpKeys() → {object}

Source:

Help for this tool.

Returns:

The help content.

Type
object

hasShape(name) → {boolean}

Source:

Check if the shape is in the shape list.

Parameters:
Name Type Description
name string

The name of the shape.

Returns:

True if there is a factory for the shape.

Type
boolean

init()

Source:

Initialise the tool.

keydown(event)

Source:

Handle key down event.

Parameters:
Name Type Description
event object

The key down event.

mousedown(event)

Source:

Handle mouse down event.

Parameters:
Name Type Description
event object

The mouse down event.

mousemove(event)

Source:

Handle mouse move event.

Parameters:
Name Type Description
event object

The mouse move event.

mouseout(event)

Source:

Handle mouse out event.

Parameters:
Name Type Description
event object

The mouse out event.

mouseup(event)

Source:

Handle mouse up event.

Parameters:
Name Type Description
event object

The mouse up event.

removeEventListener(type, listener)

Source:

Remove an event listener from the app.

Parameters:
Name Type Description
type string

The event type.

listener object

The method associated with the provided event type.

setLineColour(colour)

Source:

Set the line colour of the drawing.

Parameters:
Name Type Description
colour string

The colour to set

setOptions(options)

Source:

Set the tool options.

Parameters:
Name Type Description
options object

The list of shape names amd classes.

setShapeName(name)

Source:

Set the shape name of the drawing.

Parameters:
Name Type Description
name string

The name of the shape.

setShapeOn(shapeGroup, layerGroup)

Source:

Set shape group on properties.

Parameters:
Name Type Description
shapeGroup object

The shape group to set on.

layerGroup dwv.gui.LayerGroup

The origin layer group.

touchend(event)

Source:

Handle touch end event.

Parameters:
Name Type Description
event object

The touch end event.

touchmove(event)

Source:

Handle touch move event.

Parameters:
Name Type Description
event object

The touch move event.

touchstart(event)

Source:

Handle touch start event.

Parameters:
Name Type Description
event object

The touch start event.

(inner) activateCurrentPositionShapes(visible, layerGroup)

Source:

Activate shapes at current position.

Parameters:
Name Type Description
visible boolean

Set the draw layer visible or not.

layerGroup dwv.gui.LayerGroup

The origin layer group.

(inner) onFinalPoints(finalPoints, layerGroup)

Source:

Create the final shape from a point list.

Parameters:
Name Type Description
finalPoints Array

The array of points.

layerGroup dwv.gui.LayerGroup

The origin layer group.

(inner) onNewPoints(tmpPoints, layerGroup)

Source:

Update the current draw with new points.

Parameters:
Name Type Description
tmpPoints Array

The array of new points.

layerGroup dwv.gui.LayerGroup

The origin layer group.

(inner) setShapeOff(shapeGroup)

Source:

Set shape group off properties.

Parameters:
Name Type Description
shapeGroup object

The shape group to set off.

(inner) updateDrawLayer(layerGroup)

Source:

Update the draw layer.

Parameters:
Name Type Description
layerGroup dwv.gui.LayerGroup

The origin layer group.