MarkupManager

class MarkupManager()

This class provides an interface into working with markup in the viewer. More information can be found [here](https://docs.techsoft3d.com/communicator/latest/prog_guide/viewing/markup/markup-basics.html).


Methods

activateMarkupViewWithPromise

MarkupManager.activateMarkupViewWithPromise(uniqueId, view, duration)
Arguments:
  • uniqueId (string()) – the handle for the [[MarkupView]] object to activate
  • view (View()) – the view to activate the markup view
  • duration (number()) – the time in milliseconds for the transition to this view

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

Return type:Promise <boolean>

addMarkupElement

MarkupManager.addMarkupElement(element)
Arguments:
  • element (HTMLElement()) – the HTML Element to add

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

Returns:system generated unique identifier which is the id of the passed in object
Return type:string

createMarkupView

MarkupManager.createMarkupView(view[, name, triggerEvent, visibilityState, colorMap, snapshotImage])
Arguments:
  • view (View()) – the reference view for values used to create the markup view (camera, line and face visibility).
  • name (string()) – optional optional name for the markup view. If omitted or null, the system will generate a default name
  • triggerEvent (boolean()) – optional parameter indicating whether a [[CallbackMap.viewCreated]] event should be triggered. This parameter defaults to true
  • visibilityState (null | VisibilityState()) – optional parameter
  • colorMap (null | Map) – None
  • snapshotImage (null | HTMLImageElement()) – None

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

Returns:Unique identifier for the new view
Return type:string

deleteMarkupView

MarkupManager.deleteMarkupView(uniqueId)
Arguments:
  • uniqueId (string()) – the handle for the view object to delete

Deletes a [[MarkupView]] object.

Returns:true if a [[MarkupView]] with the supplied uniqueId was deleted, false otherwise
Return type:boolean

exportMarkup

MarkupManager.exportMarkup()

export markup from the viewer

Returns:Serialized markup objects
Return type:MarkupData

getActiveMarkupView

MarkupManager.getActiveMarkupView(view)
Arguments:

Returns the currently active [[MarkupView]].

Returns:[[MarkupView]] object for the currently active view, or null if no view is active
Return type:null | MarkupView

getMarkupView

MarkupManager.getMarkupView(uniqueId)
Arguments:
  • uniqueId (string()) – the handle for the view object to retreive

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

Returns:[[MarkupView]] object for the corresponding ID or null if no view was found
Return type:null | MarkupView

getMarkupViewKeys

MarkupManager.getMarkupViewKeys()
Returns:an array of string keys for all markup views
Return type:[string]

getPickTolerance

MarkupManager.getPickTolerance()

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

Returns:Current tolerance
Return type:number

getRenderer

MarkupManager.getRenderer()

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

Returns:[[MarkupRenderer]] interface
Return type:MarkupRenderer

getSelectedMarkup

MarkupManager.getSelectedMarkup()

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

Returns:selected [[MarkupItem]]
Return type:null | MarkupItem

loadMarkupData

MarkupManager.loadMarkupData(json)
Arguments:
  • json (string | MarkupData()) – None

Loads markup data into the viewer.

Return type:Promise <boolean>

pickMarkupItem

MarkupManager.pickMarkupItem(point, view)
Arguments:
  • point (Point2()) – position to pick against
  • view (View()) – view where the test is triggered

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

Returns:[[MarkupItem]] that was selected or null if none was picked
Return type:null | MarkupItem

refreshMarkup

MarkupManager.refreshMarkup(view)
Arguments:
  • view (View()) – the view where markups need to be redrawn

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

Return type:void

refreshMarkupView

MarkupManager.refreshMarkupView(markupView)
Arguments:
  • markupView (MarkupView()) – the markup view that has changed.

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.

Return type:void

registerMarkup

MarkupManager.registerMarkup(markupItem, view)
Arguments:
  • markupItem (MarkupItem()) – the item to register
  • view (View()) – the view where display markup

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

Returns:unique handle to this [[MarkupItem]].
Return type:string

registerMarkupFactory

MarkupManager.registerMarkupFactory(className, factory)
Arguments:
  • className (string()) – identifier of the markup item type, this is what’s returned by getClassName function of MarkupItem.
  • factory (function()) – a function to create the markup object from a json object outputed by toJson function of MarkupItem.

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

Return type:void
MarkupManager.factory(obj, viewer)
Arguments:
Return type:

MarkupItem

registerMarkupTypeManager

MarkupManager.registerMarkupTypeManager(markupType, markupTypeManager)
Arguments:

Registers a MarkupTypeManager to add markup to exported data.

Return type:void

removeMarkupElement

MarkupManager.removeMarkupElement(id)
Arguments:
  • id (string()) – None

Removes a markup element from the markup element layer

Return type:void

selectMarkup

MarkupManager.selectMarkup(markupItem)
Arguments:
  • markupItem (null | MarkupItem()) – The [[MarkupItem]] to select.

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

Return type:void

setPickTolerance

MarkupManager.setPickTolerance(tolerance)
Arguments:
  • tolerance (number()) – The new tolerance

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

Return type:void

unregisterMarkup

MarkupManager.unregisterMarkup(uniqueId, view)
Arguments:
  • uniqueId (string()) – unique handle to the object that was returned from [[registerMarkup]]
  • view (View()) – the view the markup belongs to

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

Return type:void

updateLater

MarkupManager.updateLater(view)
Arguments:
Return type:

void