Board
0.9.5
|
Abstract structure for a 2D shape. More...
#include <Shape.h>
Public Member Functions | |
Shape () | |
virtual | ~Shape () |
virtual const std::string & | name () const |
virtual Shape * | clone () const =0 |
virtual Point | center (LineWidthFlag lineWidthFlag=IgnoreLineWidth) const |
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 |
Shape & | moveCenter (double x, double y, LineWidthFlag lineWidthFlag=IgnoreLineWidth) |
Shape & | moveCenter (Point p, LineWidthFlag lineWidthFlag=IgnoreLineWidth) |
virtual Shape & | scale (double sx, double sy)=0 |
virtual Shape & | scale (double s)=0 |
Shape & | resize (double width, double height, LineWidthFlag lineWidthFlag) |
Shape & | scaleToWidth (double w, LineWidthFlag lineWidthFlag) |
Shape & | scaleToHeight (double h, LineWidthFlag lineWidthFlag) |
virtual Rect | boundingBox (LineWidthFlag) const =0 |
Rect | bbox (LineWidthFlag) const |
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 |
virtual void | flushTikZ (std::ostream &stream, const TransformTikZ &transform) const =0 |
virtual void | accept (ShapeVisitor &visitor) |
Accepts a visitor object. More... | |
virtual void | accept (const ShapeVisitor &visitor) |
Accepts a visitor object. More... | |
virtual void | accept (ConstShapeVisitor &visitor) const |
Accepts a const-shape visitor object. More... | |
virtual void | accept (const ConstShapeVisitor &visitor) const |
Accepts a const-shape visitor object. More... | |
virtual Shape * | accept (CompositeShapeTransform &transform) const |
Accept a composite shape transform. More... | |
virtual Shape * | accept (const CompositeShapeTransform &transform) const |
Accept a constant composite shape transform. More... | |
Shape (const Shape &other) | |
|
inline |
Shape constructor.
|
virtual |
Shape destructor.
|
virtual |
Accept a composite shape transform.
transform | A composite shape transform object. |
Reimplemented in LibBoard::ShapeList, LibBoard::Bezier, LibBoard::Image, LibBoard::Line, LibBoard::Polyline, LibBoard::Arrow, LibBoard::Text, LibBoard::Ellipse, LibBoard::Dot, and LibBoard::Group.
|
virtual |
Accept a constant composite shape transform.
transform | A constant composite shape transform object.. |
Reimplemented in LibBoard::ShapeList, LibBoard::Bezier, LibBoard::Image, LibBoard::Line, LibBoard::Polyline, LibBoard::Arrow, LibBoard::Text, LibBoard::Ellipse, LibBoard::Dot, and LibBoard::Group.
|
virtual |
Accepts a const-shape visitor object.
visitor | A const-shape visitor object. |
Reimplemented in LibBoard::ShapeList, LibBoard::Bezier, LibBoard::Image, LibBoard::Line, LibBoard::Polyline, LibBoard::Arrow, LibBoard::Text, LibBoard::Ellipse, and LibBoard::Dot.
|
virtual |
Accepts a visitor object.
visitor | A visitor object. |
Reimplemented in LibBoard::ShapeList, LibBoard::Bezier, LibBoard::Image, LibBoard::Line, LibBoard::Polyline, LibBoard::Arrow, LibBoard::Text, LibBoard::Ellipse, and LibBoard::Dot.
|
virtual |
Accepts a const-shape visitor object.
visitor | A const-shape visitor object. |
Reimplemented in LibBoard::ShapeList, LibBoard::Bezier, LibBoard::Image, LibBoard::Line, LibBoard::Polyline, LibBoard::Arrow, LibBoard::Text, LibBoard::Ellipse, and LibBoard::Dot.
|
virtual |
Accepts a visitor object.
visitor | A visitor object. |
Reimplemented in LibBoard::ShapeList, LibBoard::Bezier, LibBoard::Image, LibBoard::Line, LibBoard::Polyline, LibBoard::Arrow, LibBoard::Text, LibBoard::Ellipse, and LibBoard::Dot.
Referenced by LibBoard::Group::accept(), and LibBoard::ShapeList::accept().
|
inline |
Compute 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::Image::flushFIG(), resize(), LibBoard::Board::saveFIG(), and LibBoard::Board::saveSVG().
|
pure virtual |
Compute the bounding box of the figure.
Implemented in LibBoard::Bezier, LibBoard::Polyline, LibBoard::Text, LibBoard::Dot, LibBoard::Ellipse, LibBoard::Line, LibBoard::Arrow, LibBoard::ShapeList, LibBoard::Group, and LibBoard::Image.
Referenced by LibBoard::ShapeList::addTiling(), LibBoard::ShapeList::append(), bbox(), center(), resize(), scaleToHeight(), and scaleToWidth().
|
virtual |
Returns the center of the shape.
lineWidthFlag | Should the line width be considered when computing bounding boxes. |
Reimplemented in LibBoard::Text, LibBoard::Ellipse, and LibBoard::Dot.
References boundingBox().
Referenced by moveCenter(), LibBoard::Group::rotate(), LibBoard::Polyline::rotate(), LibBoard::Image::rotate(), LibBoard::Line::rotate(), LibBoard::ShapeList::rotate(), LibBoard::Bezier::rotate(), LibBoard::Board::rotate(), LibBoard::GouraudTriangle::rotate(), LibBoard::Polyline::rotated(), LibBoard::Line::rotated(), LibBoard::Image::rotated(), LibBoard::ShapeList::rotated(), LibBoard::Arrow::rotated(), LibBoard::Bezier::rotated(), LibBoard::Board::rotated(), LibBoard::Group::scale(), LibBoard::ShapeList::scale(), LibBoard::Image::scale(), LibBoard::Line::scale(), and LibBoard::Board::scale().
|
pure virtual |
Return a copy of the shape.
Implemented in LibBoard::GouraudTriangle, LibBoard::Bezier, LibBoard::Polyline, LibBoard::Arrow, LibBoard::Text, LibBoard::Dot, LibBoard::Ellipse, LibBoard::Line, LibBoard::ShapeList, LibBoard::Group, LibBoard::Image, and LibBoard::ShapeWithStyle.
Referenced by LibBoard::Board::addDuplicates(), LibBoard::ShapeList::addTiling(), LibBoard::ShapeList::append(), LibBoard::ShapeList::operator+=(), LibBoard::ShapeList::operator<<(), LibBoard::ShapeList::repeat(), and LibBoard::ShapeList::ShapeList().
|
pure virtual |
Write the FIG code of the shape in a stream according to a transform.
stream | The output stream. |
transform | A 2D transform to be applied. |
colormap |
Implemented in LibBoard::GouraudTriangle, LibBoard::Bezier, LibBoard::Line, LibBoard::Image, LibBoard::Polyline, LibBoard::Arrow, LibBoard::Text, LibBoard::ShapeList, LibBoard::Ellipse, LibBoard::Dot, and LibBoard::Group.
Referenced by LibBoard::ShapeList::flushFIG().
|
pure virtual |
Write 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::GouraudTriangle, LibBoard::Bezier, LibBoard::Line, LibBoard::Image, LibBoard::Polyline, LibBoard::Arrow, LibBoard::Text, LibBoard::ShapeList, LibBoard::Ellipse, LibBoard::Dot, and LibBoard::Group.
Referenced by LibBoard::ShapeList::flushPostscript().
|
pure virtual |
Write 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::GouraudTriangle, LibBoard::Bezier, LibBoard::Image, LibBoard::Line, LibBoard::Polyline, LibBoard::Arrow, LibBoard::Text, LibBoard::ShapeList, LibBoard::Ellipse, LibBoard::Dot, and LibBoard::Group.
Referenced by LibBoard::ShapeList::flushSVG().
|
pure virtual |
Write the TikZ 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::GouraudTriangle, LibBoard::Bezier, LibBoard::Image, LibBoard::Line, LibBoard::Polyline, LibBoard::Arrow, LibBoard::Text, LibBoard::ShapeList, LibBoard::Ellipse, LibBoard::Dot, and LibBoard::Group.
Referenced by LibBoard::ShapeList::flushTikZ().
Shape & LibBoard::Shape::moveCenter | ( | double | x, |
double | y, | ||
LineWidthFlag | lineWidthFlag = IgnoreLineWidth |
||
) |
Move the center of the shape.
x | The new x coordinate of the center. |
y | The new y coordinate of the center. |
lineWidthFlag | Should the line width be considered when computing bounding boxes. |
References center(), translate(), LibBoard::Point::x, and LibBoard::Point::y.
Move the center of the shape.
p | The new center. |
lineWidthFlag | Should the line width be considered when computing bounding boxes. |
References center(), translate(), LibBoard::Point::x, and LibBoard::Point::y.
|
virtual |
Returns the generic name of the shape (e.g., Circle, Rectangle, etc.)
Reimplemented in LibBoard::GouraudTriangle, LibBoard::Bezier, LibBoard::Arrow, LibBoard::ShapeList, LibBoard::Line, LibBoard::Text, LibBoard::Image, LibBoard::Ellipse, LibBoard::Polyline, LibBoard::Dot, LibBoard::Group, and LibBoard::ShapeWithStyle.
Shape & LibBoard::Shape::resize | ( | double | width, |
double | height, | ||
LineWidthFlag | lineWidthFlag | ||
) |
Resize the shape.
width | The new width. |
height | The new height. |
lineWidthFlag | Should the line width be considered when computing bounding boxes. |
References bbox(), boundingBox(), LibBoard::Rect::height, scale(), and LibBoard::Rect::width.
Referenced by LibBoard::Ellipse::resized(), LibBoard::Polyline::resized(), and LibBoard::GouraudTriangle::resized().
|
pure virtual |
Rotate the shape around its center.
angle | The rotation angle in radian. |
Implemented in LibBoard::GouraudTriangle, LibBoard::Bezier, LibBoard::Board, LibBoard::ShapeList, LibBoard::Line, LibBoard::Text, LibBoard::Image, LibBoard::Polyline, LibBoard::Dot, LibBoard::Ellipse, and LibBoard::Group.
Rotate the shape around a given center of rotation.
angle | The rotation angle in radian. |
center | The center of rotation. |
Implemented in LibBoard::GouraudTriangle, LibBoard::Board, LibBoard::Bezier, LibBoard::ShapeList, LibBoard::Text, LibBoard::Line, LibBoard::Image, LibBoard::Polyline, LibBoard::Ellipse, LibBoard::Dot, and LibBoard::Group.
Referenced by LibBoard::Board::addDuplicates(), LibBoard::ShapeList::repeat(), rotateDeg(), and LibBoard::ShapeList::ShapeList().
|
inline |
Rotate the shape around its center.
angle | The rotation angle in degree. |
References rotate().
Rotate the shape around a given center of rotation.
angle | The rotation angle in degree. |
center | The center of rotation. |
References rotate().
|
pure virtual |
Scale the shape along both axis.
s | The scaling factor along both axis. |
Implemented in LibBoard::Bezier, LibBoard::Line, LibBoard::Board, LibBoard::Image, LibBoard::Polyline, LibBoard::ShapeList, LibBoard::Text, LibBoard::Dot, LibBoard::Ellipse, and LibBoard::Group.
|
pure virtual |
Scale the shape along the x an y axis.
sx | The scaling factor along the x axis. |
sy | The scaling factor along the y axis. |
Implemented in LibBoard::Bezier, LibBoard::Board, LibBoard::Line, LibBoard::Image, LibBoard::ShapeList, LibBoard::Polyline, LibBoard::Text, LibBoard::Dot, LibBoard::Ellipse, and LibBoard::Group.
Referenced by LibBoard::Board::addDuplicates(), LibBoard::ShapeList::repeat(), resize(), scaleToHeight(), scaleToWidth(), and LibBoard::ShapeList::ShapeList().
|
pure virtual |
Scale all the values (positions, dimensions, etc.) associated with the shape.
s | The scaling factor. |
Implemented in LibBoard::GouraudTriangle, LibBoard::Bezier, LibBoard::Line, LibBoard::Image, LibBoard::Polyline, LibBoard::Text, LibBoard::ShapeList, LibBoard::Dot, and LibBoard::Ellipse.
Shape & LibBoard::Shape::scaleToHeight | ( | double | h, |
LineWidthFlag | lineWidthFlag | ||
) |
Scale the shape to a given height.
h | The requested new height. |
lineWidthFlag | Should the line width be considered when computing bounding boxes. |
References boundingBox(), LibBoard::Rect::height, and scale().
Shape & LibBoard::Shape::scaleToWidth | ( | double | w, |
LineWidthFlag | lineWidthFlag | ||
) |
Scale the shape to a given width.
w | The requested new width. |
lineWidthFlag | Should the line width be considered when computing bounding boxes. |
References boundingBox(), scale(), and LibBoard::Rect::width.
|
pure virtual |
Translate the shape by a given offset.
dx | The x offset. |
dy | The y offset. |
Implemented in LibBoard::Bezier, LibBoard::Board, LibBoard::ShapeList, LibBoard::Line, LibBoard::Image, LibBoard::Polyline, LibBoard::Text, LibBoard::Dot, LibBoard::Ellipse, and LibBoard::Group.
Referenced by LibBoard::Board::addDuplicates(), LibBoard::ShapeList::addTiling(), moveCenter(), LibBoard::ShapeList::repeat(), and LibBoard::ShapeList::ShapeList().