Chemical Data Processing Library C++ API - Version 1.1.1
Public Types | Public Member Functions | List of all members
CDPL::Vis::TextLabelPrimitive2D Class Reference

A graphics primitive representing a text label. More...

#include <TextLabelPrimitive2D.hpp>

+ Inheritance diagram for CDPL::Vis::TextLabelPrimitive2D:

Public Types

typedef std::shared_ptr< TextLabelPrimitive2DSharedPointer
 A reference-counted smart pointer [SHPTR] for dynamically allocated TextLabelPrimitive2D instances. More...
 
- Public Types inherited from CDPL::Vis::GraphicsPrimitive2D
typedef std::shared_ptr< GraphicsPrimitive2DSharedPointer
 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::Vector2DgetPosition () 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 PengetPen () 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 FontgetFont () 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...
 

Detailed Description

A graphics primitive representing a text label.

Member Typedef Documentation

◆ SharedPointer

A reference-counted smart pointer [SHPTR] for dynamically allocated TextLabelPrimitive2D instances.

Constructor & Destructor Documentation

◆ TextLabelPrimitive2D()

CDPL::Vis::TextLabelPrimitive2D::TextLabelPrimitive2D ( )

Construct an empty text label primitive at position (0, 0).

Member Function Documentation

◆ render()

void CDPL::Vis::TextLabelPrimitive2D::render ( Renderer2D renderer) const
virtual

Visualizes the graphics primitive by means of the Renderer2D instance renderer.

Parameters
rendererThe renderer that performs the drawing operations.

Implements CDPL::Vis::GraphicsPrimitive2D.

◆ setText()

void CDPL::Vis::TextLabelPrimitive2D::setText ( const std::string &  txt)

Sets the text of the label.

Parameters
txtThe text of the label.

◆ getText()

const std::string& CDPL::Vis::TextLabelPrimitive2D::getText ( ) const

Returns the text of the label.

Returns
The text of the label.

◆ setPosition() [1/2]

void CDPL::Vis::TextLabelPrimitive2D::setPosition ( const Math::Vector2D pos)

Sets the position of the text label.

Parameters
posThe baseline position of the text label.

◆ setPosition() [2/2]

void CDPL::Vis::TextLabelPrimitive2D::setPosition ( double  x,
double  y 
)

Sets the position of the text label to (x, y).

Parameters
xThe x-position of the text label.
yThe y-position of the baseline.

◆ getPosition()

const Math::Vector2D& CDPL::Vis::TextLabelPrimitive2D::getPosition ( ) const

Returns the position of the text label.

Returns
The position of the text label.

◆ setPen()

void CDPL::Vis::TextLabelPrimitive2D::setPen ( const Pen pen)

Sets the pen defining the color of the text label.

Parameters
penThe pen defining the color of the text label.

◆ getPen()

const Pen& CDPL::Vis::TextLabelPrimitive2D::getPen ( ) const

Returns the pen defining the color of the text label.

Returns
The pen defining the color of the text label.

◆ setFont()

void CDPL::Vis::TextLabelPrimitive2D::setFont ( const Font font)

Sets the font of the text label.

Parameters
fontThe font of the text label.

◆ getFont()

const Font& CDPL::Vis::TextLabelPrimitive2D::getFont ( ) const

Returns the font of the text label.

Returns
The font of the text label.

◆ clone()

GraphicsPrimitive2D::SharedPointer CDPL::Vis::TextLabelPrimitive2D::clone ( ) const
virtual

Creates a dynamically allocated copy of the graphics primitive.

Returns
The copy of the graphics primitive.

Implements CDPL::Vis::GraphicsPrimitive2D.

◆ getBounds()

void CDPL::Vis::TextLabelPrimitive2D::getBounds ( Rectangle2D bounds,
FontMetrics font_metrics 
) const
virtual

Calculates the bounds of the graphics primitive.

Parameters
boundsThe object storing the calculated bounding box.
font_metricsThe font metrics object to use for bounds calculation (if required).

Implements CDPL::Vis::GraphicsPrimitive2D.


The documentation for this class was generated from the following file: