AnnotationAPI¶
Interface AnnotationAPI
changeAnnotation(
annotationId: number,
properties: AnnotationProperties,
): AnnotationProperties;
changeAnnotation(
annotationID: number,
label?: string,
visible?: boolean,
anchorPosition?: number[] | Float32Array<ArrayBufferLike>,
labelPosition?: number[] | Float32Array<ArrayBufferLike>,
active?: boolean,
transform?: number[] | Float32Array<ArrayBufferLike>,
): void;
createAnnotation(properties?: AnnotationProperties): number;
createAnnotation(
nodeID: number,
label: string,
visible?: boolean,
anchorPosition?: number[] | Float32Array<ArrayBufferLike>,
labelOffset?: number[] | Float32Array<ArrayBufferLike>,
): number;
getAnnotationData(annotationId: number): AnnotationData;
getAnnotations(): number[];
removeAnnotation(annotationId: number, safe?: boolean): RemoveState;
requestAnnotationData(annotationId: number): Promise<AnnotationProperties>;
}
Hierarchy (View Summary)
- AnnotationAPI
Methods
change Annotation
Changes one or more properties of an Annotation with the specified ID and triggers an AnnotationChangedEvent.
Parameters
- annotationId: number
The ID of the Annotation you want to change.
- properties: AnnotationProperties
The properties of the Annotation you want change.
Returns AnnotationProperties
An Object with the changed Properties.
- annotationId: number
- changeAnnotation(
annotationID: number,
label?: string,
visible?: boolean,
anchorPosition?: number[] | Float32Array<ArrayBufferLike>,
labelPosition?: number[] | Float32Array<ArrayBufferLike>,
active?: boolean,
transform?: number[] | Float32Array<ArrayBufferLike>,
): voidParameters
- annotationID: number
The ID of the Annotation.
Optionallabel: stringThe text of the Annotation.
Optionalvisible: booleanIndicates if the Annotation should be visible or hidden.
OptionalanchorPosition: number[] | Float32Array<ArrayBufferLike>Anchor position in world space coordinates.
OptionallabelPosition: number[] | Float32Array<ArrayBufferLike>The position of the label.
Optionalactive: booleanDEPRECATED
Optionaltransform: number[] | Float32Array<ArrayBufferLike>The transformation of the Annotation.
Returns void
Deprecated
Changes an annotation. Should use a properties object AnnotationProperties as an argument rather than passing individual values.
- annotationID: number
create Annotation
Creates a new Annotation and triggers an AnnotationCreatedEvent.
Parameters
Optionalproperties: AnnotationPropertiesInitial properties of the created Annotation.
Returns number
The ID of the newly created Annotation.
- createAnnotation(
nodeID: number,
label: string,
visible?: boolean,
anchorPosition?: number[] | Float32Array<ArrayBufferLike>,
labelOffset?: number[] | Float32Array<ArrayBufferLike>,
): numberParameters
- nodeID: number
The ID of the node that the Annotation belongs to.
- label: string
The text of the Annotation.
Optionalvisible: booleanIndicates if the Annotation should be visible or hidden.
OptionalanchorPosition: number[] | Float32Array<ArrayBufferLike>Anchor position in world space coordinates.
OptionallabelOffset: number[] | Float32Array<ArrayBufferLike>The offset between anchorPosition and where the label should be displayed.
Returns number
The ID of the new annotation.
Deprecated
Creates a new annotation. Should use a properties object AnnotationProperties as an argument rather than passing individual values.
- nodeID: number
get Annotation Data
Parameters
- annotationId: number
The ID of the Annotation.
Returns AnnotationData
The content and properties of an annotation.
- annotationId: number
get Annotations
Returns number[]
The IDs of all available Annotations.
remove Annotation
Removes the Annotation from the scene and all related Snapshots and triggers an AnnotationRemovedEvent.
Parameters
- annotationId: number
The ID of the Annotation.
Optionalsafe: booleanPerforms a safe remove which interrupt the removal process if the Annotation is part of one or more Snapshots.
Returns RemoveState
- annotationId: number
request Annotation Data
Returns the AnnotationData for the specified Annotation ID.
Parameters
- annotationId: number
The ID of the Annotation you want to request the data for.
Returns Promise<AnnotationProperties>
The requested Annotation data.
- annotationId: number
Overview
The AnnotationAPI provides a set of tools for creating and managing annotations via the webvis context. It allows you to:
Examples of all operations are provided below.
Quick Start
The fastest way to get familiar with the AnnotationAPI is by creating annotations via the webvis context. Once you have the context, you can call the annotation methods directly.
Example: Create, update and remove an annotation using the AnnotationAPI and connect the annotation to a node.
Events
The following events are associated with the AnnotationAPI: