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()addMarkupElement()createMarkupView()deleteMarkupView()exportMarkup()getActiveMarkupView()getMarkupView()getMarkupViewKeys()getPickTolerance()getRenderer()getSelectedMarkup()loadMarkupData()pickMarkupItem()refreshMarkup()refreshMarkupView()registerMarkup()registerMarkupFactory()registerMarkupTypeManager()removeMarkupElement()selectMarkup()setPickTolerance()unregisterMarkup()updateLater()
Methods
activateMarkupViewWithPromise
-
MarkupManager.activateMarkupViewWithPromise(uniqueId, view, duration) Arguments: - uniqueId (
string()) – the handle for the [[MarkupView]] object to activate - view (
IView()) – 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> - uniqueId (
addMarkupElement
-
MarkupManager.addMarkupElement(element, view) Arguments: - element (
HTMLElement()) – the HTML Element to add - view (
IView()) – the view where to add the HTML element
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.
Returns: system generated unique identifier which is the id of the passed in object Return type: string - element (
createMarkupView
-
MarkupManager.createMarkupView(view[, name, triggerEvent, visibilityState, colorMap, snapshotImage]) Arguments: - view (
IView()) – 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 - view (
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 - uniqueId (
exportMarkup
-
MarkupManager.exportMarkup() export markup from the viewer
Returns: Serialized markup objects Return type: MarkupData
getActiveMarkupView
-
MarkupManager.getActiveMarkupView(view) Arguments: - view (
IView()) – None
Returns the currently active [[MarkupView]].
Returns: [[MarkupView]] object for the currently active view, or null if no view is active Return type: null | MarkupView - view (
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 - uniqueId (
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> - json (
pickMarkupItem
-
MarkupManager.pickMarkupItem(point, view) Arguments: - point (
Point2()) – position to pick against - view (
IView()) – 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 - point (
refreshMarkup
-
MarkupManager.refreshMarkup(view) Arguments: - view (
IView()) – 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 - view (
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 - markupView (
registerMarkup
-
MarkupManager.registerMarkup(markupItem, view) Arguments: - markupItem (
MarkupItem()) – the item to register - view (
IView()) – 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 - markupItem (
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()) – None - viewer (
IWebViewer()) – None
Return type: MarkupItem
- obj (
- className (
registerMarkupTypeManager
-
MarkupManager.registerMarkupTypeManager(markupType, markupTypeManager) Arguments: - markupType (
string()) – None - markupTypeManager (
MarkupTypeManager()) – None
Registers a MarkupTypeManager to add markup to exported data.
Return type: void - markupType (
removeMarkupElement
-
MarkupManager.removeMarkupElement(id, view) Arguments: - id (
string()) – None - view (
IView()) – the view where to remove the HTML element
Removes a markup element from the markup element layer of the given view
Return type: void - id (
selectMarkup
-
MarkupManager.selectMarkup(markupItem, view) Arguments: - markupItem (
null | MarkupItem()) – The [[MarkupItem]] to select. - view (
IView()) – The view the selection come from.
Selects a [[MarkupItem]]. Pass null to clear the selection. Will refresh all views with markups.
Return type: void - markupItem (
setPickTolerance
-
MarkupManager.setPickTolerance(tolerance) Arguments: - tolerance (
number()) – The new tolerance
Sets the pick tolerance in pixels for picking a [[MarkupItem]]
Return type: void - tolerance (
unregisterMarkup
-
MarkupManager.unregisterMarkup(uniqueId, view) Arguments: - uniqueId (
string()) – unique handle to the object that was returned from [[registerMarkup]] - view (
IView()) – the view the markup belongs to
Unregisters a [[MarkupItem]]. It will no longer be rendered with the 3D view.
Return type: void - uniqueId (