Board  0.6.devel
 All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Macros
LibBoard::Text Struct Reference

#include <Shapes.h>

Inheritance diagram for LibBoard::Text:
Collaboration diagram for LibBoard::Text:

Public Member Functions

 Text (double x, double y, const std::string &text, const Fonts::Font font, double size, DGtal::Color color=DGtal::Color::Black, int depthValue=-1)
 Text (double x, double y, const std::string &text, const Fonts::Font font, const std::string &svgFont, double size, DGtal::Color color=DGtal::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< DGtal::Color, int > &colormap) const
void flushSVG (std::ostream &stream, const TransformSVG &transform) const
void flushTikZ (std::ostream &stream, const TransformTikZ &transform) const
Rect boundingBox () const
Textclone () const
- Public Member Functions inherited from LibBoard::Shape
 Shape (DGtal::Color penColor, DGtal::Color fillColor, double lineWidth, LineStyle style, const LineCap cap, const LineJoin join, int depth)
virtual ~Shape ()
bool filled () const
ShaperotateDeg (double angle, const Point &center)
ShaperotateDeg (double angle)
Rect bbox ()
Shapeoperator-- ()
Shapeoperator++ ()
int depth () const
virtual void depth (int)
virtual void shiftDepth (int shift)
const DGtal::Color & penColor () const
const DGtal::Color & fillColor () const

Protected Attributes

Point _position
std::string _text
Fonts::Font _font
std::string _svgFont
double _angle
double _size
double _xScale
double _yScale
- Protected Attributes inherited from LibBoard::Shape
int _depth
DGtal::Color _penColor
DGtal::Color _fillColor
double _lineWidth
LineStyle _lineStyle
LineCap _lineCap
LineJoin _lineJoin

Static Private Attributes

static const std::string _name

Additional Inherited Members

- Public Types inherited from LibBoard::Shape
enum  LineCap { ButtCap = 0, RoundCap, SquareCap }
enum  LineJoin { MiterJoin = 0, RoundJoin, BevelJoin }
enum  LineStyle {
  SolidStyle = 0, DashStyle, DotStyle, DashDotStyle,
  DashDotDotStyle, DashDotDotDotStyle
}
- Protected Member Functions inherited from LibBoard::Shape
std::string svgProperties (const TransformSVG &transform) const
std::string postscriptProperties () const
std::string tikzProperties (const TransformTikZ &transform) const

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,
DGtal::Color  color = DGtal::Color::Black,
int  depthValue = -1 
)
inline

Create a Text sctucture.

Parameters:
x
y
text
font
sizeThe 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,
DGtal::Color  color = DGtal::Color::Black,
int  depthValue = -1 
)
inline

Create a Text sctucture.

Parameters:
x
y
text
font
svgFontThe font family for an SVG file. (E.g. "Verdana, Arial" or "'Time New Roman', Serif" )
sizeThe 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< DGtal::Color, int > &  colormap 
) const
virtual

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

Parameters:
streamThe output stream.
transformA 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:
streamThe output stream.
transformA 2D transform to be applied.

Implements LibBoard::Shape.

References _angle, _font, LibBoard::Shape::_penColor, _position, _size, _text, M_PI, LibBoard::Transform::mapX(), LibBoard::TransformEPS::mapY(), 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:
streamThe output stream.
transformA 2D transform to be applied.

Implements LibBoard::Shape.

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

void LibBoard::Text::flushTikZ ( std::ostream &  stream,
const TransformTikZ transform 
) const
virtual

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

Parameters:
streamThe output stream.
transformA 2D transform to be applied.

Implements LibBoard::Shape.

References _font, _position, _text, BOLD_FONT, ITALIC_FONT, LibBoard::Transform::mapX(), LibBoard::TransformSVG::mapY(), MONOSPACE_FONT, SANSSERIF_FONT, LibBoard::Shape::tikzProperties(), 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,
const Point center 
)
virtual

Rotate the shape around a given center of rotation.

Parameters:
angleThe rotation angle in radian.
centerThe 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::rotate ( double  angle)
virtual

Rotate the shape around its center.

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

Implements LibBoard::Shape.

References _angle, and M_PI.

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:
sxThe scale factor along the x axis.
syThe 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:
sThe 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:
sThe 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:
dxThe x offset.
dyThe 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
Fonts::Font LibBoard::Text::_font
protected
const std::string LibBoard::Text::_name
staticprivate

The generic name of the shape.

Reimplemented from LibBoard::Shape.

Referenced by name().

Point LibBoard::Text::_position
protected
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
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: