# LibBoard::Rectangle Struct Reference

A rectangle. More...

`#include <Shapes.h>`

Inheritance diagram for LibBoard::Rectangle:

List of all members.

## Public Member Functions

| Rectangle (double x, double y, double width, double height, Color penColor, Color fillColor, double lineWidth, const LineStyle style=SolidStyle, const LineCap cap=ButtCap, const LineJoin join=MiterJoin, int depth=-1)
| Rectangle (const Rect &rect, Color penColor, Color fillColor, double lineWidth, const LineStyle style=SolidStyle, const LineCap cap=ButtCap, const LineJoin join=MiterJoin, int depth=-1)
const std::string & | name () const
double | x () const
double | y () const
double | width ()
double | height ()
Point | topLeft ()
Point | topRight ()
Point | bottomLeft ()
Point | bottomRight ()
Rectangle | rotated (double angle, const Point &center) const
Rectangle | rotated (double angle) const
Rectangle | translated (double dx, double dy) const
Rectangle | scaled (double sx, double sy) const
Rectangle | scaled (double s) const
void | scaleAll (double s)
void | flushFIG (std::ostream &stream, const TransformFIG &transform, std::map< Color, int > &colormap) const
void | flushSVG (std::ostream &stream, const TransformSVG &transform) const
Rectangle * | clone () const

## Protected Attributes

bool | _isRectangle

## Detailed Description

A rectangle.

The rectangle structure.

Examples:

  examples/arrows.cpp, examples/ellipse.cpp, examples/example4.cpp, and examples/ruler.cpp.

## Member Function Documentation

Rectangle * LibBoard::Rectangle::clone | ( |  | ) | const`[virtual]`

Return a copy of the shape.

Returns:

Reimplemented from LibBoard::Polyline.

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

Reimplemented from LibBoard::Polyline.

References LibBoard::Shape::_depth, LibBoard::Shape::_fillColor, LibBoard::Shape::_lineCap, LibBoard::Shape::_lineJoin, LibBoard::Shape::_lineStyle, LibBoard::Shape::_lineWidth, LibBoard::Shape::_penColor, and LibBoard::Shape::filled().

Referenced by LibBoard::Board::saveFIG().

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

Reimplemented from LibBoard::Polyline.

References LibBoard::Shape::svgProperties().

Referenced by LibBoard::Board::saveSVG().

const std::string & LibBoard::Rectangle::name | ( |  | ) | const`[virtual]`

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

Returns:

Reimplemented from LibBoard::Polyline.

Rectangle LibBoard::Rectangle::rotated | ( | double | angle | ) | const

Returns a copy of the arrow, 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 from LibBoard::Polyline.

References LibBoard::Polyline::center().

Rectangle LibBoard::Rectangle::rotated | ( | double | angle,
|  | const Point & | center |
| ) |  |  | const

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

Parameters:

  | angle | The rotation angle.
  | center | The center of rotation.

Returns:
  The rotated copy of the line.

Reimplemented from LibBoard::Polyline.

Examples:
  examples/example4.cpp.

void LibBoard::Rectangle::scaleAll | ( | double | s | ) | `[virtual]`

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

Parameters:

  | s | The scaling factor.

Reimplemented from LibBoard::Polyline.

References LibBoard::Path::scaleAll().

Rectangle LibBoard::Rectangle::scaled | ( | double | sx,
|  | double | sy |
| ) |  |  | const

Returns a scaled copy of the arrow.

Parameters:

  | sx | Scale factor along the x axis.
  | sy | Scale factor along the y axis.

Returns:
  A scaled copy of the arrow.

Reimplemented from LibBoard::Polyline.

Rectangle LibBoard::Rectangle::translated | ( | double | dx,
|  | double | dy |
| ) |  |  | const

Returns a translated copy of the arrow.

Parameters:

  | dx | The shift along the x axis.
  | dy | The shift along the y axis.

Returns:
  A translated copy of the line.

Reimplemented from LibBoard::Polyline.

Examples:
  examples/example4.cpp.

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

- include/board/Shapes.h
- src/Shapes.cpp