Public Member Functions | Protected Attributes | Static Private Attributes

LibBoard::Line Struct Reference

A line between two points. More...

#include <Shapes.h>

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

Public Member Functions

 Line (double x1, double y1, double x2, double y2, Color color, double lineWidth, const LineStyle style=SolidStyle, const LineCap cap=ButtCap, const LineJoin join=MiterJoin, int depth=-1)
const std::string & name () const
Point center () const
Linerotate (double angle, const Point &center)
Line rotated (double angle, const Point &center) const
Linerotate (double angle)
Line rotated (double angle) const
Linetranslate (double dx, double dy)
Line translated (double dx, double dy) const
Shapescale (double sx, double sy)
Shapescale (double s)
Line scaled (double sx, double sy) const
Line 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
Lineclone () const

Protected Attributes

double _x1
double _y1
double _x2
double _y2

Static Private Attributes

static const std::string _name

Detailed Description

A line between two points.

The line structure.


Constructor & Destructor Documentation

LibBoard::Line::Line ( double  x1,
double  y1,
double  x2,
double  y2,
Color  color,
double  lineWidth,
const LineStyle  style = SolidStyle,
const LineCap  cap = ButtCap,
const LineJoin  join = MiterJoin,
int  depth = -1 
) [inline]

Constructs a line.

Parameters:
x1 First coordinate of the start point.
y1 Second coordinate of the start point.
x2 First coordinate of the end point.
y2 Second coordinate of the end point.
color The color of the line.
lineWidth The line thickness.
depth The depth of the line.

Referenced by clone().


Member Function Documentation

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

Returns the bounding box of the figure.

Returns:
The rectangle of the bounding box.

Implements LibBoard::Shape.

References _x1, _x2, _y1, _y2, LibBoard::Rect::height, LibBoard::Rect::left, LibBoard::Rect::top, and LibBoard::Rect::width.

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

Returns the gravity center of the shape.

Returns:
The center of the shape.

Implements LibBoard::Shape.

References _x1, _x2, _y1, and _y2.

Referenced by rotate(), LibBoard::Arrow::rotated(), rotated(), scale(), LibBoard::Arrow::scaled(), and scaled().

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

Return a copy of the shape.

Returns:

Implements LibBoard::Shape.

Reimplemented in LibBoard::Arrow.

References Line().

void LibBoard::Line::flushFIG ( std::ostream &  stream,
const TransformFIG transform,
std::map< Color, int > &  colormap 
) const [virtual]
void LibBoard::Line::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.

Reimplemented in LibBoard::Arrow.

References LibBoard::Shape::_penColor, _x1, _x2, _y1, _y2, LibBoard::Transform::mapX(), LibBoard::TransformEPS::mapY(), LibBoard::Color::postscript(), and LibBoard::Shape::postscriptProperties().

void LibBoard::Line::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.

Reimplemented in LibBoard::Arrow.

References _x1, _x2, _y1, _y2, LibBoard::Transform::mapX(), LibBoard::TransformSVG::mapY(), and LibBoard::Shape::svgProperties().

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

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

Returns:

Reimplemented from LibBoard::Shape.

Reimplemented in LibBoard::Arrow.

References _name.

Line & LibBoard::Line::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 center(), and rotate().

Line & LibBoard::Line::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 _x1, _x2, _y1, _y2, and rotate().

Referenced by rotate().

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

Returns a copy of the line, rotated around a given rotation center.

Parameters:
angle The rotation angle.
center The center of rotation.
Returns:
The rotated copy of the line.

Reimplemented in LibBoard::Arrow.

References _x1, _x2, _y1, and _y2.

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

Returns a copy of the line, rotated around its center.

Parameters:
angle The angle of rotation.
Returns:
A copy of the lines, rotated around its center by the given angle.

Reimplemented in LibBoard::Arrow.

References _x1, _x2, _y1, _y2, and center().

Shape & LibBoard::Line::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 _x1, _x2, _y1, _y2, center(), translate(), LibBoard::Point::x, and LibBoard::Point::y.

Referenced by scale().

Shape & LibBoard::Line::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 scale().

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

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

Parameters:
s The scaling factor.

Implements LibBoard::Shape.

References _x1, _x2, _y1, and _y2.

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

Returns a scaled copy of the line.

Parameters:
sx Scale factor along the x axis.
sy Scale factor along the y axis.
Returns:
A scaled copy of the line.

Reimplemented in LibBoard::Arrow.

References _x1, _x2, _y1, _y2, center(), translate(), LibBoard::Point::x, and LibBoard::Point::y.

Referenced by scaled().

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

Reimplemented in LibBoard::Arrow.

References scaled().

Line & LibBoard::Line::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 _x1, _x2, _y1, and _y2.

Referenced by scale(), LibBoard::Arrow::scaled(), and scaled().

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

Returns a translated copy of the line.

Parameters:
dx The shift along the x axis.
dy The shift along the y axis.
Returns:
A translated copy of the line.

Reimplemented in LibBoard::Arrow.

References _x1, _x2, _y1, and _y2.


Field Documentation

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

The generic name of the shape.

Reimplemented from LibBoard::Shape.

Reimplemented in LibBoard::Arrow.

Referenced by name().

double LibBoard::Line::_x1 [protected]
double LibBoard::Line::_x2 [protected]
double LibBoard::Line::_y1 [protected]
double LibBoard::Line::_y2 [protected]

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