
#############
MarkupManager
#############

.. js:class:: MarkupManager

   This class provides an interface into working with markup in the viewer. More information can be found `here <https://docs.techsoft3d.com/hoops/visualize-web/latest/prog_guide/viewing/markup/markup-basics.html>`_\ .
   
   
   Index
   =====
   
   .. rubric:: Accessors
   
   
   .. rst-class:: api-xref-list
   
   
   * :js:func:`~MarkupManager.viewer`
   
   .. rubric:: Methods
   
   
   .. rst-class:: api-xref-list
   
   
   * :js:meth:`~MarkupManager.activateMarkupViewWithPromise`
   * :js:meth:`~MarkupManager.addMarkupElement`
   * :js:meth:`~MarkupManager.createMarkupView`
   * :js:meth:`~MarkupManager.deleteMarkupView`
   * :js:meth:`~MarkupManager.exportMarkup`
   * :js:meth:`~MarkupManager.getActiveMarkupView`
   * :js:meth:`~MarkupManager.getMarkupView`
   * :js:meth:`~MarkupManager.getMarkupViewKeys`
   * :js:meth:`~MarkupManager.getPickTolerance`
   * :js:meth:`~MarkupManager.getRenderer`
   * :js:meth:`~MarkupManager.getSelectedMarkup`
   * :js:meth:`~MarkupManager.loadMarkupData`
   * :js:meth:`~MarkupManager.pickMarkupItem`
   * :js:meth:`~MarkupManager.refreshMarkup`
   * :js:meth:`~MarkupManager.refreshMarkupView`
   * :js:meth:`~MarkupManager.registerMarkup`
   * :js:meth:`~MarkupManager.registerMarkupFactory`
   * :js:meth:`~MarkupManager.registerMarkupTypeManager`
   * :js:meth:`~MarkupManager.removeMarkupElement`
   * :js:meth:`~MarkupManager.selectMarkup`
   * :js:meth:`~MarkupManager.setPickTolerance`
   * :js:meth:`~MarkupManager.unregisterMarkup`
   * :js:meth:`~MarkupManager.updateLater`
   
   




Accessors
=========

.. js:method:: MarkupManager.viewer

   .. rst-class:: sig-pretty-signature
   
      | *get* viewer(): :js:class:`~IWebViewer`
   
   Return the viewer that is associated with this markup manager.
   
   **Returns**\ : :js:class:`~IWebViewer`
   





Methods
=======

.. js:method:: MarkupManager.activateMarkupViewWithPromise

   .. rst-class:: sig-pretty-signature
   
      | activateMarkupViewWithPromise(**uniqueId**\ : *string*\ , **view**\ : :js:class:`~IView`\ , **duration**\ : *number*\ ?): *Promise*
   
   Activates a [[MarkupView]] in the given view.
   
   **Parameters**
   
      **uniqueId**\ : *string*
   
         the handle for the [[MarkupView]] object to activate
   
   
      **view**\ : :js:class:`~IView`
   
         the view to activate the markup view
   
   
      **duration**\ : *number* = DefaultTransitionDuration
   
         the time in milliseconds for the transition to this view
   
   
   
   **Returns**\ : *Promise*
   



.. js:method:: MarkupManager.addMarkupElement

   .. rst-class:: sig-pretty-signature
   
      | addMarkupElement(**element**\ : *HTMLElement*\ , **view**\ : :js:class:`~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**\ : :js:class:`~IView`
   
         the view where to add the HTML element
   
   
   
   **Returns**\ : *string*
   
      system generated unique identifier which is the id of the passed in object
   
   



.. js:method:: MarkupManager.createMarkupView

   .. rst-class:: sig-pretty-signature
   
      | createMarkupView(**view**\ : :js:class:`~IView`\ , **name**\ : *string*\ , **triggerEvent**\ : *boolean*\ ?, **visibilityState**\ : (*None* \| :js:class:`~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**\ : :js:class:`~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* \| :js:class:`~VisibilityState`\ ) = null
   
         optional parameter
   
   
      **colorMap**\ : (*None* \| *Map*\ ) = null
   
      **snapshotImage**\ : (*None* \| *HTMLImageElement*\ ) = null
   
   
   **Returns**\ : *string*
   
      Unique identifier for the new view
   
   



.. js:method:: MarkupManager.deleteMarkupView

   .. rst-class:: sig-pretty-signature
   
      | 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
   
   



.. js:method:: MarkupManager.exportMarkup

   .. rst-class:: sig-pretty-signature
   
      | exportMarkup(): :js:class:`~MarkupData`
   
   export markup from the viewer
   
   **Returns**\ : :js:class:`~MarkupData`
   
      Serialized markup objects
   
   



.. js:method:: MarkupManager.getActiveMarkupView

   .. rst-class:: sig-pretty-signature
   
      | getActiveMarkupView(**view**\ : :js:class:`~IView`\ ): (*None* \| :js:class:`MarkupView <Markup.MarkupView>`\ )
   
   Returns the currently active [[MarkupView]].
   
   **Parameters**
   
      **view**\ : :js:class:`~IView`
   
   
   **Returns**\ : (*None* \| :js:class:`MarkupView <Markup.MarkupView>`\ )
   
      [[MarkupView]] object for the currently active view, or null if no view is active
   
   



.. js:method:: MarkupManager.getMarkupView

   .. rst-class:: sig-pretty-signature
   
      | getMarkupView(**uniqueId**\ : *string*\ ): (*None* \| :js:class:`MarkupView <Markup.MarkupView>`\ )
   
   Gets a [[MarkupView]] object from the viewer.
   
   **Parameters**
   
      **uniqueId**\ : *string*
   
         the handle for the view object to retreive
   
   
   
   **Returns**\ : (*None* \| :js:class:`MarkupView <Markup.MarkupView>`\ )
   
      [[MarkupView]] object for the corresponding ID or null if no view was found
   
   



.. js:method:: MarkupManager.getMarkupViewKeys

   .. rst-class:: sig-pretty-signature
   
      | getMarkupViewKeys(): *string*\ []
   
   **Returns**\ : *string*\ []
   
      an array of string keys for all markup views
   
   



.. js:method:: MarkupManager.getPickTolerance

   .. rst-class:: sig-pretty-signature
   
      | getPickTolerance(): *number*
   
   Gets the pick tolerance in pixels for picking a [[MarkupItem]]
   
   **Returns**\ : *number*
   
      Current tolerance
   
   



.. js:method:: MarkupManager.getRenderer

   .. rst-class:: sig-pretty-signature
   
      | getRenderer(): :js:class:`MarkupRenderer <Markup.MarkupRenderer>`
   
   Returns a the interface to the [[MarkupRenderer]].
   
   **Returns**\ : :js:class:`MarkupRenderer <Markup.MarkupRenderer>`
   
      [[MarkupRenderer]] interface
   
   



.. js:method:: MarkupManager.getSelectedMarkup

   .. rst-class:: sig-pretty-signature
   
      | getSelectedMarkup(): (*None* \| :js:class:`MarkupItem <Markup.MarkupItem>`\ )
   
   Returns the currently selected [[MarkupItem]], or null if nothing is currently selected
   
   **Returns**\ : (*None* \| :js:class:`MarkupItem <Markup.MarkupItem>`\ )
   
      selected [[MarkupItem]]
   
   



.. js:method:: MarkupManager.loadMarkupData

   .. rst-class:: sig-pretty-signature
   
      | loadMarkupData(**json**\ : (*string* \| :js:class:`~MarkupData`\ )): *Promise*
   
   Loads markup data into the viewer.
   
   **Parameters**
   
      **json**\ : (*string* \| :js:class:`~MarkupData`\ )
   
   
   **Returns**\ : *Promise*
   



.. js:method:: MarkupManager.pickMarkupItem

   .. rst-class:: sig-pretty-signature
   
      | pickMarkupItem(**point**\ : :js:class:`~Point2`\ , **view**\ : :js:class:`~IView`\ ): (*None* \| :js:class:`MarkupItem <Markup.MarkupItem>`\ )
   
   Picks a [[MarkupItem]]. Tests scene based and markup attached to the active view (if any)
   
   **Parameters**
   
      **point**\ : :js:class:`~Point2`
   
         position to pick against
   
   
      **view**\ : :js:class:`~IView`
   
         view where the test is triggered
   
   
   
   **Returns**\ : (*None* \| :js:class:`MarkupItem <Markup.MarkupItem>`\ )
   
      [[MarkupItem]] that was selected or null if none was picked
   
   



.. js:method:: MarkupManager.refreshMarkup

   .. rst-class:: sig-pretty-signature
   
      | refreshMarkup(**view**\ : :js:class:`~IView`\ ): *void*
   
   Redraws the markup without rendering the scene. Useful when markup is added or removed but the scene is not affected.
   
   **Parameters**
   
      **view**\ : :js:class:`~IView`
   
         the view where markups need to be redrawn
   
   
   
   **Returns**\ : *void*
   



.. js:method:: MarkupManager.refreshMarkupView

   .. rst-class:: sig-pretty-signature
   
      | refreshMarkupView(**markupView**\ : :js:class:`MarkupView <Markup.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**\ : :js:class:`MarkupView <Markup.MarkupView>`
   
         the markup view that has changed.
   
   
   
   **Returns**\ : *void*
   



.. js:method:: MarkupManager.registerMarkup

   .. rst-class:: sig-pretty-signature
   
      | registerMarkup(**markupItem**\ : :js:class:`MarkupItem <Markup.MarkupItem>`\ , **view**\ : :js:class:`~IView`\ ): *string*
   
   Registers a [[MarkupItem]] to be rendered with the 3D view in the given view.
   
   **Parameters**
   
      **markupItem**\ : :js:class:`MarkupItem <Markup.MarkupItem>`
   
         the item to register
   
   
      **view**\ : :js:class:`~IView`
   
         the view where display markup
   
   
   
   **Returns**\ : *string*
   
      unique handle to this [[MarkupItem]].
   
   



.. js:method:: MarkupManager.registerMarkupFactory

   .. rst-class:: sig-pretty-signature
   
      | registerMarkupFactory(**className**\ : *string*\ , **factory**\ : (**obj**\ : *any*\ , **viewer**\ : :js:class:`~IWebViewer`\ ) => :js:class:`MarkupItem <Markup.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**\ : :js:class:`~IWebViewer`\ ) => :js:class:`MarkupItem <Markup.MarkupItem>`
   
         a function to create the markup object from a json object outputed by toJson function of MarkupItem.
   
   
   
   **Returns**\ : *void*
   



.. js:method:: MarkupManager.registerMarkupTypeManager

   .. rst-class:: sig-pretty-signature
   
      | registerMarkupTypeManager(**markupType**\ : *string*\ , **markupTypeManager**\ : :js:class:`~MarkupTypeManager`\ ): *void*
   
   Registers a MarkupTypeManager to add markup to exported data.
   
   **Parameters**
   
      **markupType**\ : *string*
   
      **markupTypeManager**\ : :js:class:`~MarkupTypeManager`
   
   
   **Returns**\ : *void*
   



.. js:method:: MarkupManager.removeMarkupElement

   .. rst-class:: sig-pretty-signature
   
      | removeMarkupElement(**id**\ : *string*\ , **view**\ : :js:class:`~IView`\ ): *void*
   
   Removes a markup element from the markup element layer of the given view
   
   **Parameters**
   
      **id**\ : *string*
   
      **view**\ : :js:class:`~IView`
   
         the view where to remove the HTML element
   
   
   
   **Returns**\ : *void*
   



.. js:method:: MarkupManager.selectMarkup

   .. rst-class:: sig-pretty-signature
   
      | selectMarkup(**markupItem**\ : (*None* \| :js:class:`MarkupItem <Markup.MarkupItem>`\ ), **view**\ : :js:class:`~IView`\ ): *void*
   
   Selects a [[MarkupItem]]. Pass null to clear the selection. Will refresh all views with markups.
   
   **Parameters**
   
      **markupItem**\ : (*None* \| :js:class:`MarkupItem <Markup.MarkupItem>`\ )
   
         The [[MarkupItem]] to select.
   
   
      **view**\ : :js:class:`~IView`
   
         The view the selection come from.
   
   
   
   **Returns**\ : *void*
   



.. js:method:: MarkupManager.setPickTolerance

   .. rst-class:: sig-pretty-signature
   
      | setPickTolerance(**tolerance**\ : *number*\ ): *void*
   
   Sets the pick tolerance in pixels for picking a [[MarkupItem]]
   
   **Parameters**
   
      **tolerance**\ : *number*
   
         The new tolerance
   
   
   
   **Returns**\ : *void*
   



.. js:method:: MarkupManager.unregisterMarkup

   .. rst-class:: sig-pretty-signature
   
      | unregisterMarkup(**uniqueId**\ : *string*\ , **view**\ : :js:class:`~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**\ : :js:class:`~IView`
   
         the view the markup belongs to
   
   
   
   **Returns**\ : *void*
   



.. js:method:: MarkupManager.updateLater

   .. rst-class:: sig-pretty-signature
   
      | updateLater(**view**\ : :js:class:`~IView`\ ): *void*
   
   **Parameters**
   
      **view**\ : :js:class:`~IView`
   
   
   **Returns**\ : *void*
   





