PartLabels
-
class
cee.mrk.
PartLabels
() Defines positioned text labels that can be shown in a
MarkupModel
.Use
MarkupModel.addLabelsPart
to create a new instance of this class.Some examples of different label styles: .. image:: ../../images/MrkLabels.png
Methods
add
addWithOffsetDirection
addWithOffsetDirectionFlipTowardEye
addWithOffsetPosition
deleteAll
deleteLabelAt
getLabelOffsetDirection
getLabelOffsetPosition
getLabelPosition
getLabelText
rayIntersect
setCustomDrawOntoCanvasCallback
setLabelOffsetDirection
setLabelOffsetPosition
setLabelPosition
setLabelText
setOccluderTriMesh
Accessors
-
PartLabels.
attachmentAppearance
() Returns an active reference to the attachment appearance settings for this part.
Return type: LabelAttachmentAppearance
-
PartLabels.
customData
() Custom data for the part. This field is not used by EnvisionWeb.
Return type: any
-
PartLabels.
customData
(data) Arguments: - data (
any
) – None
Return type: void
- data (
-
PartLabels.
drawMode
() Draw mode for the labels in this part
Return type: LabelDrawMode
-
PartLabels.
drawMode
(mode) Arguments: - mode (
LabelDrawMode
) – None
Return type: void
- mode (
-
PartLabels.
labelAppearance
() Returns an active reference to the appearance settings for the labels in this part.
Return type: LabelAppearance
-
PartLabels.
labelAttachmentPoint
() Point where the attachment line meets the label
Return type: LabelAttachmentPoint
-
PartLabels.
labelAttachmentPoint
(attachmentPoint) Arguments: - attachmentPoint (
LabelAttachmentPoint
) – None
Return type: void
- attachmentPoint (
-
PartLabels.
labelCount
() The number of labels in the part.
Return type: number
Methods
add
-
PartLabels.
add
(text, pos) Arguments: - text (
string
) – None - pos (
Vec3
) – None
Adds the given text to the part, placing it at the given position. Returns the index of the new label.
Return type: number - text (
addWithOffsetDirection
-
PartLabels.
addWithOffsetDirection
(text, pos, offsetDirection) Arguments: - text (
string
) – None - pos (
Vec3
) – None - offsetDirection (
Vec3
) – None
Adds text label with offset direction. Returns the index of the new label.
Return type: number - text (
addWithOffsetDirectionFlipTowardEye
-
PartLabels.
addWithOffsetDirectionFlipTowardEye
(text, pos, offsetDirection) Arguments: - text (
string
) – None - pos (
Vec3
) – None - offsetDirection (
Vec3
) – None
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.
Return type: number - text (
addWithOffsetPosition
-
PartLabels.
addWithOffsetPosition
(text, pos, offsetPosition) Arguments: - text (
string
) – None - pos (
Vec3
) – None - offsetPosition (
Vec3
) – None
Adds text label with offset position. Returns the index of the new label.
Return type: number - text (
deleteLabelAt
-
PartLabels.
deleteLabelAt
(index) Arguments: - index (
number
) – None
Deletes the text label at the given index.
Return type: void - index (
getLabelOffsetDirection
-
PartLabels.
getLabelOffsetDirection
(index) Arguments: - index (
number
) – None
Gets the offset direction of the label at the given index.
Return type: Vec3 - index (
getLabelOffsetPosition
-
PartLabels.
getLabelOffsetPosition
(index) Arguments: - index (
number
) – None
Gets the offset position of the label at the given index.
Return type: Vec3 - index (
getLabelPosition
-
PartLabels.
getLabelPosition
(index) Arguments: - index (
number
) – None
Gets the position of the label at the given index.
Return type: Vec3 - index (
getLabelText
-
PartLabels.
getLabelText
(index) Arguments: - index (
number
) – None
Gets the text of the label at the given index.
Return type: string - index (
rayIntersect
-
PartLabels.
rayIntersect
(ray, hitItem) Arguments: - ray (
Ray
) – None - hitItem (
PartHitItem
) – None
Picking
Return type: boolean - ray (
setCustomDrawOntoCanvasCallback
-
PartLabels.
setCustomDrawOntoCanvasCallback
(callback) Arguments: - callback (
CustomDrawOntoCanvasCallback
) – None
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.
Return type: void - callback (
setLabelOffsetDirection
-
PartLabels.
setLabelOffsetDirection
(index, offsetDirection, flipTowardsEye) Arguments: - index (
number
) – None - offsetDirection (
Vec3
) – None - flipTowardsEye (
boolean
) – None
Sets the offset direction of the label at the given index.
Return type: void - index (
setLabelOffsetPosition
-
PartLabels.
setLabelOffsetPosition
(index, offsetPosition) Arguments: - index (
number
) – None - offsetPosition (
Vec3
) – None
Sets the offset position of the label at the given index.
Example: Move a label with the mouse
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); } }
Return type: void - index (
setLabelPosition
-
PartLabels.
setLabelPosition
(index, position) Arguments: - index (
number
) – None - position (
Vec3
) – None
Sets the position of the label at the given index.
Return type: void - index (
setLabelText
-
PartLabels.
setLabelText
(index, text) Arguments: - index (
number
) – None - text (
string
) – None
Sets the text of the label at the given index.
Return type: void - index (
setOccluderTriMesh
-
PartLabels.
setOccluderTriMesh
(labelIndex, vertices, indices[, options]) Arguments: - labelIndex (
number
) – None - vertices (
ArrayLike
) – None - indices (
ArrayLike
) – None - options (
OccluderOptions
) – optional None
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.
Return type: void - labelIndex (