Public Member Functions | Protected Attributes | Static Private Attributes

LibBoard::Text Struct Reference

A piece of text. More...

#include <Shapes.h>

Inheritance diagram for LibBoard::Text:
Inheritance graph
[legend]
Collaboration diagram for LibBoard::Text:
Collaboration graph
[legend]

Public Member Functions

 Text (double x, double y, const std::string &text, const Fonts::Font font, double size, Color color=Color::Black, int depthValue=-1)
 Text (double x, double y, const std::string &text, const Fonts::Font font, const std::string &svgFont, double size, Color color=Color::Black, int depthValue=-1)
const std::string & name () const
Point center () const
Textrotate (double angle, const Point &center)
Text rotated (double angle, const Point &center) const
Textrotate (double angle)
Text rotated (double angle) const
Texttranslate (double dx, double dy)
Text translated (double dx, double dy) const
Shapescale (double sx, double sy)
Shapescale (double s)
Text scaled (double sx, double sy) const
Text scaled (double s) const
void scaleAll (double s)
void flushPostscript (std::ostream &stream, const TransformEPS &transform) const
void flushFIG (std::ostream &stream, const TransformFIG &transform, std::map< Color, int > &colormap) const
void flushSVG (std::ostream &stream, const TransformSVG &transform) const
Rect boundingBox () const
Textclone () const

Protected Attributes

Point _position
std::string _text
Fonts::Font _font
std::string _svgFont
double _angle
double _size
double _xScale
double _yScale

Static Private Attributes

static const std::string _name

Detailed Description

A piece of text.

The text structure.


Constructor & Destructor Documentation

LibBoard::Text::Text ( double  x,
double  y,
const std::string &  text,
const Fonts::Font  font,
double  size,
Color  color = Color::Black,
int  depthValue = -1 
) [inline]

Create a Text sctucture.

Parameters:
x 
y 
text 
font 
size The font size expressed in 1/72 inches.
color 
depth 
Returns:

Referenced by clone(), rotated(), scaled(), and translated().

LibBoard::Text::Text ( double  x,
double  y,
const std::string &  text,
const Fonts::Font  font,
const std::string &  svgFont,
double  size,
Color  color = Color::Black,
int  depthValue = -1 
) [inline]

Create a Text sctucture.

Parameters:
x 
y 
text 
font 
svgFont The font family for an SVG file. (E.g. "Verdana, Arial" or "'Time New Roman', Serif" )
size The font size expressed in 1/72 inches.
color 
depth 
Returns:

Member Function Documentation

Rect LibBoard::Text::boundingBox (  )  const [virtual]

Returns the bounding box of the figure.

Returns:
The rectangle of the bounding box.

Implements LibBoard::Shape.

References _position, LibBoard::Point::x, and LibBoard::Point::y.

Point LibBoard::Text::center (  )  const [virtual]

Returns the gravity center of the shape.

Returns:
The center of the shape.

Implements LibBoard::Shape.

References _position.

Text * LibBoard::Text::clone (  )  const [virtual]

Return a copy of the shape.

Returns:

Implements LibBoard::Shape.

References Text().

void LibBoard::Text::flushFIG ( std::ostream &  stream,
const TransformFIG transform,
std::map< Color, int > &  colormap 
) const [virtual]

Writes the FIG code of the shape in a stream according to a transform.

Parameters:
stream The output stream.
transform A 2D transform to be applied.

Implements LibBoard::Shape.

References _angle, LibBoard::Shape::_depth, _font, LibBoard::Shape::_penColor, _position, _size, _text, LibBoard::TransformFIG::mapDepth(), LibBoard::Transform::mapX(), LibBoard::TransformFIG::mapY(), LibBoard::Point::x, and LibBoard::Point::y.

void LibBoard::Text::flushPostscript ( std::ostream &  stream,
const TransformEPS transform 
) const [virtual]

Writes the EPS code of the shape in a stream according to a transform.

Parameters:
stream The output stream.
transform A 2D transform to be applied.

Implements LibBoard::Shape.

References _angle, _font, LibBoard::Shape::_penColor, _position, _size, _text, LibBoard::Transform::mapX(), LibBoard::TransformEPS::mapY(), LibBoard::Color::postscript(), LibBoard::PSFontNames, LibBoard::Point::x, and LibBoard::Point::y.

void LibBoard::Text::flushSVG ( std::ostream &  stream,
const TransformSVG transform 
) const [virtual]

Writes the SVG code of the shape in a stream according to a transform.

Parameters:
stream The output stream.
transform A 2D transform to be applied.

Implements LibBoard::Shape.

References _angle, LibBoard::Shape::_fillColor, _font, LibBoard::Shape::_penColor, _position, _size, _svgFont, _text, LibBoard::Transform::mapX(), LibBoard::TransformSVG::mapY(), LibBoard::PSFontNames, LibBoard::Color::svg(), LibBoard::Color::svgAlpha(), LibBoard::Point::x, and LibBoard::Point::y.

const std::string & LibBoard::Text::name (  )  const [virtual]

Returns the generic name of the shape (e.g., Circle, Rectangle, etc.)

Returns:

Reimplemented from LibBoard::Shape.

References _name.

Text & LibBoard::Text::rotate ( double  angle  )  [virtual]

Rotate the shape around its center.

Parameters:
angle The rotation angle in radian.
Returns:
A reference to the shape itself.

Implements LibBoard::Shape.

References _angle, and M_PI.

Text & LibBoard::Text::rotate ( double  angle,
const Point center 
) [virtual]

Rotate the shape around a given center of rotation.

Parameters:
angle The rotation angle in radian.
center The center of rotation.
Returns:
A reference to the shape itself.

Implements LibBoard::Shape.

References _angle, _position, M_PI, LibBoard::Point::norm(), LibBoard::Point::rotate(), LibBoard::Point::x, and LibBoard::Point::y.

Text LibBoard::Text::rotated ( double  angle,
const Point center 
) const

References Text().

Text LibBoard::Text::rotated ( double  angle  )  const

References Text().

Shape & LibBoard::Text::scale ( double  sx,
double  sy 
) [virtual]

Scale the shape along the x an y axis.

Parameters:
sx The scale factor along the x axis.
sy The scale factor along the y axis.
Returns:
The shape itself.

Implements LibBoard::Shape.

References _xScale, and _yScale.

Shape & LibBoard::Text::scale ( double  s  )  [virtual]

Scale the shape along both axis.

Parameters:
s The scale factor along both axis.
Returns:
The shape itself.

Implements LibBoard::Shape.

References _xScale, and _yScale.

void LibBoard::Text::scaleAll ( double  s  )  [virtual]

Scales all the values (positions, dimensions, etc.) associated with the shape.

Parameters:
s The scaling factor.

Implements LibBoard::Shape.

References _position.

Text LibBoard::Text::scaled ( double  sx,
double  sy 
) const

References Text().

Text LibBoard::Text::scaled ( double  s  )  const

References Text().

Text & LibBoard::Text::translate ( double  dx,
double  dy 
) [virtual]

Translate the shape by a given offset.

Parameters:
dx The x offset.
dy The y offset.
Returns:
A reference to the shape itself.

Implements LibBoard::Shape.

References _position.

Text LibBoard::Text::translated ( double  dx,
double  dy 
) const

References Text().


Field Documentation

double LibBoard::Text::_angle [protected]

Referenced by flushFIG(), flushPostscript(), and flushSVG().

const std::string LibBoard::Text::_name [static, private]

The generic name of the shape.

Reimplemented from LibBoard::Shape.

Referenced by name().

double LibBoard::Text::_size [protected]

Referenced by flushFIG(), flushPostscript(), and flushSVG().

std::string LibBoard::Text::_svgFont [protected]

Referenced by flushSVG().

std::string LibBoard::Text::_text [protected]

Referenced by flushFIG(), flushPostscript(), and flushSVG().

double LibBoard::Text::_xScale [protected]

Referenced by scale().

double LibBoard::Text::_yScale [protected]

Referenced by scale().


The documentation for this struct was generated from the following files: