MarkupManager

class MarkupManager()

This class provides an interface into working with markup in the viewer. More information can be found here.

Accessors

MarkupManager.viewer()
get viewer(): IWebViewer

Return the viewer that is associated with this markup manager.

Returns: IWebViewer

Methods

MarkupManager.activateMarkupViewWithPromise()
activateMarkupViewWithPromise(uniqueId: string, view: IView, duration: number?): Promise

Activates a [[MarkupView]] in the given view.

Parameters

uniqueId: string

the handle for the [[MarkupView]] object to activate

view: IView

the view to activate the markup view

duration: number = DefaultTransitionDuration

the time in milliseconds for the transition to this view

Returns: Promise

MarkupManager.addMarkupElement()
addMarkupElement(element: HTMLElement, view: IView): string

Add an HTML element to the markup element layer of a given view. The element will have its ID set to a system generated unique identifier.

Parameters

element: HTMLElement

the HTML Element to add

view: IView

the view where to add the HTML element

Returns: string

system generated unique identifier which is the id of the passed in object
MarkupManager.createMarkupView()
createMarkupView(view: IView, name: string, triggerEvent: boolean?, visibilityState: (None | VisibilityState)?, colorMap: (None | Map)?, snapshotImage: (None | HTMLImageElement)?): string

Creates a new markup view based on a given view, line, and face visibility values.

Parameters

view: IView

the reference view for values used to create the markup view (camera, line and face visibility).

name: string

optional name for the markup view. If omitted or null, the system will generate a default name

triggerEvent: boolean = true

optional parameter indicating whether a [[CallbackMap.viewCreated]] event should be triggered. This parameter defaults to true

visibilityState: (None | VisibilityState) = null

optional parameter

colorMap: (None | Map) = null

snapshotImage: (None | HTMLImageElement) = null

Returns: string

Unique identifier for the new view
MarkupManager.deleteMarkupView()
deleteMarkupView(uniqueId: string): boolean

Deletes a [[MarkupView]] object.

Parameters

uniqueId: string

the handle for the view object to delete

Returns: boolean

true if a [[MarkupView]] with the supplied uniqueId was deleted, false otherwise
MarkupManager.exportMarkup()
exportMarkup(): MarkupData

export markup from the viewer

Returns: MarkupData

Serialized markup objects
MarkupManager.getActiveMarkupView()
getActiveMarkupView(view: IView): (None | MarkupView)

Returns the currently active [[MarkupView]].

Parameters

view: IView

Returns: (None | MarkupView)

[[MarkupView]] object for the currently active view, or null if no view is active
MarkupManager.getMarkupView()
getMarkupView(uniqueId: string): (None | MarkupView)

Gets a [[MarkupView]] object from the viewer.

Parameters

uniqueId: string

the handle for the view object to retreive

Returns: (None | MarkupView)

[[MarkupView]] object for the corresponding ID or null if no view was found
MarkupManager.getMarkupViewKeys()
getMarkupViewKeys(): string[]

Returns: string[]

an array of string keys for all markup views
MarkupManager.getPickTolerance()
getPickTolerance(): number

Gets the pick tolerance in pixels for picking a [[MarkupItem]]

Returns: number

Current tolerance
MarkupManager.getRenderer()
getRenderer(): MarkupRenderer

Returns a the interface to the [[MarkupRenderer]].

Returns: MarkupRenderer

[[MarkupRenderer]] interface
MarkupManager.getSelectedMarkup()
getSelectedMarkup(): (None | MarkupItem)

Returns the currently selected [[MarkupItem]], or null if nothing is currently selected

Returns: (None | MarkupItem)

selected [[MarkupItem]]
MarkupManager.loadMarkupData()
loadMarkupData(json: (string | MarkupData)): Promise

Loads markup data into the viewer.

Parameters

json: (string | MarkupData)

Returns: Promise

MarkupManager.pickMarkupItem()
pickMarkupItem(point: Point2, view: IView): (None | MarkupItem)

Picks a [[MarkupItem]]. Tests scene based and markup attached to the active view (if any)

Parameters

point: Point2

position to pick against

view: IView

view where the test is triggered

Returns: (None | MarkupItem)

[[MarkupItem]] that was selected or null if none was picked
MarkupManager.refreshMarkup()
refreshMarkup(view: IView): void

Redraws the markup without rendering the scene. Useful when markup is added or removed but the scene is not affected.

Parameters

view: IView

the view where markups need to be redrawn

Returns: void

MarkupManager.refreshMarkupView()
refreshMarkupView(markupView: MarkupView): void

Redraws all views where the given markup view is active. Scene is not rendered. Useful when something in a markup view has been updated and views need to reflect the changes.

Parameters

markupView: MarkupView

the markup view that has changed.

Returns: void

MarkupManager.registerMarkup()
registerMarkup(markupItem: MarkupItem, view: IView): string

Registers a [[MarkupItem]] to be rendered with the 3D view in the given view.

Parameters

markupItem: MarkupItem

the item to register

view: IView

the view where display markup

Returns: string

unique handle to this [[MarkupItem]].
MarkupManager.registerMarkupFactory()
registerMarkupFactory(className: string, factory: (obj: any, viewer: IWebViewer) => MarkupItem): void

Registers a factory to load custom markups in markup views when using loadMarkupData.

Parameters

className: string

identifier of the markup item type, this is what’s returned by getClassName function of MarkupItem.

factory: (obj: any, viewer: IWebViewer) => MarkupItem

a function to create the markup object from a json object outputed by toJson function of MarkupItem.

Returns: void

MarkupManager.registerMarkupTypeManager()
registerMarkupTypeManager(markupType: string, markupTypeManager: MarkupTypeManager): void

Registers a MarkupTypeManager to add markup to exported data.

Parameters

markupType: string

markupTypeManager: MarkupTypeManager

Returns: void

MarkupManager.removeMarkupElement()
removeMarkupElement(id: string, view: IView): void

Removes a markup element from the markup element layer of the given view

Parameters

id: string

view: IView

the view where to remove the HTML element

Returns: void

MarkupManager.selectMarkup()
selectMarkup(markupItem: (None | MarkupItem), view: IView): void

Selects a [[MarkupItem]]. Pass null to clear the selection. Will refresh all views with markups.

Parameters

markupItem: (None | MarkupItem)

The [[MarkupItem]] to select.

view: IView

The view the selection come from.

Returns: void

MarkupManager.setPickTolerance()
setPickTolerance(tolerance: number): void

Sets the pick tolerance in pixels for picking a [[MarkupItem]]

Parameters

tolerance: number

The new tolerance

Returns: void

MarkupManager.unregisterMarkup()
unregisterMarkup(uniqueId: string, view: IView): void

Unregisters a [[MarkupItem]]. It will no longer be rendered with the 3D view.

Parameters

uniqueId: string

unique handle to the object that was returned from [[registerMarkup]]

view: IView

the view the markup belongs to

Returns: void

MarkupManager.updateLater()
updateLater(view: IView): void

Parameters

view: IView

Returns: void