AnnotationGroup
Source: annotationGroup.js:23
Annotation group.
Constructor
new AnnotationGroup(list?: Array.<Annotation>): AnnotationGroupParameters
list(Array.<Annotation>, optional) — Optional list, will create new if not provided.
Instance Methods
getList(): Array.<Annotation>
Get the annotation group as an array.
Returns
Array.<Annotation>— The array.
getLength(): number
Get the number of annotations of this list.
Returns
number— The number of annotations.
isEditable(): boolean
Check if the annotation group is editable.
Returns
boolean— True if editable.
setEditable(flag: boolean)
Set the annotation group editability.
Parameters
flag(boolean) — True to make the annotation group editable.
getColour(): string
Get the group colour.
Returns
string— The colour as hex string.
setColour(colour: string)
Set the group colour.
Parameters
colour(string) — The colour as hex string.
add(annotation: Annotation, propagate?: boolean)
Add a new annotation.
Parameters
annotation(Annotation) — The annotation to add.propagate(boolean, optional) — Whether the event propagates outside of dwv or not, defaults to true.
update(
annotation: Annotation,
propKeys?: Array.<string>,
propagate?: boolean,
)
Update an existing annotation.
Parameters
annotation(Annotation) — The annotation to update.propKeys(Array.<string>, optional) — Optional properties that got updated.propagate(boolean, optional) — Whether the event propagates outside of dwv or not, defaults to true.
remove(uid: string, propagate?: boolean)
Remove an annotation.
Parameters
uid(string) — The UID of the annotation to remove.propagate(boolean, optional) — Whether the event propagates outside of dwv or not, defaults to true.
setViewController(viewController: ViewController)
Set the associated view controller.
Parameters
viewController(ViewController) — The associated view controller.
find(uid: string): Annotation | undefined
Find an annotation.
Parameters
uid(string) — The UID of the annotation to find.
Returns
Annotation| undefined— The found annotation.
getMeta(): Record.<string, any>
Get the meta data.
Returns
Record.<string, any>— The meta data.
hasMeta(key: string): boolean
Check if this list contains a meta data value.
Parameters
key(string) — The key to check.
Returns
boolean— True if the meta data is present.
getMetaValue(key: string): string | object | undefined
Get a meta data value.
Parameters
key(string) — The meta data key.
Returns
string | object | undefined— The meta data value.
setMetaValue(key: string, value: string | object)
Set a meta data.
Parameters
key(string) — The meta data key.value(string | object) — The value of the meta data.
Events
annotationgroupeditablechange: CustomEvent
Annotation group editable flag change event.
Properties
detail(object) — The event detail.detail.data(boolean) — The value of the editable flag.
annotationadd: CustomEvent
Annotation add event.
Properties
detail(object) — The event detail.detail.data(Annotation) — The added annotation.
annotationupdate: CustomEvent
Annotation update event.
Properties
detail(object) — The event detail.detail.data(Annotation) — The updated annotation.detail.keys(Array.<string>) — The properties that were updated.
annotationremove: CustomEvent
Annotation remove event.
Properties
detail(object) — The event detail.detail.data(Annotation) — The removed annotation.