Options
All
  • Public
Menu

Class HTMLViewport

Hierarchy

Index

Constructors

Properties

Methods

Object literals

Constructors

constructor

  • new HTMLViewport(htmlElementName: string, width: number, height: number, disableRightClickMenuInBrowser?: boolean): HTMLViewport
  • description

    constructs the HTMLViewport object; the initialization is deferred till the init() call rather odd behavior if you attempt to create a Promise inside a constructor since it cannot return a value

    Parameters

    • htmlElementName: string

      name of HTML5 element

    • width: number

      Initial width of this viewport

    • height: number

      Initial height of this viewport

    • Default value disableRightClickMenuInBrowser: boolean = false

    Returns HTMLViewport

Properties

Private currentDoubleTapTouchAdaptor

currentDoubleTapTouchAdaptor: any = null

Private currentMilliSecs1

currentMilliSecs1: number = new Date().getTime()

Private currentMouseAdaptor

currentMouseAdaptor: any

Private currentMouseMoveAdaptorOverride

currentMouseMoveAdaptorOverride: any

Private currentSingleFingerTouchAdaptor

currentSingleFingerTouchAdaptor: any = null

Private currentSingleTapTouchAdaptor

currentSingleTapTouchAdaptor: any = null

Private currentThreeFingerTouchAdaptor

currentThreeFingerTouchAdaptor: any = null

Private currentTwoFingerTouchAdaptor

currentTwoFingerTouchAdaptor: any = null

Private displayFPSinViewport

displayFPSinViewport: boolean = true

Private forceMouseUpOnWindowExit

forceMouseUpOnWindowExit: boolean = false

Private globalMouseHandlerActive

globalMouseHandlerActive: boolean = false

Protected height

height: number

Private htmlElement

htmlElement: any

Protected htmlElementName

htmlElementName: string

Private lastImageProcessed

lastImageProcessed: number = new Date().getTime()

Private lastTapEvent

lastTapEvent: number = 0

Private mouseDown

mouseDown: boolean = false

Private mouseMapping

mouseMapping: object

Type declaration

Private observer

observer: ObserverInterface = null

Private octree

Private offsetX

offsetX: number = 0

Private offsetY

offsetY: number = 0

Protected onDrawCallback

onDrawCallback: any = null

Private orientation

orientation: ViewType

Private overrideMouseAdaptor

overrideMouseAdaptor: MouseAdaptorInterface = null

Private overrideTouchAdaptor

overrideTouchAdaptor: TouchAdaptorInterface = null

Private prevFrameRenderParams

prevFrameRenderParams: RenderParams = null

Private printFPStoConsole

printFPStoConsole: boolean = false

Private processingMouseAdaptor

processingMouseAdaptor: boolean = false

Private renderEngine

renderEngine: RenderEngineContext

Private scrollAdaptor

scrollAdaptor: ScrollMouseAdaptor = null

Private scrollData

scrollData: ScrollAdaptorData = null

Private touchMapping

touchMapping: object

Type declaration

Private touchStarted

touchStarted: boolean[] = new Array(3)

Private touchTimeout

touchTimeout: any

Private volumeDataInfo

volumeDataInfo: VolumeDataContext

Protected width

width: number

Private wlData

wlData: WindowLevelData = null

Static Private foviaHTMLViewportHash

foviaHTMLViewportHash: object

Type declaration

Static Private staticActiveViewport

staticActiveViewport: any = null

Methods

Private createMouseKey

  • creates a unique hash key for the specified mouse adaptor to mouse event mapping

    Parameters

    Returns string

disableRightClickMenu

  • disableRightClickMenu(disableMenu?: boolean): void
  • turn off the right-click popup menu

    Parameters

    • Default value disableMenu: boolean = true

    Returns void

displayFPS

  • displayFPS(showFPS: boolean): void
  • Display the FPS text in the viewport

    @ param showFPS Set to true to display frames per seoond in the viewport, false to hide it

    Parameters

    • showFPS: boolean

    Returns void

enableGlobalMouseEvents

  • enableGlobalMouseEvents(globalMouseHandlerActive: boolean): void
  • By default, JavaScript windows only see mosue events within its Canvas element, which means when the mouse moves outside the element, they are no longer tracked. By enabling this option, mouse events outside the HTML element are passed to this adaptor. By default, this is off (to adhere to standard javaScript behavior). In all cases, when a mouseUp occurs outside the active viewport, that event will be passed to the adaptor.

    Parameters

    • globalMouseHandlerActive: boolean

    Returns void

getHTMLElement

  • getHTMLElement(): any
  • Returns any

    HTML element associated with this viewport

Private getOctree

  • return the octree associated with tis viewport

    Returns OctreeContext

getOrientation

  • getOrientation(): number
  • Get the orientation for this viewport

    Returns number

getPreviousFrameRenderParams

getRenderEngine

  • return the renderEngine associated with this viewport.

    Returns RenderEngineContext

Private getRenderEngineID

  • getRenderEngineID(): number
  • return the renderEngineID associated with this viewport

    Returns number

getSliceInformation

  • getSliceInformation(): object
  • Get the slice information from scroll adaptor for 2D views

    Returns object

    • currentSlice: number
    • totalSlice: number

Private getVolumeData

  • return the volumeData associated with tis viewport

    Returns VolumeDataContext

Private globalMouseEnterHandler

  • globalMouseEnterHandler(event: MouseEvent): void
  • Parameters

    • event: MouseEvent

    Returns void

Private globalMouseLeaveHandler

  • globalMouseLeaveHandler(event: MouseEvent): void
  • Parameters

    • event: MouseEvent

    Returns void

Private globalMouseMoveHandler

  • globalMouseMoveHandler(event: MouseEvent): void
  • globalMouseMoveHandler -- dispatches to the correct mouseMove handler across the entire document

    Parameters

    • event: MouseEvent

    Returns void

Private globalMouseReleaseHandler

  • globalMouseReleaseHandler(event: MouseEvent): void
  • globalMouseReleaseHandler -- dispatches to the correct mouseUp handler across the entire document

    Parameters

    • event: MouseEvent

    Returns void

init

  • init(volumeDataInfo: VolumeDataContext, renderEngineType?: RenderType, onDrawCallback?: any, callbackFunc?: any, adaptorListener?: any): Promise<Object>
  • initialize the foviaHTMLViewport

    paramm

    volumeDataInfo Volume data to associate with this viewport

    Parameters

    • volumeDataInfo: VolumeDataContext
    • Default value renderEngineType: RenderType = Fovia.RenderType.parallel

      Render engine type (defaults to Parallel Rendering)

    • Optional onDrawCallback: any

      Callback triggered when an image is returned from the server but allows the applicaiton an opportunity to draw something ontop of the image

    • Optional callbackFunc: any
    • Optional adaptorListener: any

    Returns Promise<Object>

    This is an asynchronous method that returns a Promise as follows:

    Promise .then(void) .catch (err: ReturnCode )

    callbackFunc(err: ReturnCode , void)

    While this does not provide a return value, it is critical that render operations are not triggered in this component until after the initializtion is complete and the Promise or callback returns.:

initAndRender

  • initAndRender(volumeDataInfo: VolumeDataContext, renderEngineType?: RenderType, onDrawCallback?: any, callbackFunc?: any, adaptorLisetener?: any): Promise<Object>
  • Parameters

    • volumeDataInfo: VolumeDataContext
    • Default value renderEngineType: RenderType = Fovia.RenderType.parallel
    • Optional onDrawCallback: any
    • Optional callbackFunc: any
    • Optional adaptorLisetener: any

    Returns Promise<Object>

initWithRenderEngine

  • Parameters

    Returns Promise<Object>

Private mouseDownHandler

  • mouseDownHandler(event: MouseEvent): void
  • mouseDownHandler -- dispatches to the correct mouseDown handler. Note, this comes in on a HTML thread, so the HTMLViewport reference resides in the the private HTML element.

    Parameters

    • event: MouseEvent

    Returns void

Private mouseMoveHandler

  • mouseMoveHandler(event: MouseEvent): void
  • mouseMoveHandler -- dispatches to the correct mouseMove handler. Note, this comes in on a HTML thread, so the HTMLViewport reference resides in the the private HTML element.

    Parameters

    • event: MouseEvent

    Returns void

Private mouseReleaseHandler

  • mouseReleaseHandler(event: MouseEvent): void
  • mouseReleaseHandler -- dispatches to the correct mouseRelease handler. Note, this comes in on a HTML thread, so the HTMLViewport reference resides in the the private HTML element.

    Parameters

    • event: MouseEvent

    Returns void

Private mouseWheelHandler

  • mouseWheelHandler(event: MouseEvent): void
  • mouseMoveHandler -- dispatches to the correct mouseMove handler. Note, this comes in on a HTML thread, so the HTMLViewport reference resides in the the private HTML element.

    Parameters

    • event: MouseEvent

    Returns void

Protected paint

  • paint(htmlElement: any, bytes: any, width: number, height: number): void
  • paint() write the bytes to the HTML element (either CANVAS or IMG); In this method, the bytes are written to the actual CANVAS or IMG, however the sublcass HTMLDoubleBufferViewport overwrites this method and does rendering on a hidden CANVAS or IMG, which is then rendered onto the real CANVAS or IMG.

    Parameters

    • htmlElement: any
    • bytes: any
    • width: number
    • height: number

    Returns void

Private processImageFromServer

  • processImageFromServer(data: any): void
  • processImageFromServer is called when image is ready to be rendered for a render engine. If data.image is null, there was an error, in which case we reset the mouse/touch state.

    at this point, there is no knowledge of the canvasID (either in our code, or external), so the mapping between the renderEngineID (data.name) is used to find the correct object, and then its render() method will be called.

    Parameters

    • data: any

    Returns void

Private processMouseMove

  • processMouseMove(event: MouseEvent): void
  • internal method called to handline any mouseUp events (either directly, or from another handler)

    Parameters

    • event: MouseEvent

    Returns void

Private processMouseReleased

  • processMouseReleased(event: MouseEvent): void
  • internal method called to handline any mouseUp events (either directly, or from another handler)

    Parameters

    • event: MouseEvent

    Returns void

render

  • Invokes the native intermediate render() method.

    Returns ReturnCode

    This is a synchronous method and returns ReturnCode.ok on success.

renderFinal

  • Invokes the native renderFinal() method. It is important that a render() be done before a renderFinal() after the rendeirng state has changed, such as from a setRenderParamters().

    Returns ReturnCode

    This is a synchronous method and returns ReturnCode.ok on success.

Protected renderImageData

  • renderImageData(bytes: any, width: number, height: number): void
  • render the supplied bytes to the HTML element using paint(), and then update the internal state varaibles. If the mouse adaptor has a postRender step, such as during flythrough, invoke its postRender() method after the rendering is complete so the next frames can be requested.

    The renderImageData() method is extended in the subclass HTMLRepaintableViewport to create a duplicate copy of the rendered image from the server, so it is possible to update the viewport without forcing a native renderImageData() if the render parameters have not changed.

    TODO: extend this to support postRender for the touch flythrough

    Parameters

    • bytes: any
    • width: number
    • height: number

    Returns void

resizeWindow

  • resizeWindow(width: any, height: any): void
  • Resizes this component and triggers a render() / renderFinal() sequence

    Parameters

    • width: any

      Updated width of this viewport

    • height: any

      Updated height of this viewport

    Returns void

    This is a synchronous method and returns ReturnCode.ok on success.

Private sendAdaptorData

  • sendAdaptorData sends useful information about updates from adaptors and the render parameters used to generate the frame being sent it will include current slice, total number of slices from scroll adaptor it will include window level and width from window level adaptor

    Parameters

    Returns boolean

setAndRenderXMLPreset

  • setAndRenderXMLPreset(xmlPresetName: String, callbackFunc?: any): Promise<Object>
  • Applies the specified XML preset to this viewport

    Parameters

    • xmlPresetName: String

      path and filename of the XML file to load. This will be relative to the FoviaWebSDK.EXE directory, or can be an absolute path

    • Optional callbackFunc: any

    Returns Promise<Object>

    This is an asynchronous method that returns a Promise as follows:

    Promise .then(void) .catch (err: ReturnCode )

    callbackFunc(err: ReturnCode , void)

    While this does not provide a return value, the application will be notified once the preset has been applied and rendered

setCustomMouseAdaptor

  • Associate a custom mouse adaptor with a given mouse button and keyboard modifier

    Parameters

    Returns void

setCustomTouchAdaptor

  • Associate a custom mouse adaptor with a given mouse button and keyboard modifier

    Parameters

    Returns void

Private setDefaultAdaptors

  • setDefaultAdaptors(renderType: RenderType): void
  • sets default mouse and touch adaptors

    Parameters

    Returns void

setMouseAdaptor

  • Create a mapping between a mouse event and the specified adaptor

    Parameters

    Returns void

setOrientation

  • setOrientation(orientation: ViewType): void
  • Set the orientation for this viewport (typically called when creating MPR viewports)

    Parameters

    Returns void

setOverrideMouseAdaptor

  • Install a mouse adaptor that is invokved unconditionally for all mouse events. This allow the application to peek at the event, process it, and stop the propagate.

    This is useful when the application is detecting a mouse over event of an annotation or cross-reference lines, and handle that opposed to the current mouse adaptor that would otherwise be triggered.

    Parameters

    Returns void

setOverrideTouchAdaptor

  • Install a touch adaptor that is invokved unconditionally for all touch events. This allow the application to peek at the event, process it, and stop the propagate.

    This is useful when the application is detecting a touch over event of an annotation or cross-reference lines, and handle that opposed to the current mouse adaptor that would otherwise be triggered.

    Parameters

    Returns void

setTouchAdaptor

  • setTouchAdaptor(touchAdaptorInterface: any, touchEvent: any): void
  • map between a touch event and specified adaptor

    Parameters

    • touchAdaptorInterface: any
    • touchEvent: any

    Returns void

Private touchEndHandler

  • touchEndHandler(event: TouchEvent): void
  • touchEndHandler -- dispatches to the correct touchEnd handler. Note, this comes in on a HTML thread, so the HTMLViewport reference resides in the the private HTML element.

    Parameters

    • event: TouchEvent

    Returns void

Private touchMoveHandler

  • touchMoveHandler(event: TouchEvent): void
  • touchMoveHandler -- dispatches to the correct touchMove handler. Note, this comes in on a HTML thread, so the HTMLViewport reference resides in the the private HTML element.

    Parameters

    • event: TouchEvent

    Returns void

Private touchStartHandler

  • touchStartHandler(event: TouchEvent): void
  • touchStartHandler -- dispatches to the correct touchStart handler. Note, this comes in on a HTML thread, so the HTMLViewport reference resides in the the private HTML element.

    Parameters

    • event: TouchEvent

    Returns void

Static Private getHTMLViewportObj

  • retrieve the current "this" or "self" pointer (HTMLViewport) from the HTML element

    Parameters

    • htmlElement: any

    Returns HTMLViewport

Static Private setHTMLViewportObj

  • setHTMLViewportObj(htmlElement: any, foviaHTMLViewportObj: any): void
  • store the current this pointer (HTMLViewport) into the HTML element (this reference is visible from the browsser)

    Parameters

    • htmlElement: any
    • foviaHTMLViewportObj: any

    Returns void

Object literals

Private lastClientXY

lastClientXY: object

clientX

clientX: number = 0

clientY

clientY: number = 0

Generated using TypeDoc