ImFusion Web SDK

AnnotationModel

Container class holding all annotations. Annotations have unique IDs and each belongs to a dataset.

Extends

Methods

MethodDescription
remove()Removes an annotation.
annotations()Returns all annotations.
updateAnnotationVisibility()Makes sure annotations are visible in and only in views in which their parent data items are visible.
add()Adds a new annotation, and attaches it to all views.
dataAnnotations()Returns all annotations belonging to the given dataset.
onAnnotationAdded()Fires when an annotation is added.
onAnnotationAboutToBeRemoved()Fires directly before an annotation is removed.
onAnnotationEvent()Fires when an annotation lifecycle event occurs.

Inherited from ClassHandle

MethodDescription
isAliasOf()Returns true if this handle and other alias the same underlying C++ object.
delete()Releases this JavaScript handle.
deleteLater()Schedules this handle for deferred deletion and returns this handle.
isDeleted()Returns true if this handle has already been deleted.
[dispose]()Releases this handle when the enclosing scope exits, so a handle can be declared with using instead of calling delete() later manually.
clone()Returns a new JavaScript handle aliasing the same underlying C++ object.

remove()

ts
remove(annotation: Annotation | null): void;

Removes an annotation.

Parameters

ParameterType
annotationAnnotation | null

Returns

void


annotations()

ts
annotations(): HandleArray<Annotation>;

Returns all annotations.

Returns

HandleArray<Annotation>


updateAnnotationVisibility()

ts
updateAnnotationVisibility(): void;

Makes sure annotations are visible in and only in views in which their parent data items are visible.

Returns

void


add()

ts
add(type: AnnotationType, data: Data | null): Annotation | null;

Adds a new annotation, and attaches it to all views.

Parameters

ParameterTypeDescription
typeAnnotationTypeType of the annotation
dataData | nullThe parent dataset

Returns

Annotation | null

The created annotation or null in case of an error


dataAnnotations()

ts
dataAnnotations(data: Data | null): HandleArray<Annotation>;

Returns all annotations belonging to the given dataset.

Parameters

ParameterType
dataData | null

Returns

HandleArray<Annotation>


onAnnotationAdded()

ts
onAnnotationAdded(callback: (annotation: Annotation) => void): () => void;

Fires when an annotation is added.

Parameters

ParameterTypeDescription
callback(annotation: Annotation) => voidCalled with the added annotation.

Returns

Unsubscribe function.

() => void


onAnnotationAboutToBeRemoved()

ts
onAnnotationAboutToBeRemoved(callback: (annotation: Annotation) => void): () => void;

Fires directly before an annotation is removed.

Parameters

ParameterTypeDescription
callback(annotation: Annotation) => voidCalled with the annotation about to be removed.

Returns

Unsubscribe function.

() => void


onAnnotationEvent()

ts
onAnnotationEvent(callback: (annotation: Annotation, event: AnnotationEvent) => void): () => void;

Fires when an annotation lifecycle event occurs.

Parameters

ParameterTypeDescription
callback(annotation: Annotation, event: AnnotationEvent) => voidCalled with the annotation and the event type.

Returns

Unsubscribe function.

() => void

On this page