AnnotationGroup

Annotation group.

Constructor

new AnnotationGroup(listopt)

Parameters:
NameTypeAttributesDescription
listArray.<Annotation><optional>

Optional list, will create new if not provided.

Classes

AnnotationGroup

Methods

add(annotation)

Add a new annotation.

Parameters:
NameTypeDescription
annotationAnnotation

The annotation to add.

addEventListener(type, callback)

Add an event listener to this class.

Parameters:
NameTypeDescription
typestring

The event type.

callbackfunction

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

find(id) → {Annotation|undefined}

Find an annotation.

Parameters:
NameTypeDescription
idstring

The id of the annotation to find.

Returns:

The found annotation.

Type: 
Annotation | undefined

getColour() → {string}

Get the group colour.

Returns:

The colour as hex string.

Type: 
string

getLength() → {number}

Get the number of annotations of this list.

Returns:

The number of annotations.

Type: 
number

getList() → {Array.<Annotation>}

Get the annotation group as an array.

Returns:

The array.

Type: 
Array.<Annotation>

getMeta() → {Object.<string, any>}

Get the meta data.

Returns:

The meta data.

Type: 
Object.<string, any>

getMetaValue(key) → {string|object}

Get a meta data value.

Parameters:
NameTypeDescription
keystring

The meta data key.

Returns:

The meta data value.

Type: 
string | object

hasMeta(key) → {boolean}

Check if this list contains a meta data value.

Parameters:
NameTypeDescription
keystring

The key to check.

Returns:

True if the meta data is present.

Type: 
boolean

isEditable() → {boolean}

Check if the annotation group is editable.

Returns:

True if editable.

Type: 
boolean

remove(id)

Remove an annotation.

Parameters:
NameTypeDescription
idstring

The id of the annotation to remove.

removeEventListener(type, callback)

Remove an event listener from this class.

Parameters:
NameTypeDescription
typestring

The event type.

callbackfunction

The function associated with the provided event type.

setColour(colour)

Set the group colour.

Parameters:
NameTypeDescription
colourstring

The colour as hex string.

setEditable(flag)

Set the annotation group editability.

Parameters:
NameTypeDescription
flagboolean

True to make the annotation group editable.

setMetaValue(key, value)

Set a meta data.

Parameters:
NameTypeDescription
keystring

The meta data key.

valuestring | object

The value of the meta data.

setViewController(viewController)

Set the associated view controller.

Parameters:
NameTypeDescription
viewControllerViewController

The associated view controller.

update(annotation, propKeysopt)

Update an existing annotation.

Parameters:
NameTypeAttributesDescription
annotationAnnotation

The annotation to update.

propKeysArray.<string><optional>

Optional properties that got updated.

Events

annotationadd

Annotation add event.

Type:
  • object
Properties
NameTypeDescription
typestring

The event type.

dataAnnotation

The added annnotation.

annotationgroupeditablechange

Annotation group editable flag change event.

Type:
  • object
Properties
NameTypeDescription
typestring

The event type.

databoolean

The value of the editable flag.

annotationremove

Annotation update event.

Type:
  • object
Properties
NameTypeDescription
typestring

The event type.

dataAnnotation

The added annnotation.

keysArray.<string>

The properties that were updated.

annotationupdate

Annotation update event.

Type:
  • object
Properties
NameTypeDescription
typestring

The event type.

dataAnnotation

The added annnotation.

keysArray.<string>

The properties that were updated.