Class TextAnnotationAdaptor

description

Creates text objects based on the user's movement down/move/up

Hierarchy

Implements

Index

Constructors

constructor

Properties

Private anchorPoint

anchorPoint: Point = new Fovia.Util.Point(0, 0)

Private fontSize

fontSize: number = 0

Protected frameNumber

frameNumber: number

Protected graphicLayerPrefix

graphicLayerPrefix: string = "FOVIA"

Protected htmlViewportGroup

htmlViewportGroup: HTMLViewportGroup

Protected is2D

is2D: boolean

Protected isMeasuring

isMeasuring: boolean = false

Protected linearMeasureDelta

linearMeasureDelta: number = 5

Private listOfKeys

listOfKeys: any[] = []

Protected processingMouseOp

processingMouseOp: any

Protected renderEngine

renderEngine: any

Private renderPixelBRHC

renderPixelBRHC: Point = new Fovia.Util.Point(0, 0)

Private rotationAngle

rotationAngle: number

Protected showAnnotations

showAnnotations: boolean = true

Protected showCadMarkings

showCadMarkings: boolean = true

Protected sopInstanceUid

sopInstanceUid: string

Private table

table: any

Private textAnnotation

textAnnotation: TextGraphicAnnotation = null

Private textArea

textArea: any

Protected viewport

viewport: HTMLViewport2D

Protected visualAttribute

visualAttribute: VisualAttribute = new Fovia.Util.VisualAttribute()

Protected volumeDataContext

volumeDataContext: any

Methods

Protected addCircleAnnotation

Protected addEllipseAnnotation

Protected addLineAnnotation

  • description

    Add the given LineGraphicAnnotaion into renderEngine that will be rendered later

    Parameters

    Returns boolean

    true will be returned in success case, false will be returned in failure case

Protected addPointAnnotation

  • description

    Add the given PointGraphicAnnotation into renderEngine that will be rendered later

    Parameters

    Returns boolean

    true will be returned in success case, false will be returned in failure case

Protected addTextAnnotation

  • description

    Add the given TextGraphicAnnotation into renderEngine that will be rendered later

    Parameters

    Returns boolean

    true will be returned in success case, false will be returned in failure case

Private applyLineBreak

  • applyLineBreak(): string
  • description

    Duplicate the text area, apply the line break as same as the original and save the text Finally, remove the element.

    Returns string

    Returns the break applied text

clearAllEditBtn

  • clearAllEditBtn(): void
  • description

    Clear All the edit button's which is previously created

    Returns void

Private createButton

  • createButton(key: string, src: string): HTMLImageElement
  • description

    create image html elemnt

    Parameters

    • key: string

      Specifies the unique key for new html element

    • src: string

      specifies the html source

    Returns HTMLImageElement

Private createTag

  • createTag(topLeft: any, id: any, isShowIcon?: boolean): HTMLElement
  • description

    Create div tag to button holder

    Parameters

    • topLeft: any

      Specifies the top left corner where the Html element to render

    • id: any

      New html element id

    • Default value isShowIcon: boolean = false

      Flag that specifies whether the div to render or hide

    Returns HTMLElement

    Returns the newly created html elemnt on success case

createTextElement

  • createTextElement(event: MouseEvent, context?: any, isEdit?: boolean, id?: number, editBtnId?: string): void
  • description

    Create the text element with following buttons Font size increase, decrease icon, Save and close button. Handle the below events : Font size increase or decrease events. Increase the font size +1 from actual size. Decrease the font size -1 from actual size. Save - Save the text annotation and reset the edit mode. Close - Reset the Edit mode

    Parameters

    • event: MouseEvent
    • Default value context: any = null

      Specifies the context instance fetched from canvas

    • Default value isEdit: boolean = false

      Specifies the flag whether the created text element to be editable or not

    • Default value id: number = 0

      Specifies the text html element's id

    • Default value editBtnId: string = ""

      Specifies the edit button html element id

    Returns void

displayAnnotations

  • displayAnnotations(showAnnotations?: boolean): void

displayCadMarkings

  • displayCadMarkings(showCadMarkings?: boolean): void
  • description

    Set the flag, based on that cad markers will be hide or render

    Parameters

    • Default value showCadMarkings: boolean = true

      true for render, false for hide

    Returns void

down

  • down(event: MouseEvent, cachedRenderParams: RenderParams3D): boolean
  • description

    called when the user pressed the mouse down

    Parameters

    • event: MouseEvent

      Specifies MouseEvent instance

    • cachedRenderParams: RenderParams3D

      Specifies the RenderParam Instance

    Returns boolean

    Returns the value returned by down2D method call

down2D

  • down2D(event: MouseEvent, cachedRenderParams: RenderParams3D): boolean
  • description

    Handle mouse down events.

    Parameters

    • event: MouseEvent

      Specifies the mouse event when this method to be called

    • cachedRenderParams: RenderParams3D

      Specifies the render param reference

    Returns boolean

    Returns true in success case false will be returned in failure case

keyUp

  • keyUp(event: KeyboardEvent): boolean
  • description

    Handle key up events. Esc key - Reset the edit mode. Each and every key up events, calculate the scroll height of text area and compare with actual height. If the scroll height > text area, reset the height of text box,

    Parameters

    • event: KeyboardEvent

    Returns boolean

    Returns true, if using Esc key or else false

move

  • move(event: MouseEvent, cachedRenderParams: RenderParams3D): boolean
  • description

    called when the user is moving or dragging the mouse

    Parameters

    • event: MouseEvent

      Specifies MouseEvent instance

    • cachedRenderParams: RenderParams3D

      Specifies the RenderParam Instance

    Returns boolean

    Returns the value return by move2D method call

move2D

  • move2D(event: MouseEvent, cachedRenderParams: RenderParams3D): boolean
  • description

    Handle mouse move events.

    Parameters

    • event: MouseEvent

      Specifies the mouse event when this method to be called

    • cachedRenderParams: RenderParams3D

      Specifies the render param reference

    Returns boolean

    Returns true in success case false will be returned in failure case

postRender

  • postRender(htmlViewport: any, renderParams: any): void

press

  • press(event: KeyboardEvent): boolean
  • description

    Handle key press events. Enter key - Save the current text annotation and disabled the edit mode.

    Parameters

    • event: KeyboardEvent

    Returns boolean

    Returns true, if press enter key or else false.

render

  • render(foviaHTMLViewport2D: any, canvas: any, width: any, height: any, imageTags: any): void
  • description

    Render the text annotations for the given dicom tag.

    Parameters

    • foviaHTMLViewport2D: any

      Viewport instance

    • canvas: any

      canvas fetched from viewport

    • width: any

      width of the viewport

    • height: any

      height of the viewport

    • imageTags: any

      DicomImageTags for that text annotation to be render

    Returns void

render2D

  • render2D(foviaHTMLViewport2D: any, canvas: any, width: any, height: any, imageTags: any, textAnnotations: any): void
  • description

    Render given text annotations on the given canvas

    Parameters

    • foviaHTMLViewport2D: any

      view port instance

    • canvas: any

      canvas instance fetched from view port

    • width: any

      width of the view port

    • height: any

      height of the view port

    • imageTags: any

      dicom image for that the text annotations to be rendered

    • textAnnotations: any

      list of text annotations to be rendered

    Returns void

Protected renderTextObjects

  • renderTextObjects(context: any, textObjects?: Array<TextObject>, color: string, isSelected?: boolean, isPointSelected?: boolean, isFreeText?: boolean): void
  • description

    Renders the given text objects on the given context

    Parameters

    • context: any

      Context object that is fetched from canvas

    • Default value textObjects: Array<TextObject> = []

      Text objects to be rendered

    • color: string

      Color of the text to be rendered

    • Default value isSelected: boolean = false

      flag that Specifies whether the text annotation is selected currently

    • Default value isPointSelected: boolean = false

      flag that Specifies whether the graphic point is selected currently

    • Default value isFreeText: boolean = false

      flag that specifies whether the text object is a label or free text, false for lable, true for free text

    Returns void

resetEdit

  • resetEdit(saveText?: boolean): void
  • description

    Reset the text annotation.

    Parameters

    • Default value saveText: boolean = true

      true, save the current text annotation and reset.

    Returns void

Private resetFontSize

  • resetFontSize(increase?: boolean, key: any): any
  • description

    Reset the font size of the text html element

    Parameters

    • Default value increase: boolean = false

      Flag specifies that whether font size to be increase or decrease

    • key: any

      Specifies the Html element id

    Returns any

Private saveText

  • saveText(): boolean
  • description

    Save text annotation

    Returns boolean

    True will be returned in success case

setCurrentAnnotation

  • description

    Set the annotation.

    Parameters

    Returns void

up

  • description

    called when the user releases the mouse Shift + Mouse Release - Create the new text element, if the text annotation is not in edit mode

    Parameters

    • event: MouseEvent

      Specifies MouseEvent instance

    • cachedRenderParams: RenderParams3D

      Specifies the RenderParam Instance

    Returns boolean

    Returns true in success case false will be returned in failure case

wheel

  • wheel(event: MouseEvent, cachedRenderParams: RenderParams3D): boolean
  • description

    Handle the mouse wheel events.

    Parameters

    • event: MouseEvent

      Specifies MouseEvent instance

    • cachedRenderParams: RenderParams3D

      Specifies the RenderParam Instance

    Returns boolean

    true by default