.. role:: clio-inherited
   :class: clio-flag clio-flag-inherited


##########
PartLabels
##########

.. js:class:: cee.mrk.PartLabels

   Defines positioned text labels that can be shown in a :js:class:`MarkupModel <cee.mrk.MarkupModel>`\ .
   
   Use :js:meth:`MarkupModel.addLabelsPart <cee.mrk.MarkupModel.addLabelsPart>` to create a new instance of this class.
   
   **Some examples of different label styles:**
   
   .. image:: /images/MrkLabels.png
      :alt: None
   
   
   
   
   Index
   =====
   
   .. rubric:: Accessors
   
   
   .. rst-class:: api-xref-list
   
   
   * :js:func:`~cee.mrk.PartLabels.attachmentAppearance`
   * :js:func:`~cee.mrk.PartLabels.customData`
   * :js:func:`~cee.mrk.PartLabels.drawMode`
   * :js:func:`~cee.mrk.PartLabels.labelAppearance`
   * :js:func:`~cee.mrk.PartLabels.labelAttachmentPoint`
   * :js:func:`~cee.mrk.PartLabels.labelCount`
   
   .. rubric:: Methods
   
   
   .. rst-class:: api-xref-list
   
   
   * :js:meth:`~cee.mrk.PartLabels.add`
   * :js:meth:`~cee.mrk.PartLabels.addWithOffsetDirection`
   * :js:meth:`~cee.mrk.PartLabels.addWithOffsetDirectionFlipTowardEye`
   * :js:meth:`~cee.mrk.PartLabels.addWithOffsetPosition`
   * :js:meth:`~cee.mrk.PartLabels.deleteAll`
   * :js:meth:`~cee.mrk.PartLabels.deleteLabelAt`
   * :js:meth:`~cee.mrk.PartLabels.getLabelOffsetDirection`
   * :js:meth:`~cee.mrk.PartLabels.getLabelOffsetPosition`
   * :js:meth:`~cee.mrk.PartLabels.getLabelPosition`
   * :js:meth:`~cee.mrk.PartLabels.getLabelText`
   * :js:meth:`~cee.mrk.PartLabels.rayIntersect`
   * :js:meth:`~cee.mrk.PartLabels.setCustomDrawOntoCanvasCallback`
   * :js:meth:`~cee.mrk.PartLabels.setLabelOffsetDirection`
   * :js:meth:`~cee.mrk.PartLabels.setLabelOffsetPosition`
   * :js:meth:`~cee.mrk.PartLabels.setLabelPosition`
   * :js:meth:`~cee.mrk.PartLabels.setLabelText`
   * :js:meth:`~cee.mrk.PartLabels.setOccluderTriMesh`
   
   



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

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


.. js:method:: cee.mrk.PartLabels.attachmentAppearance

      .. rst-class:: sig-pretty-signature
      
         | *get* attachmentAppearance(): :js:class:`LabelAttachmentAppearance <cee.mrk.LabelAttachmentAppearance>`
      
      Returns an active reference to the attachment appearance settings for this part.
      
      **Returns**\ : :js:class:`LabelAttachmentAppearance <cee.mrk.LabelAttachmentAppearance>`
      



.. js:method:: cee.mrk.PartLabels.customData

      .. rst-class:: clio-flags
      
         :clio-inherited:`inherited`
      
      .. rst-class:: sig-pretty-signature
      
         | *get* customData(): *any*
      
      Custom data for the part. This field is not used by EnvisionWeb.
      
      **Returns**\ : *any*
      
      .. rst-class:: sig-pretty-signature
      
         | *set* customData(**data**\ : *any*\ ): *void*
      
      **Parameters**
      
      
         **data**\ : *any*
      
      
      **Returns**\ : *void*
      



.. js:method:: cee.mrk.PartLabels.drawMode

      .. rst-class:: sig-pretty-signature
      
         | *get* drawMode(): :js:data:`LabelDrawMode <cee.mrk.LabelDrawMode>`
      
      Draw mode for the labels in this part
      
      **Returns**\ : :js:data:`LabelDrawMode <cee.mrk.LabelDrawMode>`
      
      .. rst-class:: sig-pretty-signature
      
         | *set* drawMode(**mode**\ : :js:data:`LabelDrawMode <cee.mrk.LabelDrawMode>`\ ): *void*
      
      **Parameters**
      
      
         **mode**\ : :js:data:`LabelDrawMode <cee.mrk.LabelDrawMode>`
      
      
      **Returns**\ : *void*
      



.. js:method:: cee.mrk.PartLabels.labelAppearance

      .. rst-class:: sig-pretty-signature
      
         | *get* labelAppearance(): :js:class:`LabelAppearance <cee.mrk.LabelAppearance>`
      
      Returns an active reference to the appearance settings for the labels in this part.
      
      **Returns**\ : :js:class:`LabelAppearance <cee.mrk.LabelAppearance>`
      



.. js:method:: cee.mrk.PartLabels.labelAttachmentPoint

      .. rst-class:: sig-pretty-signature
      
         | *get* labelAttachmentPoint(): :js:data:`LabelAttachmentPoint <cee.mrk.LabelAttachmentPoint>`
      
      Point where the attachment line meets the label
      
      **Returns**\ : :js:data:`LabelAttachmentPoint <cee.mrk.LabelAttachmentPoint>`
      
      .. rst-class:: sig-pretty-signature
      
         | *set* labelAttachmentPoint(**attachmentPoint**\ : :js:data:`LabelAttachmentPoint <cee.mrk.LabelAttachmentPoint>`\ ): *void*
      
      **Parameters**
      
      
         **attachmentPoint**\ : :js:data:`LabelAttachmentPoint <cee.mrk.LabelAttachmentPoint>`
      
      
      **Returns**\ : *void*
      



.. js:method:: cee.mrk.PartLabels.labelCount

      .. rst-class:: sig-pretty-signature
      
         | *get* labelCount(): *number*
      
      The number of labels in the part.
      
      **Returns**\ : *number*
      



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

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


.. js:method:: cee.mrk.PartLabels.add

      .. rst-class:: sig-pretty-signature
      
         | add(**text**\ : *string*\ , **pos**\ : :js:class:`Vec3 <cee.Vec3>`\ ): *number*
      
      Adds the given text to the part, placing it at the given position. Returns the index of the new label.
      
      **Parameters**
      
      
         **text**\ : *string*
      
         **pos**\ : :js:class:`Vec3 <cee.Vec3>`
      
      
      **Returns**\ : *number*
      



.. js:method:: cee.mrk.PartLabels.addWithOffsetDirection

      .. rst-class:: sig-pretty-signature
      
         | addWithOffsetDirection(**text**\ : *string*\ , **pos**\ : :js:class:`Vec3 <cee.Vec3>`\ , **offsetDirection**\ : :js:class:`Vec3 <cee.Vec3>`\ ): *number*
      
      Adds text label with offset direction. Returns the index of the new label.
      
      **Parameters**
      
      
         **text**\ : *string*
      
         **pos**\ : :js:class:`Vec3 <cee.Vec3>`
      
         **offsetDirection**\ : :js:class:`Vec3 <cee.Vec3>`
      
      
      **Returns**\ : *number*
      



.. js:method:: cee.mrk.PartLabels.addWithOffsetDirectionFlipTowardEye

      .. rst-class:: sig-pretty-signature
      
         | addWithOffsetDirectionFlipTowardEye(**text**\ : *string*\ , **pos**\ : :js:class:`Vec3 <cee.Vec3>`\ , **offsetDirection**\ : :js:class:`Vec3 <cee.Vec3>`\ ): *number*
      
      Adds text with offset direction where the offset direction will be flipped so that it always points towards the viewpoint. Returns the index of the new label.
      
      **Parameters**
      
      
         **text**\ : *string*
      
         **pos**\ : :js:class:`Vec3 <cee.Vec3>`
      
         **offsetDirection**\ : :js:class:`Vec3 <cee.Vec3>`
      
      
      **Returns**\ : *number*
      



.. js:method:: cee.mrk.PartLabels.addWithOffsetPosition

      .. rst-class:: sig-pretty-signature
      
         | addWithOffsetPosition(**text**\ : *string*\ , **pos**\ : :js:class:`Vec3 <cee.Vec3>`\ , **offsetPosition**\ : :js:class:`Vec3 <cee.Vec3>`\ ): *number*
      
      Adds text label with offset position. Returns the index of the new label.
      
      **Parameters**
      
      
         **text**\ : *string*
      
         **pos**\ : :js:class:`Vec3 <cee.Vec3>`
      
         **offsetPosition**\ : :js:class:`Vec3 <cee.Vec3>`
      
      
      **Returns**\ : *number*
      



.. js:method:: cee.mrk.PartLabels.deleteAll

      .. rst-class:: sig-pretty-signature
      
         | deleteAll(): *void*
      
      Deletes all text labels from the part.
      
      **Returns**\ : *void*
      



.. js:method:: cee.mrk.PartLabels.deleteLabelAt

      .. rst-class:: sig-pretty-signature
      
         | deleteLabelAt(**index**\ : *number*\ ): *void*
      
      Deletes the text label at the given index.
      
      **Parameters**
      
      
         **index**\ : *number*
      
      
      **Returns**\ : *void*
      



.. js:method:: cee.mrk.PartLabels.getLabelOffsetDirection

      .. rst-class:: sig-pretty-signature
      
         | getLabelOffsetDirection(**index**\ : *number*\ ): :js:class:`Vec3 <cee.Vec3>`
      
      Gets the offset direction of the label at the given index.
      
      **Parameters**
      
      
         **index**\ : *number*
      
      
      **Returns**\ : :js:class:`Vec3 <cee.Vec3>`
      



.. js:method:: cee.mrk.PartLabels.getLabelOffsetPosition

      .. rst-class:: sig-pretty-signature
      
         | getLabelOffsetPosition(**index**\ : *number*\ ): :js:class:`Vec3 <cee.Vec3>`
      
      Gets the offset position of the label at the given index.
      
      **Parameters**
      
      
         **index**\ : *number*
      
      
      **Returns**\ : :js:class:`Vec3 <cee.Vec3>`
      



.. js:method:: cee.mrk.PartLabels.getLabelPosition

      .. rst-class:: sig-pretty-signature
      
         | getLabelPosition(**index**\ : *number*\ ): :js:class:`Vec3 <cee.Vec3>`
      
      Gets the position of the label at the given index.
      
      **Parameters**
      
      
         **index**\ : *number*
      
      
      **Returns**\ : :js:class:`Vec3 <cee.Vec3>`
      



.. js:method:: cee.mrk.PartLabels.getLabelText

      .. rst-class:: sig-pretty-signature
      
         | getLabelText(**index**\ : *number*\ ): *string*
      
      Gets the text of the label at the given index.
      
      **Parameters**
      
      
         **index**\ : *number*
      
      
      **Returns**\ : *string*
      



.. js:method:: cee.mrk.PartLabels.rayIntersect

      .. rst-class:: sig-pretty-signature
      
         | rayIntersect(**ray**\ : :js:class:`Ray <cee.Ray>`\ , **hitItem**\ : :js:class:`PartHitItem <cee.mrk.PartHitItem>`\ ): *boolean*
      
      Picking
      
      **Parameters**
      
      
         **ray**\ : :js:class:`Ray <cee.Ray>`
      
         **hitItem**\ : :js:class:`PartHitItem <cee.mrk.PartHitItem>`
      
      
      **Returns**\ : *boolean*
      



.. js:method:: cee.mrk.PartLabels.setCustomDrawOntoCanvasCallback

      .. rst-class:: sig-pretty-signature
      
         | setCustomDrawOntoCanvasCallback(**callback**\ : :js:class:`CustomDrawOntoCanvasCallback <cee.mrk.CustomDrawOntoCanvasCallback>`\ ): *void*
      
      Specify a custom label drawing callback.
      
      The callback will be called for each label in the part, and can be used to draw the label in a custom way.
      
      Note that this callback does not consider the label appearance settings. The callback will only receive the text to draw. If you return false from the callback, the label will be drawn as default.
      
      **Parameters**
      
      
         **callback**\ : :js:class:`CustomDrawOntoCanvasCallback <cee.mrk.CustomDrawOntoCanvasCallback>`
      
      
      **Returns**\ : *void*
      



.. js:method:: cee.mrk.PartLabels.setLabelOffsetDirection

      .. rst-class:: sig-pretty-signature
      
         | setLabelOffsetDirection(**index**\ : *number*\ , **offsetDirection**\ : :js:class:`Vec3 <cee.Vec3>`\ , **flipTowardsEye**\ : *boolean*\ ): *void*
      
      Sets the offset direction of the label at the given index.
      
      **Parameters**
      
      
         **index**\ : *number*
      
         **offsetDirection**\ : :js:class:`Vec3 <cee.Vec3>`
      
         **flipTowardsEye**\ : *boolean*
      
      
      **Returns**\ : *void*
      



.. js:method:: cee.mrk.PartLabels.setLabelOffsetPosition

      .. rst-class:: sig-pretty-signature
      
         | setLabelOffsetPosition(**index**\ : *number*\ , **offsetPosition**\ : :js:class:`Vec3 <cee.Vec3>`\ ): *void*
      
      Sets the offset position of the label at the given index.
      
      **Example:** Move a label with the mouse
      
      .. code-block:: javascript
      
         private onMouseMove(event: MouseEvent) {
           const label = this.m_pickingLabelPart;
         
           if (label && event.ctrlKey) {
             const view = this.m_viewer.getViewAt(0);
             const labelPos = label.getLabelPosition(0);
         
             // Keep label in the same distance from the camera
             const labelDepth = view.camera.project(labelPos).z;
             const oglWinPos = this.m_viewer.oglWinPosFromClientCoord(event.x, event.y);
             const labelOffsetPos = view.camera.unproject(
                       {x: oglWinPos.x, y: oglWinPos.y, z: labelDepth});
             
             label.setLabelOffsetPosition(0, labelOffsetPos);
           }
         }
      
      **Parameters**
      
      
         **index**\ : *number*
      
         **offsetPosition**\ : :js:class:`Vec3 <cee.Vec3>`
      
      
      **Returns**\ : *void*
      



.. js:method:: cee.mrk.PartLabels.setLabelPosition

      .. rst-class:: sig-pretty-signature
      
         | setLabelPosition(**index**\ : *number*\ , **position**\ : :js:class:`Vec3 <cee.Vec3>`\ ): *void*
      
      Sets the position of the label at the given index.
      
      **Parameters**
      
      
         **index**\ : *number*
      
         **position**\ : :js:class:`Vec3 <cee.Vec3>`
      
      
      **Returns**\ : *void*
      



.. js:method:: cee.mrk.PartLabels.setLabelText

      .. rst-class:: sig-pretty-signature
      
         | setLabelText(**index**\ : *number*\ , **text**\ : *string*\ ): *void*
      
      Sets the text of the label at the given index.
      
      **Parameters**
      
      
         **index**\ : *number*
      
         **text**\ : *string*
      
      
      **Returns**\ : *void*
      



.. js:method:: cee.mrk.PartLabels.setOccluderTriMesh

      .. rst-class:: sig-pretty-signature
      
         | setOccluderTriMesh(**labelIndex**\ : *number*\ , **vertices**\ : *ArrayLike*\ , **indices**\ : *ArrayLike*\ , **options**\ : :js:class:`OccluderOptions <cee.mrk.OccluderOptions>`\ ): *void*
      
      Sets the occluder tri-mesh to use for testing the visibility of the label at the specified index.
      
      The specified occluder mesh is used to test if the label should be visible or not. If the mesh is visible, the label will be visible. If the mesh is occluded, the label will be hidden.
      
      **Parameters**
      
      
         **labelIndex**\ : *number*
      
         **vertices**\ : *ArrayLike*
      
         **indices**\ : *ArrayLike*
      
         **options**\ : :js:class:`OccluderOptions <cee.mrk.OccluderOptions>`
      
      
      **Returns**\ : *void*
      




