cee::vis::MarkupPartLabels
-
class
MarkupPartLabels
: public MarkupPart A MarkupModel part for drawing labels.
The part can contain any number of labels, but all labels will share the same settings for
- text color
- border color and draw border on/off
- background color and draw background on/off
The default label is a label with black text and border on a light yellow background (like a standard tooltip in most systems).
See also
Public Types
-
enum
LabelDrawMode
Enum specifying the way to draw the labels. Controls the visibility of the label.
Values:
-
enumerator
DRAW_ONLY_VISIBLE
Label is visible if the position of the label (position provided in the add()) is visible.
-
enumerator
DRAW_WITH_ZBUFFER_TEST
Draw the label as geometry with z buffer test.
-
enumerator
DRAW_WITHOUT_ZBUFFER_TEST
Draw the label without z buffer test. The label will always be visible.
-
enumerator
Public Functions
-
MarkupPartLabels
() Constructs an empty part.
-
MarkupPartLabels
(LabelDrawMode labelDrawMode, const Color3f &textColor, const Color3f &borderColor, const Color3f &backgroundColor) Constructs a part with the given settings.
-
MarkupPartLabels
(LabelDrawMode labelDrawMode, const Color3f &textColor, const Color3f &borderColor, const Color3f &backgroundColor, const Color3f &markerColor) Constructs a part with the given settings.
-
virtual PartType
type
() const Returns the type of the part. Always MarkupPart::LABELS.
-
virtual BoundingBox
boundingBox
() const Returns the current bounding box of the part.
-
virtual void
setPriority
(int priority) Sets render priority of the part.
The render priority determines the order in which parts get rendered. Parts with lower priorities get rendered first. The default priority is 100.
-
virtual int
priority
() const Returns the render priority of the part.
-
virtual const Mat4d &
transformation
() const Returns the current transformation matrix for the part.
-
virtual void
setTransformation
(const Mat4d &matrix) Sets the transformation matrix to use for the part.
-
void
setAbsoluteOffset
(int x, int y) Sets the absolute offset in pixels from the anchor point to the label.
Note! The marker is not affected by this offset
-
int
absoluteOffsetX
() const Returns the horizontal absolute offset in pixels from the anchor point to the label.
-
int
absoluteOffsetY
() const Returns the vertical absolute offset in pixels from the anchor point to the label.
-
void
setRelativeOffset
(double x, double y) Sets the normalized relative offset of the label size from the anchor point to the label.
Note! The marker is not affected by this offset
-
double
relativeOffsetX
() const Returns the normalized horizontal relative offset of the label width from the anchor point to the label.
-
double
relativeOffsetY
() const Returns the normalized vertical relative offset of the label height from the anchor point to the label.
-
LabelDrawMode
drawMode
() const Returns the current draw mode of the label.
See also
-
void
setDrawMode
(LabelDrawMode mode) Sets the current draw mode of the label.
-
Orientation
orientation
() const Sets the current orientation of the label.
See also
setDirection
-
void
setOrientation
(Orientation direction) Returns the current orientation of the label.
-
HorizontalTextAlignment
horizontalTextAlignment
() const Returns the horizontal alignment of the text used when drawing multiple lines.
-
void
setHorizontalTextAlignment
(HorizontalTextAlignment alignment) Sets the horizontal alignment of the text used when drawing multiple lines.
-
unsigned int
maximumNumberOfLabelsToDraw
() const Returns the maximum number of labels to draw in this part.
-
void
setMaximumNumberOfLabelsToDraw
(unsigned int maximumNumberToDraw) Sets the maximum number of labels to draw in the part.
The labels within the view volume will be sorted and the closest labels up to the given number will be drawn.-
-
float
eyeLiftFactor
() const Returns the eye lift factor of the labels.
See also
-
void
setEyeLiftFactor
(float factor) Sets the eye lift factor for the labels.
The eye lift factor specifies if the label should be moved towards the camera (or away from the camera if the factor is negative).
This is useful for controlling the ordering of items that are defined in the same plane.
-
void
setFont
(Font *labelFont) Sets the font to use for drawing the labels in the part.
Default is the normal built-in font (Font::createNormalFont())
-
float
borderWidth
() const Returns the line width of the border.
-
void
setBorderWidth
(float width) Sets the line width of the border.
-
float
markerPointSize
() const Returns the point size of the marker.
-
void
setMarkerPointSize
(float pointSize) Sets the point size of the marker.
-
bool
drawBackground
() const Returns true if the labels will be drawn with a filled background.
-
void
setDrawBackground
(bool drawBackground) Sets if the filled background of the labels should be drawn or not.
See also
-
bool
drawBorder
() const Returns true if the labels will be drawn with a border around the text.
-
void
setDrawBorder
(bool drawBorder) Sets if the labels will be drawn with a border around the text or not.
See also
-
bool
drawMarker
() const Returns true if the labels will be drawn with a marker at the label position.
-
void
setDrawMarker
(bool drawMarker) Sets if the labels will be drawn with a marker at the label position or not.
See also
-
bool
offsetLabelToFitInView
() const Returns true if the labels will be adjusted so the label would be fully visible in the attachment point is visible.
-
void
setOffsetLabelToFitInView
(bool offsetLabel) Sets if the labels will be adjusted so the label would be fully visible in the attachment point is visible.
If enabled, the label will be moved to the left or bottom of the attachment point if needed to keep the label fully visible.
-
size_t
count
() const Returns the number of labels in the part.
-
const cee::Vec3d &
position
(size_t index) const Returns the position of the label at the given index.
-
unsigned int
width
(size_t index) Returns the width of the drawn label in pixels.
-
unsigned int
height
(size_t index) Returns the height of the drawn label in pixels.
-
size_t
add
(const Vec3d &position, const Str &text) Adds a label to the part with the given text and position.
-
void
set
(size_t index, const Vec3d &position, const Str &text) Sets the text and position of the label at the given index.
-
void
remove
(size_t index) Removes the label at the given index.
-
void
removeAll
() Removes all labels in the part.
Public Static Functions
-
static PtrRef<MarkupPartLabels>
create
(const Vec3d &position, const Str &text, LabelDrawMode drawMode = DRAW_WITHOUT_ZBUFFER_TEST) Returns a newly created part with the given settings.
The returned part will have the specified draw mode and have one label with the given position and text.
-
static PtrRef<MarkupPartLabels>
createWithMarker
(const Vec3d &position, const Str &text, const Color3f &markerColor, LabelDrawMode drawMode = DRAW_WITHOUT_ZBUFFER_TEST) Returns a newly created part with the given settings.
The returned part will have the specified draw mode and have one label with the given position and text.