DWVv0.37.0

DrawController

Source: drawController.js:15

Draw controller.


Constructor

new DrawController(group?: AnnotationGroup): DrawController

Parameters


Instance Methods

getAnnotation(uid: string): Annotation | undefined

Get an annotation.

Parameters

  • uid (string) — The annotation UID.

Returns

getAnnotationGroup(): AnnotationGroup

Get the annotation group.

Returns

isAnnotationGroupEditable(): boolean

Check if the annotation group is editable.

Returns

  • boolean — True if editable.

setAnnotationGroupEditable(flag: boolean)

Set the annotation group editability.

Parameters

  • flag (boolean) — True to make the annotation group editable.

addAnnotation(annotation: Annotation)

Add an annotation.

Parameters

  • annotation (Annotation) — The annotation to add.

updateAnnotation( annotation: Annotation, propKeys?: Array.<string>, propagate?: boolean, )

Update an anotation from the list.

Parameters

  • annotation (Annotation) — The annotation to update.
  • propKeys (Array.<string>, optional) — Optional properties that got updated.
  • propagate (boolean, optional) — Whether the update event propagates outside of dwv or not, defaults to true.

removeAnnotation(uid: string)

Remove an anotation for the list.

Parameters

  • uid (string) — The UID of the annotation to remove.

removeAnnotationWithCommand(uid: string, exeCallback: function)

Remove an annotation via a remove command (triggers draw actions).

Parameters

  • uid (string) — The annotation UID.
  • exeCallback (function) — The undo stack callback.

updateAnnotationWithCommand( uid: string, originalProps: object, newProps: object, exeCallback: function, )

Update an annotation via an update command (triggers draw actions).

Parameters

  • uid (string) — The annotation UID.
  • originalProps (object) — The original annotation properties that will be updated.
  • newProps (object) — The new annotation properties that will replace the original ones.
  • exeCallback (function) — The undo stack callback.

removeAllAnnotationsWithCommand(exeCallback: function)

Remove all annotations via remove commands (triggers draw actions).

Parameters

  • exeCallback (function) — The undo stack callback.

hasAnnotationMeta(key: string): boolean

Check if the annotation group contains a meta data value.

Parameters

  • key (string) — The key to check.

Returns

  • boolean — True if the meta data is present.

setAnnotationMeta(key: string, value: string)

Set an annotation meta data.

Parameters

  • key (string) — The meta data to set.
  • value (string) — The value of the meta data.