PartLabels
-
class
cee.mrk.PartLabels() Defines positioned text labels that can be shown in a
MarkupModel.Use
MarkupModel.addLabelsPartto create a new instance of this class.Some examples of different label styles:
Index
Accessors
Methods
addaddWithOffsetDirectionaddWithOffsetDirectionFlipTowardEyeaddWithOffsetPositiondeleteAlldeleteLabelAtgetLabelOffsetDirectiongetLabelOffsetPositiongetLabelPositiongetLabelTextrayIntersectsetCustomDrawOntoCanvasCallbacksetLabelOffsetDirectionsetLabelOffsetPositionsetLabelPositionsetLabelTextsetOccluderTriMesh
Accessors
-
cee.mrk.PartLabels.attachmentAppearance() - get attachmentAppearance():
LabelAttachmentAppearanceReturns an active reference to the attachment appearance settings for this part.
Returns:
LabelAttachmentAppearance
-
cee.mrk.PartLabels.customData() inherited
get customData(): anyCustom data for the part. This field is not used by EnvisionWeb.
Returns: any
set customData(data: any): voidParameters
data: anyReturns: void
-
cee.mrk.PartLabels.drawMode() - get drawMode():
LabelDrawModeDraw mode for the labels in this part
Returns:
LabelDrawModeset drawMode(mode:LabelDrawMode): voidParameters
mode:LabelDrawModeReturns: void
-
cee.mrk.PartLabels.labelAppearance() - get labelAppearance():
LabelAppearanceReturns an active reference to the appearance settings for the labels in this part.
Returns:
LabelAppearance
-
cee.mrk.PartLabels.labelAttachmentPoint() - get labelAttachmentPoint():
LabelAttachmentPointPoint where the attachment line meets the label
Returns:
LabelAttachmentPointset labelAttachmentPoint(attachmentPoint:LabelAttachmentPoint): voidParameters
attachmentPoint:LabelAttachmentPointReturns: void
-
cee.mrk.PartLabels.labelCount() - get labelCount(): number
The number of labels in the part.
Returns: number
Methods
-
cee.mrk.PartLabels.add() - add(text: string, pos:
Vec3): numberAdds the given text to the part, placing it at the given position. Returns the index of the new label.
Parameters
text: string
pos:
Vec3Returns: number
-
cee.mrk.PartLabels.addWithOffsetDirection() -
Adds text label with offset direction. Returns the index of the new label.
Parameters
Returns: number
-
cee.mrk.PartLabels.addWithOffsetDirectionFlipTowardEye() -
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
Returns: number
-
cee.mrk.PartLabels.addWithOffsetPosition() -
Adds text label with offset position. Returns the index of the new label.
Parameters
Returns: number
-
cee.mrk.PartLabels.deleteAll() - deleteAll(): void
Deletes all text labels from the part.
Returns: void
-
cee.mrk.PartLabels.deleteLabelAt() - deleteLabelAt(index: number): void
Deletes the text label at the given index.
Parameters
index: numberReturns: void
-
cee.mrk.PartLabels.getLabelOffsetDirection() - getLabelOffsetDirection(index: number):
Vec3Gets the offset direction of the label at the given index.
Parameters
index: numberReturns:
Vec3
-
cee.mrk.PartLabels.getLabelOffsetPosition() - getLabelOffsetPosition(index: number):
Vec3Gets the offset position of the label at the given index.
Parameters
index: numberReturns:
Vec3
-
cee.mrk.PartLabels.getLabelPosition() - getLabelPosition(index: number):
Vec3Gets the position of the label at the given index.
Parameters
index: numberReturns:
Vec3
-
cee.mrk.PartLabels.getLabelText() - getLabelText(index: number): string
Gets the text of the label at the given index.
Parameters
index: numberReturns: string
-
cee.mrk.PartLabels.rayIntersect() - rayIntersect(ray:
Ray, hitItem:PartHitItem): booleanPicking
Parameters
ray:
RayhitItem:
PartHitItemReturns: boolean
-
cee.mrk.PartLabels.setCustomDrawOntoCanvasCallback() - setCustomDrawOntoCanvasCallback(callback:
CustomDrawOntoCanvasCallback): voidSpecify 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:CustomDrawOntoCanvasCallbackReturns: void
-
cee.mrk.PartLabels.setLabelOffsetDirection() - setLabelOffsetDirection(index: number, offsetDirection:
Vec3, flipTowardsEye: boolean): voidSets the offset direction of the label at the given index.
Parameters
Returns: void
-
cee.mrk.PartLabels.setLabelOffsetPosition() - setLabelOffsetPosition(index: number, offsetPosition:
Vec3): voidSets 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); } }
Parameters
index: number
offsetPosition:
Vec3Returns: void
-
cee.mrk.PartLabels.setLabelPosition() - setLabelPosition(index: number, position:
Vec3): voidSets the position of the label at the given index.
Parameters
index: number
position:
Vec3Returns: void
-
cee.mrk.PartLabels.setLabelText() - setLabelText(index: number, text: string): void
Sets the text of the label at the given index.
Parameters
index: number
text: string
Returns: void
-
cee.mrk.PartLabels.setOccluderTriMesh() - setOccluderTriMesh(labelIndex: number, vertices: ArrayLike, indices: ArrayLike, options:
OccluderOptions): voidSets 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
Returns: void