#include <Shapes.h>
Public Types | |
enum | LineCap { ButtCap = 0, RoundCap, SquareCap } |
enum | LineJoin { MiterJoin = 0, RoundJoin, BevelJoin } |
Public Member Functions | |
Shape (Color penColor, Color fillColor, float lineWidth, const LineCap cap, const LineJoin join, int depth) | |
virtual | ~Shape () |
virtual const std::string & | name () const |
virtual Shape * | clone () const =0 |
bool | filled () const |
virtual Point | center () const =0 |
virtual Shape & | rotate (double angle, const Point ¢er)=0 |
virtual Shape & | rotate (double angle)=0 |
Shape & | rotateDeg (double angle, const Point ¢er) |
Shape & | rotateDeg (double angle) |
virtual Shape & | translate (double dx, double dy)=0 |
virtual Shape & | scale (double sx, double sy)=0 |
virtual Shape & | scale (double s)=0 |
virtual Rect | boundingBox () const =0 |
Rect | bbox () |
Shape & | operator-- () |
Shape & | operator++ () |
virtual void | scaleAll (double s)=0 |
virtual void | flushPostscript (std::ostream &stream, const TransformEPS &transform) const =0 |
virtual void | flushFIG (std::ostream &stream, const TransformFIG &transform, std::map< Color, int > &colormap) const =0 |
virtual void | flushSVG (std::ostream &stream, const TransformSVG &transform) const =0 |
int | depth () const |
virtual void | depth (int) |
virtual void | shiftDepth (int shift) |
const Color & | penColor () const |
const Color & | fillColor () const |
Protected Member Functions | |
std::string | svgProperties (const TransformSVG &transform) const |
std::string | postscriptProperties () const |
Protected Attributes | |
int | _depth |
Color | _penColor |
Color | _fillColor |
float | _lineWidth |
LineCap | _lineCap |
LineJoin | _lineJoin |
Shape structure.
LibBoard::Shape::Shape | ( | Color | penColor, | |
Color | fillColor, | |||
float | lineWidth, | |||
const LineCap | cap, | |||
const LineJoin | join, | |||
int | depth | |||
) | [inline] |
Shape constructor.
penColor | The pen color of the shape. | |
fillColor | The fill color of the shape. | |
lineWidth | The line thickness. | |
depth | The depth of the shape. |
virtual LibBoard::Shape::~Shape | ( | ) | [inline, virtual] |
Shape destructor.
const std::string & LibBoard::Shape::name | ( | ) | const [virtual] |
Returns the generic name of the shape (e.g., Circle, Rectangle, etc.)
Reimplemented in LibBoard::ShapeList, LibBoard::Group, LibBoard::Dot, LibBoard::Line, LibBoard::Arrow, LibBoard::Polyline, LibBoard::Rectangle, LibBoard::Triangle, LibBoard::GouraudTriangle, LibBoard::Ellipse, LibBoard::Circle, and LibBoard::Text.
virtual Shape* LibBoard::Shape::clone | ( | ) | const [pure virtual] |
Return a copy of the shape.
Implemented in LibBoard::ShapeList, LibBoard::Group, LibBoard::Dot, LibBoard::Line, LibBoard::Arrow, LibBoard::Polyline, LibBoard::Rectangle, LibBoard::Triangle, LibBoard::GouraudTriangle, LibBoard::Ellipse, LibBoard::Circle, and LibBoard::Text.
Referenced by LibBoard::Board::addDuplicates(), LibBoard::ShapeList::operator+=(), and LibBoard::ShapeList::operator<<().
bool LibBoard::Shape::filled | ( | ) | const [inline] |
Checks whether a shape is filled with a color or not.
References _fillColor.
Referenced by LibBoard::Rectangle::flushFIG(), LibBoard::Polyline::flushFIG(), LibBoard::Ellipse::flushFIG(), LibBoard::Arrow::flushFIG(), LibBoard::Polyline::flushPostscript(), LibBoard::Ellipse::flushPostscript(), and LibBoard::Arrow::flushPostscript().
virtual Point LibBoard::Shape::center | ( | ) | const [pure virtual] |
Returns the gravity center of the shape.
Implemented in LibBoard::ShapeList, LibBoard::Dot, LibBoard::Line, LibBoard::Polyline, LibBoard::GouraudTriangle, LibBoard::Ellipse, LibBoard::Circle, and LibBoard::Text.
Referenced by rotateDeg().
Rotate the shape around a given center of rotation.
angle | The rotation angle in radian. | |
center | The center of rotation. |
Implemented in LibBoard::ShapeList, LibBoard::Dot, LibBoard::Line, LibBoard::Polyline, LibBoard::GouraudTriangle, LibBoard::Ellipse, LibBoard::Circle, and LibBoard::Text.
Referenced by LibBoard::Line::rotate(), LibBoard::Dot::rotate(), rotateDeg(), and LibBoard::Ellipse::scale().
virtual Shape& LibBoard::Shape::rotate | ( | double | angle | ) | [pure virtual] |
Rotate the shape around its center.
angle | The rotation angle in radian. |
Implemented in LibBoard::ShapeList, LibBoard::Dot, LibBoard::Line, LibBoard::Polyline, LibBoard::GouraudTriangle, LibBoard::Ellipse, LibBoard::Circle, and LibBoard::Text.
Rotate the shape around a given center of rotation.
angle | The rotation angle in degree. | |
center | The center of rotation. |
References rotate().
Shape & LibBoard::Shape::rotateDeg | ( | double | angle | ) | [inline] |
virtual Shape& LibBoard::Shape::translate | ( | double | dx, | |
double | dy | |||
) | [pure virtual] |
Translate the shape by a given offset.
dx | The x offset. | |
dy | The y offset. |
Implemented in LibBoard::ShapeList, LibBoard::Dot, LibBoard::Line, LibBoard::Polyline, LibBoard::Ellipse, LibBoard::Circle, and LibBoard::Text.
Referenced by LibBoard::Board::addDuplicates().
virtual Shape& LibBoard::Shape::scale | ( | double | sx, | |
double | sy | |||
) | [pure virtual] |
Scale the shape along the x an y axis.
sx | The scale factor along the x axis. | |
sy | The scale factor along the y axis. |
Implemented in LibBoard::ShapeList, LibBoard::Dot, LibBoard::Line, LibBoard::Polyline, LibBoard::Ellipse, LibBoard::Circle, and LibBoard::Text.
virtual Shape& LibBoard::Shape::scale | ( | double | s | ) | [pure virtual] |
Scale the shape along both axis.
s | The scale factor along both axis. |
Implemented in LibBoard::ShapeList, LibBoard::Dot, LibBoard::Line, LibBoard::Polyline, LibBoard::Ellipse, LibBoard::Circle, and LibBoard::Text.
virtual Rect LibBoard::Shape::boundingBox | ( | ) | const [pure virtual] |
Returns the bounding box of the figure.
Implemented in LibBoard::ShapeList, LibBoard::Dot, LibBoard::Line, LibBoard::Polyline, LibBoard::Ellipse, and LibBoard::Text.
Referenced by bbox().
Rect LibBoard::Shape::bbox | ( | ) | [inline] |
Returns the bounding box of the figure. (Convenience method to call "boundingBox" with a short name.)
References boundingBox().
Referenced by LibBoard::Board::drawBoundingBox(), LibBoard::Group::flushFIG(), LibBoard::Board::saveEPS(), LibBoard::Board::saveFIG(), and LibBoard::Board::saveSVG().
Shape & LibBoard::Shape::operator-- | ( | ) | [inline] |
Decrement the depth of the shape. (Pull the shape toward the foreground.)
References _depth.
Shape & LibBoard::Shape::operator++ | ( | ) | [inline] |
Increment the depth of the shape. (Push the shape toward the background.)
References _depth.
virtual void LibBoard::Shape::scaleAll | ( | double | s | ) | [pure virtual] |
Scales all the values (positions, dimensions, etc.) associated with the shape.
s | The scaling factor. |
Implemented in LibBoard::ShapeList, LibBoard::Dot, LibBoard::Line, LibBoard::Polyline, LibBoard::Rectangle, LibBoard::GouraudTriangle, LibBoard::Ellipse, LibBoard::Circle, and LibBoard::Text.
virtual void LibBoard::Shape::flushPostscript | ( | std::ostream & | stream, | |
const TransformEPS & | transform | |||
) | const [pure virtual] |
Writes the EPS code of the shape in a stream according to a transform.
stream | The output stream. | |
transform | A 2D transform to be applied. |
Implemented in LibBoard::ShapeList, LibBoard::Group, LibBoard::Dot, LibBoard::Line, LibBoard::Arrow, LibBoard::Polyline, LibBoard::GouraudTriangle, LibBoard::Ellipse, and LibBoard::Text.
virtual void LibBoard::Shape::flushFIG | ( | std::ostream & | stream, | |
const TransformFIG & | transform, | |||
std::map< Color, int > & | colormap | |||
) | const [pure virtual] |
Writes the FIG code of the shape in a stream according to a transform.
stream | The output stream. | |
transform | A 2D transform to be applied. |
Implemented in LibBoard::ShapeList, LibBoard::Group, LibBoard::Dot, LibBoard::Line, LibBoard::Arrow, LibBoard::Polyline, LibBoard::Rectangle, LibBoard::GouraudTriangle, LibBoard::Ellipse, and LibBoard::Text.
virtual void LibBoard::Shape::flushSVG | ( | std::ostream & | stream, | |
const TransformSVG & | transform | |||
) | const [pure virtual] |
Writes the SVG code of the shape in a stream according to a transform.
stream | The output stream. | |
transform | A 2D transform to be applied. |
Implemented in LibBoard::ShapeList, LibBoard::Group, LibBoard::Dot, LibBoard::Line, LibBoard::Arrow, LibBoard::Polyline, LibBoard::Rectangle, LibBoard::GouraudTriangle, LibBoard::Ellipse, LibBoard::Circle, and LibBoard::Text.
std::string LibBoard::Shape::svgProperties | ( | const TransformSVG & | transform | ) | const [protected] |
Return a string of the svg properties lineWidth, opacity, penColor, fillColor, lineCap, and lineJoin.
References _fillColor, _lineCap, _lineJoin, _lineWidth, _penColor, LibBoard::TransformSVG::mapWidth(), LibBoard::Color::svg(), and LibBoard::Color::svgAlpha().
Referenced by LibBoard::Rectangle::flushSVG(), LibBoard::Polyline::flushSVG(), LibBoard::Circle::flushSVG(), LibBoard::Ellipse::flushSVG(), LibBoard::Line::flushSVG(), and LibBoard::Dot::flushSVG().
std::string LibBoard::Shape::postscriptProperties | ( | ) | const [protected] |
Return a string of the properties lineWidth, penColor, lineCap, and lineJoin as Postscript commands.
References _lineCap, _lineJoin, and _lineWidth.
Referenced by LibBoard::Polyline::flushPostscript(), LibBoard::Ellipse::flushPostscript(), LibBoard::Arrow::flushPostscript(), LibBoard::Line::flushPostscript(), and LibBoard::Dot::flushPostscript().
int LibBoard::Shape::_depth [protected] |
The depth of the shape.
Referenced by LibBoard::Text::flushFIG(), LibBoard::Rectangle::flushFIG(), LibBoard::Polyline::flushFIG(), LibBoard::Ellipse::flushFIG(), LibBoard::Arrow::flushFIG(), LibBoard::Line::flushFIG(), LibBoard::Dot::flushFIG(), LibBoard::GouraudTriangle::flushPostscript(), LibBoard::GouraudTriangle::flushSVG(), operator++(), and operator--().
Color LibBoard::Shape::_penColor [protected] |
The color of the shape.
Referenced by LibBoard::Text::flushFIG(), LibBoard::Rectangle::flushFIG(), LibBoard::Polyline::flushFIG(), LibBoard::Ellipse::flushFIG(), LibBoard::Arrow::flushFIG(), LibBoard::Line::flushFIG(), LibBoard::Dot::flushFIG(), LibBoard::Text::flushPostscript(), LibBoard::Polyline::flushPostscript(), LibBoard::Ellipse::flushPostscript(), LibBoard::Arrow::flushPostscript(), LibBoard::Line::flushPostscript(), LibBoard::Dot::flushPostscript(), LibBoard::Text::flushSVG(), LibBoard::Arrow::flushSVG(), and svgProperties().
Color LibBoard::Shape::_fillColor [protected] |
float LibBoard::Shape::_lineWidth [protected] |
The line thickness.
Referenced by LibBoard::Rectangle::flushFIG(), LibBoard::Polyline::flushFIG(), LibBoard::Ellipse::flushFIG(), LibBoard::Arrow::flushFIG(), LibBoard::Line::flushFIG(), LibBoard::Dot::flushFIG(), LibBoard::Polyline::flushPostscript(), LibBoard::Arrow::flushPostscript(), LibBoard::Arrow::flushSVG(), postscriptProperties(), and svgProperties().
LineCap LibBoard::Shape::_lineCap [protected] |
The linecap attribute. (The way line terminates.)
Referenced by LibBoard::Rectangle::flushFIG(), LibBoard::Polyline::flushFIG(), LibBoard::Arrow::flushFIG(), LibBoard::Line::flushFIG(), LibBoard::Dot::flushFIG(), LibBoard::Polyline::flushPostscript(), postscriptProperties(), and svgProperties().
LineJoin LibBoard::Shape::_lineJoin [protected] |
The linejoin attribute. (The shape of line junctions.)
Referenced by LibBoard::Rectangle::flushFIG(), LibBoard::Polyline::flushFIG(), LibBoard::Arrow::flushFIG(), LibBoard::Line::flushFIG(), LibBoard::Dot::flushFIG(), LibBoard::Polyline::flushPostscript(), postscriptProperties(), and svgProperties().