Chemical Data Processing Library C++ API - Version 1.1.1
|
A graphics primitive representing a text label. More...
#include <TextLabelPrimitive2D.hpp>
Public Types | |
typedef std::shared_ptr< TextLabelPrimitive2D > | SharedPointer |
A reference-counted smart pointer [SHPTR] for dynamically allocated TextLabelPrimitive2D instances. More... | |
Public Types inherited from CDPL::Vis::GraphicsPrimitive2D | |
typedef std::shared_ptr< GraphicsPrimitive2D > | SharedPointer |
A reference-counted smart pointer [SHPTR] for dynamically allocated GraphicsPrimitive2D instances. More... | |
Public Member Functions | |
TextLabelPrimitive2D () | |
Construct an empty text label primitive at position (0, 0). More... | |
void | render (Renderer2D &renderer) const |
Visualizes the graphics primitive by means of the Renderer2D instance renderer. More... | |
void | setText (const std::string &txt) |
Sets the text of the label. More... | |
const std::string & | getText () const |
Returns the text of the label. More... | |
void | setPosition (const Math::Vector2D &pos) |
Sets the position of the text label. More... | |
void | setPosition (double x, double y) |
Sets the position of the text label to (x, y). More... | |
const Math::Vector2D & | getPosition () const |
Returns the position of the text label. More... | |
void | setPen (const Pen &pen) |
Sets the pen defining the color of the text label. More... | |
const Pen & | getPen () const |
Returns the pen defining the color of the text label. More... | |
void | setFont (const Font &font) |
Sets the font of the text label. More... | |
const Font & | getFont () const |
Returns the font of the text label. More... | |
GraphicsPrimitive2D::SharedPointer | clone () const |
Creates a dynamically allocated copy of the graphics primitive. More... | |
void | getBounds (Rectangle2D &bounds, FontMetrics *font_metrics) const |
Calculates the bounds of the graphics primitive. More... | |
Public Member Functions inherited from CDPL::Vis::GraphicsPrimitive2D | |
virtual | ~GraphicsPrimitive2D () |
Virtual destructor. More... | |
A graphics primitive representing a text label.
typedef std::shared_ptr<TextLabelPrimitive2D> CDPL::Vis::TextLabelPrimitive2D::SharedPointer |
A reference-counted smart pointer [SHPTR] for dynamically allocated TextLabelPrimitive2D
instances.
CDPL::Vis::TextLabelPrimitive2D::TextLabelPrimitive2D | ( | ) |
Construct an empty text label primitive at position (0, 0).
|
virtual |
Visualizes the graphics primitive by means of the Renderer2D instance renderer.
renderer | The renderer that performs the drawing operations. |
Implements CDPL::Vis::GraphicsPrimitive2D.
void CDPL::Vis::TextLabelPrimitive2D::setText | ( | const std::string & | txt | ) |
Sets the text of the label.
txt | The text of the label. |
const std::string& CDPL::Vis::TextLabelPrimitive2D::getText | ( | ) | const |
Returns the text of the label.
void CDPL::Vis::TextLabelPrimitive2D::setPosition | ( | const Math::Vector2D & | pos | ) |
Sets the position of the text label.
pos | The baseline position of the text label. |
Sets the position of the text label to (x, y).
x | The x-position of the text label. |
y | The y-position of the baseline. |
const Math::Vector2D& CDPL::Vis::TextLabelPrimitive2D::getPosition | ( | ) | const |
Returns the position of the text label.
void CDPL::Vis::TextLabelPrimitive2D::setPen | ( | const Pen & | pen | ) |
Sets the pen defining the color of the text label.
pen | The pen defining the color of the text label. |
const Pen& CDPL::Vis::TextLabelPrimitive2D::getPen | ( | ) | const |
Returns the pen defining the color of the text label.
void CDPL::Vis::TextLabelPrimitive2D::setFont | ( | const Font & | font | ) |
Sets the font of the text label.
font | The font of the text label. |
const Font& CDPL::Vis::TextLabelPrimitive2D::getFont | ( | ) | const |
Returns the font of the text label.
|
virtual |
Creates a dynamically allocated copy of the graphics primitive.
Implements CDPL::Vis::GraphicsPrimitive2D.
|
virtual |
Calculates the bounds of the graphics primitive.
bounds | The object storing the calculated bounding box. |
font_metrics | The font metrics object to use for bounds calculation (if required). |
Implements CDPL::Vis::GraphicsPrimitive2D.