Board 0.9.6
|
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. | |
virtual void | accept (const ShapeVisitor &visitor) |
Accepts a visitor object. | |
virtual void | accept (ConstShapeVisitor &visitor) const |
Accepts a const-shape visitor object. | |
virtual void | accept (const ConstShapeVisitor &visitor) const |
Accepts a const-shape visitor object. | |
virtual Shape * | accept (CompositeShapeTransform &transform) const |
Accept a composite shape transform. | |
virtual Shape * | accept (const CompositeShapeTransform &transform) const |
Accept a constant composite shape transform. | |
Shape (const Shape &other) | |
Abstract structure for a 2D shape.
Shape structure.
|
inline |
Shape constructor.
|
virtual |
Shape destructor.
LibBoard::Shape::Shape | ( | const Shape & | other | ) |
|
virtual |
Accept a composite shape transform.
transform | A composite shape transform object. |
Reimplemented in LibBoard::Arrow, LibBoard::Bezier, LibBoard::Dot, LibBoard::Ellipse, LibBoard::Group, LibBoard::Group, LibBoard::Image, LibBoard::Line, LibBoard::Polyline, LibBoard::ShapeList, and LibBoard::Text.
References LibBoard::CompositeShapeTransform::map().
|
virtual |
Accept a constant composite shape transform.
transform | A constant composite shape transform object.. |
Reimplemented in LibBoard::Arrow, LibBoard::Bezier, LibBoard::Dot, LibBoard::Ellipse, LibBoard::Group, LibBoard::Group, LibBoard::Image, LibBoard::Line, LibBoard::Polyline, LibBoard::ShapeList, and LibBoard::Text.
References LibBoard::CompositeShapeTransform::map().
|
virtual |
Accepts a const-shape visitor object.
visitor | A const-shape visitor object. |
Reimplemented in LibBoard::Arrow, LibBoard::Bezier, LibBoard::Dot, LibBoard::Ellipse, LibBoard::Group, LibBoard::Image, LibBoard::Line, LibBoard::Polyline, LibBoard::ShapeList, and LibBoard::Text.
References LibBoard::ConstShapeVisitor::visit().
|
virtual |
Accepts a visitor object.
visitor | A visitor object. |
Reimplemented in LibBoard::Arrow, LibBoard::Bezier, LibBoard::Dot, LibBoard::Ellipse, LibBoard::Group, LibBoard::Image, LibBoard::Line, LibBoard::Polyline, LibBoard::ShapeList, and LibBoard::Text.
References LibBoard::ShapeVisitor::visit().
|
virtual |
Accepts a const-shape visitor object.
visitor | A const-shape visitor object. |
Reimplemented in LibBoard::Arrow, LibBoard::Bezier, LibBoard::Dot, LibBoard::Ellipse, LibBoard::Group, LibBoard::Image, LibBoard::Line, LibBoard::Polyline, LibBoard::ShapeList, and LibBoard::Text.
References LibBoard::ConstShapeVisitor::visit().
|
virtual |
Accepts a visitor object.
visitor | A visitor object. |
Reimplemented in LibBoard::Arrow, LibBoard::Bezier, LibBoard::Dot, LibBoard::Ellipse, LibBoard::Group, LibBoard::Image, LibBoard::Line, LibBoard::Polyline, LibBoard::ShapeList, and LibBoard::Text.
References LibBoard::ShapeVisitor::visit().
Referenced by LibBoard::Group::accept(), LibBoard::Group::accept(), LibBoard::ShapeList::accept(), LibBoard::ShapeList::accept(), and LibBoard::makeRough().
|
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(), LibBoard::framed(), main(), merge(), resize(), LibBoard::Board::saveEPS(), LibBoard::Board::saveFIG(), and LibBoard::Board::saveSVG().
|
pure virtual |
Compute the bounding box of the figure.
Implemented in LibBoard::Image, LibBoard::Arrow, LibBoard::Bezier, LibBoard::Dot, LibBoard::Ellipse, LibBoard::Group, LibBoard::Line, LibBoard::Polyline, LibBoard::ShapeList, and LibBoard::Text.
Referenced by LibBoard::ShapeList::append(), bbox(), center(), LibBoard::circled(), resize(), scaleToHeight(), scaleToWidth(), LibBoard::tiling(), LibBoard::BoundingBoxViewer::visit(), LibBoard::BoundingBoxExtractor::visit(), and LibBoard::BoundingBoxViewer::visit().
|
virtual |
Returns the center of the shape.
lineWidthFlag | Should the line width be considered when computing bounding boxes. |
Reimplemented in LibBoard::Dot, LibBoard::Ellipse, and LibBoard::Text.
References boundingBox(), and LibBoard::Rect::center().
Referenced by LibBoard::Group::accept(), LibBoard::Group::accept(), LibBoard::Group::accept(), main(), merge(), moveCenter(), moveCenter(), LibBoard::Board::rotate(), LibBoard::Bezier::rotate(), LibBoard::Group::rotate(), LibBoard::Image::rotate(), LibBoard::Line::rotate(), LibBoard::Polyline::rotate(), LibBoard::GouraudTriangle::rotate(), LibBoard::Board::rotate(), LibBoard::Bezier::rotate(), LibBoard::Group::rotate(), LibBoard::Image::rotate(), LibBoard::Line::rotate(), LibBoard::Polyline::rotate(), LibBoard::GouraudTriangle::rotate(), LibBoard::ShapeList::rotated(), LibBoard::Bezier::rotated(), LibBoard::Line::rotated(), LibBoard::Polyline::rotated(), LibBoard::GouraudTriangle::rotated(), LibBoard::Image::rotated(), LibBoard::Board::rotated(), LibBoard::Group::rotated(), LibBoard::Arrow::rotated(), LibBoard::Bezier::rotated(), LibBoard::Line::rotated(), LibBoard::Polyline::rotated(), LibBoard::GouraudTriangle::rotated(), rotateDeg(), rotateDeg(), LibBoard::Board::scale(), LibBoard::Group::scale(), LibBoard::Board::scale(), LibBoard::Group::scale(), LibBoard::Image::scale(), LibBoard::Line::scale(), and LibBoard::ShapeList::scale().
|
pure virtual |
Return a copy of the shape.
Implemented in LibBoard::ShapeWithStyle, LibBoard::Arrow, LibBoard::Bezier, LibBoard::Dot, LibBoard::Ellipse, LibBoard::Group, LibBoard::Image, LibBoard::Line, LibBoard::Polyline, LibBoard::GouraudTriangle, LibBoard::ShapeList, and LibBoard::Text.
Referenced by LibBoard::Board::addDuplicates(), LibBoard::Board::addDuplicates(), LibBoard::ShapeList::addRepeated(), LibBoard::ShapeList::addShape(), LibBoard::ShapeList::append(), LibBoard::ShapeList::operator+=(), LibBoard::ShapeList::operator<<(), LibBoard::ShapeList::ShapeList(), LibBoard::ShapeList::ShapeList(), and LibBoard::tiling().
|
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::Arrow, LibBoard::Bezier, LibBoard::Dot, LibBoard::Ellipse, LibBoard::Group, LibBoard::Image, LibBoard::Line, LibBoard::Polyline, LibBoard::GouraudTriangle, LibBoard::ShapeList, and LibBoard::Text.
|
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::Arrow, LibBoard::Bezier, LibBoard::Dot, LibBoard::Ellipse, LibBoard::Group, LibBoard::Image, LibBoard::Line, LibBoard::Polyline, LibBoard::GouraudTriangle, LibBoard::ShapeList, and LibBoard::Text.
|
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::Arrow, LibBoard::Bezier, LibBoard::Dot, LibBoard::Ellipse, LibBoard::Group, LibBoard::Image, LibBoard::Line, LibBoard::Polyline, LibBoard::GouraudTriangle, LibBoard::ShapeList, and LibBoard::Text.
|
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::Arrow, LibBoard::Bezier, LibBoard::Dot, LibBoard::Ellipse, LibBoard::Group, LibBoard::Image, LibBoard::Line, LibBoard::Polyline, LibBoard::GouraudTriangle, LibBoard::ShapeList, and LibBoard::Text.
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.
Referenced by LibBoard::ShapeList::append(), LibBoard::hachures(), main(), and merge().
Shape & LibBoard::Shape::moveCenter | ( | Point | p, |
LineWidthFlag | lineWidthFlag = IgnoreLineWidth |
||
) |
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::ShapeWithStyle, LibBoard::Arrow, LibBoard::Bezier, LibBoard::Dot, LibBoard::Ellipse, LibBoard::Group, LibBoard::Image, LibBoard::Line, LibBoard::Polyline, LibBoard::GouraudTriangle, LibBoard::ShapeList, and LibBoard::Text.
Referenced by LibBoard::BoundingBoxViewer::visit(), and LibBoard::BoundingBoxViewer::visit().
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::Arrow::resized(), LibBoard::Bezier::resized(), LibBoard::Ellipse::resized(), LibBoard::Line::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::Board, LibBoard::Bezier, LibBoard::Dot, LibBoard::Ellipse, LibBoard::Group, LibBoard::Image, LibBoard::Line, LibBoard::Polyline, LibBoard::GouraudTriangle, LibBoard::ShapeList, and LibBoard::Text.
Rotate the shape around a given center of rotation.
angle | The rotation angle in radian. |
center | The center of rotation. |
Implemented in LibBoard::Board, LibBoard::Bezier, LibBoard::Dot, LibBoard::Ellipse, LibBoard::Group, LibBoard::Image, LibBoard::Line, LibBoard::Polyline, LibBoard::GouraudTriangle, LibBoard::ShapeList, and LibBoard::Text.
Referenced by LibBoard::Board::addDuplicates(), LibBoard::ShapeList::addRepeated(), rotateDeg(), rotateDeg(), and LibBoard::ShapeList::ShapeList().
|
inline |
|
pure virtual |
Scale the shape along both axis.
s | The scaling factor along both axis. |
Implemented in LibBoard::Board, LibBoard::Bezier, LibBoard::Dot, LibBoard::Ellipse, LibBoard::Group, LibBoard::Image, LibBoard::Line, LibBoard::Polyline, LibBoard::ShapeList, and LibBoard::Text.
|
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::Board, LibBoard::Bezier, LibBoard::Dot, LibBoard::Ellipse, LibBoard::Group, LibBoard::Image, LibBoard::Line, LibBoard::Polyline, LibBoard::ShapeList, and LibBoard::Text.
Referenced by LibBoard::Board::addDuplicates(), LibBoard::Board::addDuplicates(), LibBoard::ShapeList::addRepeated(), resize(), scaleToHeight(), scaleToWidth(), LibBoard::ShapeList::ShapeList(), and LibBoard::ShapeList::ShapeList().
|
pure virtual |
Scale all the values (positions, dimensions, etc.) associated with the shape.
s | The scaling factor. |
Implemented in LibBoard::Bezier, LibBoard::Dot, LibBoard::Ellipse, LibBoard::Image, LibBoard::Line, LibBoard::Polyline, LibBoard::GouraudTriangle, LibBoard::ShapeList, and LibBoard::Text.
Referenced by LibBoard::ShapeList::addShape().
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::Board, LibBoard::Bezier, LibBoard::Dot, LibBoard::Ellipse, LibBoard::Group, LibBoard::Image, LibBoard::Line, LibBoard::Polyline, LibBoard::ShapeList, and LibBoard::Text.
Referenced by LibBoard::Board::addDuplicates(), LibBoard::Board::addDuplicates(), LibBoard::ShapeList::addRepeated(), moveCenter(), moveCenter(), LibBoard::ShapeList::ShapeList(), LibBoard::ShapeList::ShapeList(), and LibBoard::tiling().