Class Label

Class Documentation

class Label

Manages the state of a text label.

Public Functions

Label(const std::string &text, const vec3d &position)

Constructs a Label object.

Parameters:
  • text[in] – Text to display

  • position[in] – Set 3D position of label as x,y,z coordinates of type double

Label(const std::string &text, float x, float y, bool align_right = false, bool align_top = false)

Sets the 2D position of the lavel.

Parameters:
  • text[in]Label text to display

  • x[in] – horizontal position [0, 1]

  • y[in] – vertical position [0, 1]

  • align_right[in] – interpret position as right of the label

  • align_top[in] – interpret position as top of the label

void update_from(const Label &other)

Updates this label’s state with the state of other, accounting for prior changes to this objects’s state.

Parameters:

other[in] – the object to update the state from.

void clear()

Clear dirty flags.

Resets any changes since the last call to PointViz::update()

void dirty()

Set all dirty flags.

Re-sets everything so the object is always redrawn.

void set_text(const std::string &text)

Update label text.

Parameters:

text[in] – new text to display

void set_position(const vec3d &position)

Set label position.

Parameters:

position[in] – 3d position of the label

void set_position(float x, float y, bool align_right = false, bool align_top = false)

Set position of the 2D label.

Parameters:
  • x[in] – horizontal position [0, 1]

  • y[in] – vertical position [0, 1]

  • align_right[in] – interpret position as right of the label

  • align_top[in] – interpret position as top of the label

void set_scale(float scale)

Set scaling factor of the label.

Parameters:

scale[in] – text scaling factor

void set_rgba(const vec4f &rgba)

Set the color of the label.

Parameters:

rgba[in] – color in RGBA format

float get_text_height() const

Get the text height of the label.

Returns:

height of text

Friends

friend class impl::GLLabel