/// import { EventEmitter } from 'events'; import Annotation from '../browser/annotation/Annotation'; import ImageSource from '../browser/image-source/ImageSource'; import Viewer from './viewer/Viewer'; /** * A composition is a combination of one imageSource and * an arbitrary number of annotations. */ export default class Composition extends EventEmitter { /** * The image source that is associated with this composition. * Do not modify this directly: Use the accessor methods instead. */ readonly imageSource: ImageSource; /** * List of viewers that are associated with this composition. * Do not modify this directly: Use the accessor methods instead. */ viewers: Viewer[]; /** * List of annotations that are associated with this composition. * Do not modify this directly: Use the accessor methods instead. */ annotations: Annotation[]; private imageReady; constructor(imageSource: ImageSource); /** * Adds a viewer to the internal list. * This method will be called automatically by a viewer. * End-users should not call this manually. */ registerViewer(viewer: Viewer): void; /** * Removes a viewer from the internal list. * This method will be called automatically by a viewer. * End-users should not call this manually. */ unregisterViewer(viewer: Viewer): void; /** * Adds an annotation to this composition. */ addAnnotation(annotation: Annotation): void; /** * Removes an annotation from this composition. */ removeAnnotation(annotation: Annotation): void; /** * Remove all annotations. */ removeAllAnnotations(): void; /** * Re-renders annotations in all of the associated viewers. * @param viewer Specify the viewer to update. */ annotationUpdated(viewer?: Viewer | Viewer[]): void; dispatchAnnotationChanging(annotation: Annotation): void; dispatchAnnotationChange(annotation: Annotation): void; }