Board
0.9.2
|
Abstract structure for a 2D shape. More...
#include <Shapes.h>
Public Member Functions | |
Shape (Color penColor, Color fillColor, double lineWidth, LineStyle style, 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 |
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) |
Shape & | moveCenter (Point p) |
virtual Shape & | scale (double sx, double sy)=0 |
virtual Shape & | scale (double s)=0 |
virtual Rect | boundingBox () const =0 |
Rect | bbox () const |
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 |
virtual void | flushTikZ (std::ostream &stream, const TransformTikZ &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 |
std::string | tikzProperties (const TransformTikZ &transform) const |
Protected Attributes | |
int | _depth |
Color | _penColor |
Color | _fillColor |
double | _lineWidth |
LineStyle | _lineStyle |
LineCap | _lineCap |
LineJoin | _lineJoin |
Abstract structure for a 2D shape.
Shape structure.
|
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. |
|
inlinevirtual |
Shape destructor.
|
inline |
Compute the bounding box of the figure. (Convenience method to call "boundingBox" with a short name.)
Referenced by LibBoard::Board::drawBoundingBox(), LibBoard::Image::flushFIG(), LibBoard::Group::flushFIG(), LibBoard::Board::saveEPS(), LibBoard::Board::saveFIG(), and LibBoard::Board::saveSVG().
|
pure virtual |
Compute the bounding box of the figure.
Implemented in LibBoard::Text, LibBoard::Ellipse, LibBoard::Polyline, LibBoard::Line, LibBoard::Dot, LibBoard::Group, LibBoard::Image, and LibBoard::ShapeList.
Referenced by LibBoard::ShapeList::addTiling(), LibBoard::ShapeList::append(), and center().
|
virtual |
Returns the center of the shape.
Reimplemented in LibBoard::Text, LibBoard::Circle, LibBoard::Ellipse, LibBoard::GouraudTriangle, LibBoard::Polyline, LibBoard::Line, LibBoard::Dot, and LibBoard::Image.
References boundingBox().
Referenced by moveCenter(), LibBoard::ShapeList::rotate(), LibBoard::Board::rotate(), LibBoard::Group::rotate(), LibBoard::ShapeList::scale(), LibBoard::Board::scale(), and LibBoard::Group::scale().
|
pure virtual |
Return a copy of the shape.
Implemented in LibBoard::Text, LibBoard::Circle, LibBoard::Ellipse, LibBoard::GouraudTriangle, LibBoard::Triangle, LibBoard::Rectangle, LibBoard::Polyline, LibBoard::Arrow, LibBoard::Line, LibBoard::Dot, LibBoard::Group, LibBoard::ShapeList, and LibBoard::Image.
Referenced by LibBoard::Board::addDuplicates(), LibBoard::ShapeList::addTiling(), LibBoard::ShapeList::append(), LibBoard::ShapeList::operator+=(), LibBoard::ShapeList::operator<<(), and LibBoard::ShapeList::ShapeList().
|
inline |
Checks whether a shape is filled with a color or not.
References _fillColor.
Referenced by LibBoard::Arrow::flushFIG(), LibBoard::Polyline::flushFIG(), LibBoard::Rectangle::flushFIG(), LibBoard::Ellipse::flushFIG(), LibBoard::Arrow::flushPostscript(), LibBoard::Polyline::flushPostscript(), and LibBoard::Ellipse::flushPostscript().
|
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. |
Implemented in LibBoard::Text, LibBoard::Ellipse, LibBoard::GouraudTriangle, LibBoard::Rectangle, LibBoard::Polyline, LibBoard::Arrow, LibBoard::Line, LibBoard::Dot, LibBoard::Group, LibBoard::Image, and LibBoard::ShapeList.
|
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::Text, LibBoard::Ellipse, LibBoard::GouraudTriangle, LibBoard::Polyline, LibBoard::Arrow, LibBoard::Line, LibBoard::Dot, LibBoard::Group, LibBoard::Image, and LibBoard::ShapeList.
|
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::Text, LibBoard::Circle, LibBoard::Ellipse, LibBoard::GouraudTriangle, LibBoard::Rectangle, LibBoard::Polyline, LibBoard::Arrow, LibBoard::Line, LibBoard::Dot, LibBoard::Group, LibBoard::Image, and LibBoard::ShapeList.
|
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::Text, LibBoard::Circle, LibBoard::Ellipse, LibBoard::GouraudTriangle, LibBoard::Rectangle, LibBoard::Polyline, LibBoard::Arrow, LibBoard::Line, LibBoard::Dot, LibBoard::Group, LibBoard::Image, and LibBoard::ShapeList.
Shape & LibBoard::Shape::moveCenter | ( | double | x, |
double | y | ||
) |
Move the center of the shape.
x | The new x coordinate of the center. |
y | The new y coordinate of the center. |
References center(), translate(), LibBoard::Point::x, and LibBoard::Point::y.
Referenced by LibBoard::ShapeList::append().
Move the center of the shape.
p | The new center. |
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::Text, LibBoard::Circle, LibBoard::Ellipse, LibBoard::GouraudTriangle, LibBoard::Triangle, LibBoard::Rectangle, LibBoard::Polyline, LibBoard::Arrow, LibBoard::Line, LibBoard::Dot, LibBoard::Group, LibBoard::ShapeList, and LibBoard::Image.
|
inline |
Increment the depth of the shape. (Push the shape toward the background.)
|
inline |
Decrement the depth of the shape. (Pull the shape toward the foreground.)
|
protected |
Return a string of the properties lineWidth, penColor, lineCap, and lineJoin as Postscript commands.
References _lineCap, _lineJoin, _lineStyle, and _lineWidth.
Referenced by LibBoard::Dot::flushPostscript(), LibBoard::Line::flushPostscript(), LibBoard::Arrow::flushPostscript(), LibBoard::Polyline::flushPostscript(), and LibBoard::Ellipse::flushPostscript().
Rotate the shape around a given center of rotation.
angle | The rotation angle in radian. |
center | The center of rotation. |
Implemented in LibBoard::Text, LibBoard::Circle, LibBoard::Ellipse, LibBoard::GouraudTriangle, LibBoard::Polyline, LibBoard::Line, LibBoard::Dot, LibBoard::Group, LibBoard::Board, LibBoard::Image, and LibBoard::ShapeList.
Referenced by LibBoard::Board::addDuplicates(), and LibBoard::ShapeList::ShapeList().
|
pure virtual |
Rotate the shape around its center.
angle | The rotation angle in radian. |
Implemented in LibBoard::Text, LibBoard::Circle, LibBoard::Ellipse, LibBoard::GouraudTriangle, LibBoard::Polyline, LibBoard::Line, LibBoard::Dot, LibBoard::Group, LibBoard::Board, LibBoard::Image, and LibBoard::ShapeList.
Rotate the shape around a given center of rotation.
angle | The rotation angle in degree. |
center | The center of rotation. |
|
inline |
Rotate the shape around its center.
angle | The rotation angle in degree. |
center | The center of rotation. |
|
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::Text, LibBoard::Circle, LibBoard::Ellipse, LibBoard::Polyline, LibBoard::Line, LibBoard::Dot, LibBoard::Group, LibBoard::Image, LibBoard::Board, and LibBoard::ShapeList.
Referenced by LibBoard::Board::addDuplicates(), and LibBoard::ShapeList::ShapeList().
|
pure virtual |
Scale the shape along both axis.
s | The scaling factor along both axis. |
Implemented in LibBoard::Text, LibBoard::Circle, LibBoard::Ellipse, LibBoard::Polyline, LibBoard::Line, LibBoard::Dot, LibBoard::Group, LibBoard::Image, LibBoard::Board, and LibBoard::ShapeList.
|
pure virtual |
Scale all the values (positions, dimensions, etc.) associated with the shape.
s | The scaling factor. |
Implemented in LibBoard::Text, LibBoard::Circle, LibBoard::Ellipse, LibBoard::GouraudTriangle, LibBoard::Rectangle, LibBoard::Polyline, LibBoard::Line, LibBoard::Dot, LibBoard::Image, and LibBoard::ShapeList.
|
protected |
Return a string of the svg properties lineWidth, opacity, penColor, fillColor, lineCap, and lineJoin.
References _fillColor, _lineCap, _lineJoin, _lineStyle, _lineWidth, _penColor, and LibBoard::Color::svgAlpha().
Referenced by LibBoard::Dot::flushSVG(), LibBoard::Line::flushSVG(), LibBoard::Polyline::flushSVG(), LibBoard::Rectangle::flushSVG(), LibBoard::Ellipse::flushSVG(), and LibBoard::Circle::flushSVG().
|
protected |
Return a string of the properties lineWidth, penColor, lineCap, and lineJoin as TikZ commands.
References _fillColor, _lineCap, _lineJoin, _lineStyle, _lineWidth, _penColor, and LibBoard::Color::tikz().
Referenced by LibBoard::Line::flushTikZ(), LibBoard::Arrow::flushTikZ(), LibBoard::Polyline::flushTikZ(), LibBoard::Ellipse::flushTikZ(), LibBoard::Circle::flushTikZ(), and LibBoard::Text::flushTikZ().
|
pure virtual |
Translate the shape by a given offset.
dx | The x offset. |
dy | The y offset. |
Implemented in LibBoard::Text, LibBoard::Circle, LibBoard::Ellipse, LibBoard::Polyline, LibBoard::Line, LibBoard::Dot, LibBoard::Group, LibBoard::Image, LibBoard::Board, and LibBoard::ShapeList.
Referenced by LibBoard::Board::addDuplicates(), LibBoard::ShapeList::addTiling(), moveCenter(), and LibBoard::ShapeList::ShapeList().
|
protected |
The depth of the shape.
Referenced by LibBoard::Image::flushFIG(), LibBoard::Dot::flushFIG(), LibBoard::Line::flushFIG(), LibBoard::Arrow::flushFIG(), LibBoard::Polyline::flushFIG(), LibBoard::Rectangle::flushFIG(), LibBoard::Ellipse::flushFIG(), LibBoard::Text::flushFIG(), LibBoard::GouraudTriangle::flushPostscript(), and LibBoard::GouraudTriangle::flushSVG().
|
protected |
The color of the shape.
Referenced by filled(), LibBoard::Polyline::flushFIG(), LibBoard::Rectangle::flushFIG(), LibBoard::Ellipse::flushFIG(), LibBoard::Polyline::flushPostscript(), LibBoard::Ellipse::flushPostscript(), LibBoard::Arrow::flushSVG(), svgProperties(), and tikzProperties().
|
protected |
The linecap attribute. (The way line terminates.)
Referenced by LibBoard::Dot::flushFIG(), LibBoard::Line::flushFIG(), LibBoard::Arrow::flushFIG(), LibBoard::Polyline::flushFIG(), LibBoard::Rectangle::flushFIG(), postscriptProperties(), svgProperties(), and tikzProperties().
|
protected |
The linejoin attribute. (The shape of line junctions.)
Referenced by LibBoard::Dot::flushFIG(), LibBoard::Line::flushFIG(), LibBoard::Arrow::flushFIG(), LibBoard::Polyline::flushFIG(), LibBoard::Rectangle::flushFIG(), postscriptProperties(), svgProperties(), and tikzProperties().
|
protected |
The line style (solid, dashed, etc.).
Referenced by LibBoard::Line::flushFIG(), LibBoard::Arrow::flushFIG(), LibBoard::Polyline::flushFIG(), LibBoard::Rectangle::flushFIG(), LibBoard::Ellipse::flushFIG(), LibBoard::Arrow::flushSVG(), postscriptProperties(), svgProperties(), and tikzProperties().
|
protected |
The line thickness.
Referenced by LibBoard::Dot::flushFIG(), LibBoard::Line::flushFIG(), LibBoard::Arrow::flushFIG(), LibBoard::Polyline::flushFIG(), LibBoard::Rectangle::flushFIG(), LibBoard::Ellipse::flushFIG(), LibBoard::Arrow::flushPostscript(), LibBoard::Arrow::flushSVG(), postscriptProperties(), svgProperties(), and tikzProperties().
|
protected |
The color of the shape.
Referenced by LibBoard::Dot::flushFIG(), LibBoard::Line::flushFIG(), LibBoard::Arrow::flushFIG(), LibBoard::Polyline::flushFIG(), LibBoard::Rectangle::flushFIG(), LibBoard::Ellipse::flushFIG(), LibBoard::Text::flushFIG(), LibBoard::Dot::flushPostscript(), LibBoard::Line::flushPostscript(), LibBoard::Arrow::flushPostscript(), LibBoard::Polyline::flushPostscript(), LibBoard::Ellipse::flushPostscript(), LibBoard::Text::flushPostscript(), LibBoard::Arrow::flushSVG(), LibBoard::Text::flushSVG(), svgProperties(), and tikzProperties().