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

.. js:class:: wv.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:`~wv.MarkupManager.viewer`
   
   .. rubric:: Methods
   
   
   .. rst-class:: api-xref-list
   
   
   * :js:meth:`~wv.MarkupManager.activateMarkupViewWithPromise`
   * :js:meth:`~wv.MarkupManager.addMarkupElement`
   * :js:meth:`~wv.MarkupManager.createMarkupView`
   * :js:meth:`~wv.MarkupManager.deleteMarkupView`
   * :js:meth:`~wv.MarkupManager.exportMarkup`
   * :js:meth:`~wv.MarkupManager.getActiveMarkupView`
   * :js:meth:`~wv.MarkupManager.getMarkupView`
   * :js:meth:`~wv.MarkupManager.getMarkupViewKeys`
   * :js:meth:`~wv.MarkupManager.getPickTolerance`
   * :js:meth:`~wv.MarkupManager.getRenderer`
   * :js:meth:`~wv.MarkupManager.getSelectedMarkup`
   * :js:meth:`~wv.MarkupManager.loadMarkupData`
   * :js:meth:`~wv.MarkupManager.pickMarkupItem`
   * :js:meth:`~wv.MarkupManager.refreshMarkup`
   * :js:meth:`~wv.MarkupManager.refreshMarkupView`
   * :js:meth:`~wv.MarkupManager.registerMarkup`
   * :js:meth:`~wv.MarkupManager.registerMarkupFactory`
   * :js:meth:`~wv.MarkupManager.registerMarkupTypeManager`
   * :js:meth:`~wv.MarkupManager.removeMarkupElement`
   * :js:meth:`~wv.MarkupManager.selectMarkup`
   * :js:meth:`~wv.MarkupManager.setPickTolerance`
   * :js:meth:`~wv.MarkupManager.unregisterMarkup`
   * :js:meth:`~wv.MarkupManager.updateLater`
   
   



.. rst-class:: kind-group kind-accessors

.. rubric:: Accessors
   :class: kind-group-title


.. js:method:: wv.MarkupManager.viewer

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



.. rst-class:: kind-group kind-methods

.. rubric:: Methods
   :class: kind-group-title


.. js:method:: wv.MarkupManager.activateMarkupViewWithPromise

      .. rst-class:: sig-pretty-signature
      
         | activateMarkupViewWithPromise(**uniqueId**\ : *string*\ , **view**\ : :js:class:`IView <wv.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 <wv.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:: wv.MarkupManager.addMarkupElement

      .. rst-class:: sig-pretty-signature
      
         | addMarkupElement(**element**\ : *HTMLElement*\ , **view**\ : :js:class:`IView <wv.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 <wv.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:: wv.MarkupManager.createMarkupView

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



.. js:method:: wv.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:: wv.MarkupManager.exportMarkup

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



.. js:method:: wv.MarkupManager.getActiveMarkupView

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



.. js:method:: wv.MarkupManager.getMarkupView

      .. rst-class:: sig-pretty-signature
      
         | getMarkupView(**uniqueId**\ : *string*\ ): (*None* | :js:class:`MarkupView <wv.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 <wv.Markup.MarkupView>`\ )
      
      
         [[MarkupView]] object for the corresponding ID or null if no view was found
      
      



.. js:method:: wv.MarkupManager.getMarkupViewKeys

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



.. js:method:: wv.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:: wv.MarkupManager.getRenderer

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



.. js:method:: wv.MarkupManager.getSelectedMarkup

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



.. js:method:: wv.MarkupManager.loadMarkupData

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



.. js:method:: wv.MarkupManager.pickMarkupItem

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



.. js:method:: wv.MarkupManager.refreshMarkup

      .. rst-class:: sig-pretty-signature
      
         | refreshMarkup(**view**\ : :js:class:`IView <wv.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 <wv.IView>`
      
      
            the view where markups need to be redrawn
      
      
      
      **Returns**\ : *void*
      



.. js:method:: wv.MarkupManager.refreshMarkupView

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



.. js:method:: wv.MarkupManager.registerMarkup

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



.. js:method:: wv.MarkupManager.registerMarkupFactory

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



.. js:method:: wv.MarkupManager.registerMarkupTypeManager

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



.. js:method:: wv.MarkupManager.removeMarkupElement

      .. rst-class:: sig-pretty-signature
      
         | removeMarkupElement(**id**\ : *string*\ , **view**\ : :js:class:`IView <wv.IView>`\ ): *void*
      
      Removes a markup element from the markup element layer of the given view
      
      **Parameters**
      
      
         **id**\ : *string*
      
      
            unique handle to the object that was returned from [[registerMarkup]]
      
      
         **view**\ : :js:class:`IView <wv.IView>`
      
      
            the view where to remove the HTML element
      
      
      
      **Returns**\ : *void*
      



.. js:method:: wv.MarkupManager.selectMarkup

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



.. js:method:: wv.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:: wv.MarkupManager.unregisterMarkup

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



.. js:method:: wv.MarkupManager.updateLater

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




