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
Methods
activateMarkupViewWithPromise
- MarkupManager.activateMarkupViewWithPromise(uniqueId, view, duration)
- Arguments
uniqueId (
string()
) – the handle for the [[MarkupView]] object to activateview (
View()
) – the view to activate the markup viewduration (
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 nametriggerEvent (
boolean()
) – optional parameter indicating whether a [[CallbackMap.viewCreated]] event should be triggered. This parameter defaults to truevisibilityState (
null | VisibilityState()
) – optional parametercolorMap (
null | Map
) – NonesnapshotImage (
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
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
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
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
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
obj (
any()
) – Noneviewer (
WebViewer()
) – None
- Return type
MarkupItem
registerMarkupTypeManager
- MarkupManager.registerMarkupTypeManager(markupType, markupTypeManager)
- Arguments
markupType (
string()
) – NonemarkupTypeManager (
MarkupTypeManager()
) – None
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