Board 0.9.6
|
An ellipse. More...
#include <Ellipse.h>
Public Types | |
enum | SamplingStart { SamplingFromRight , SamplingFromTop , SamplingFromLeft , SamplingFromBottom } |
Public Member Functions | |
Ellipse (double x, double y, double xRadius, double yRadius, Color penColor=Style::defaultPenColor(), Color fillColor=Style::defaultFillColor(), double lineWidth=Style::defaultLineWidth(), LineStyle lineStyle=Style::defaultLineStyle()) | |
Ellipse (Point center, double xRadius, double yRadius, Color penColor=Style::defaultPenColor(), Color fillColor=Style::defaultFillColor(), double lineWidth=Style::defaultLineWidth(), const LineStyle lineStyle=Style::defaultLineStyle()) | |
Ellipse (Point center, double xRadius, double yRadius, Style style) | |
const std::string & | name () const override |
Point | center (LineWidthFlag lineWidthFlag=IgnoreLineWidth) const override |
double | xRadius () const |
double | yRadius () const |
double | angle () const |
Ellipse & | rotate (double angle, const Point ¢er) override |
Ellipse | rotated (double angle, const Point ¢er) const |
Ellipse & | rotate (double angle) override |
Ellipse | rotated (double angle) const |
Ellipse & | translate (double dx, double dy) override |
Ellipse | translated (double dx, double dy) const |
Ellipse & | scale (double sx, double sy) override |
Ellipse & | scale (double s) override |
Ellipse | scaled (double sx, double sy) const |
Ellipse | scaled (double s) const |
void | scaleAll (double s) override |
Ellipse | resized (double w, double h, LineWidthFlag lineWidthFlag) const |
void | flushPostscript (std::ostream &stream, const TransformEPS &transform) const override |
void | flushFIG (std::ostream &stream, const TransformFIG &transform, std::map< Color, int > &colormap) const override |
void | flushSVG (std::ostream &stream, const TransformSVG &transform) const override |
void | flushTikZ (std::ostream &stream, const TransformTikZ &transform) const override |
virtual void | accept (ShapeVisitor &visitor) override |
Accepts a visitor object. | |
virtual void | accept (const ShapeVisitor &visitor) override |
Accepts a visitor object. | |
virtual void | accept (ConstShapeVisitor &visitor) const override |
Accepts a const-shape visitor object. | |
virtual void | accept (const ConstShapeVisitor &visitor) const override |
Accepts a const-shape visitor object. | |
virtual Shape * | accept (CompositeShapeTransform &transform) const override |
Accept a composite shape transform. | |
virtual Shape * | accept (const CompositeShapeTransform &transform) const override |
Accept a constant composite shape transform. | |
Rect | boundingBox (LineWidthFlag) const override |
Ellipse * | clone () const override |
void | setCircleFlag () |
double | perimeter () const |
Path | sampledPath (int n, SamplingStart start=SamplingFromRight) const |
Ellipse (const Ellipse &)=default | |
Ellipse (Ellipse &&)=default | |
Ellipse & | operator= (Ellipse &&)=default |
Ellipse & | operator= (const Ellipse &)=default |
~Ellipse () override=default | |
Public Member Functions inherited from LibBoard::ShapeWithStyle | |
ShapeWithStyle (Color penColor, Color fillColor, double lineWidth, LineStyle style, const LineCap cap, const LineJoin join) | |
ShapeWithStyle (const Style &style) | |
ShapeWithStyle (const ShapeWithStyle &other) | |
ShapeWithStyle & | operator= (const ShapeWithStyle &other) |
~ShapeWithStyle () | |
const std::string & | name () const |
Shape * | clone () const =0 |
const Color & | penColor () const |
ShapeWithStyle & | setPenColor (const Color &) |
const Color & | fillColor () const |
ShapeWithStyle & | setFillColor (const Color &) |
double | lineWidth () const |
ShapeWithStyle & | setLineWidth (double) |
LineStyle | lineStyle () const |
ShapeWithStyle & | setLineStyle (LineStyle) |
LineCap | lineCap () const |
ShapeWithStyle & | setLineCap (LineCap) |
LineJoin | lineJoin () const |
ShapeWithStyle & | setLineJoin (LineJoin) |
Style | style () const |
ShapeWithStyle & | setStyle (const Style &) |
bool | filled () const |
Public Member Functions inherited from LibBoard::Shape | |
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) | |
Protected Attributes | |
Point | _center |
double | _xRadius |
double | _yRadius |
double | _angle |
bool | _isCreatedAsCircle |
Protected Attributes inherited from LibBoard::ShapeWithStyle | |
Style | _style |
Additional Inherited Members | |
Static Public Member Functions inherited from LibBoard::ShapeWithStyle | |
static void | setLineWidthScaling (bool) |
Protected Member Functions inherited from LibBoard::ShapeWithStyle | |
void | updateLineWidth (double s) |
An ellipse.
The ellipse structure.
|
inline |
|
inline |
|
default |
|
default |
|
overridedefault |
|
overridevirtual |
Accept a composite shape transform.
transform | A composite shape transform object. |
Reimplemented from LibBoard::Shape.
References LibBoard::CompositeShapeTransform::map().
|
overridevirtual |
Accept a constant composite shape transform.
transform | A constant composite shape transform object.. |
Reimplemented from LibBoard::Shape.
References LibBoard::CompositeShapeTransform::map().
|
overridevirtual |
Accepts a const-shape visitor object.
visitor | A const-shape visitor object. |
Reimplemented from LibBoard::Shape.
References LibBoard::ConstShapeVisitor::visit().
|
overridevirtual |
Accepts a visitor object.
visitor | A visitor object. |
Reimplemented from LibBoard::Shape.
References LibBoard::ShapeVisitor::visit().
|
overridevirtual |
Accepts a const-shape visitor object.
visitor | A const-shape visitor object. |
Reimplemented from LibBoard::Shape.
References LibBoard::ConstShapeVisitor::visit().
|
overridevirtual |
Accepts a visitor object.
visitor | A visitor object. |
Reimplemented from LibBoard::Shape.
References LibBoard::ShapeVisitor::visit().
|
inline |
|
overridevirtual |
Compute the bounding box of the figure.
Implements LibBoard::Shape.
References _angle, _center, _xRadius, _yRadius, LibBoard::Rect::grow(), LibBoard::ShapeWithStyle::lineWidth(), M_PI, LibBoard::UseLineWidth, LibBoard::Point::x, and LibBoard::Point::y.
Referenced by LibBoard::hachures().
|
overridevirtual |
Returns the center of the shape.
lineWidthFlag | Should the line width be considered when computing bounding boxes. |
Reimplemented from LibBoard::Shape.
References _center.
Referenced by LibBoard::hachures(), rotate(), rotate(), rotated(), and rotated().
|
overridevirtual |
Return a copy of the shape.
Implements LibBoard::ShapeWithStyle.
Referenced by LibBoard::Board::drawCircle(), and LibBoard::Board::fillCircle().
|
overridevirtual |
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 |
Implements LibBoard::Shape.
References _angle, _center, _xRadius, _yRadius, LibBoard::ShapeWithStyle::fillColor(), LibBoard::ShapeWithStyle::filled(), LibBoard::ShapeWithStyle::lineStyle(), LibBoard::ShapeWithStyle::lineWidth(), LibBoard::TransformFIG::mapWidth(), LibBoard::Transform::mapX(), LibBoard::TransformFIG::mapY(), LibBoard::ShapeWithStyle::penColor(), LibBoard::Transform::scale(), LibBoard::TransformFIG::shapeDepth(), LibBoard::Color::valid(), LibBoard::Point::x, and LibBoard::Point::y.
|
overridevirtual |
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. |
Implements LibBoard::Shape.
References _angle, _center, LibBoard::ShapeWithStyle::_style, _xRadius, _yRadius, LibBoard::ShapeWithStyle::fillColor(), LibBoard::ShapeWithStyle::filled(), LibBoard::ShapeWithStyle::lineWidth(), M_PI, LibBoard::Transform::mapX(), LibBoard::TransformEPS::mapY(), LibBoard::Color::Null, LibBoard::ShapeWithStyle::penColor(), LibBoard::Color::postscript(), LibBoard::Style::postscriptProperties(), LibBoard::Transform::scale(), LibBoard::Point::x, and LibBoard::Point::y.
|
overridevirtual |
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. |
Implements LibBoard::Shape.
References _angle, _center, LibBoard::ShapeWithStyle::_style, _xRadius, _yRadius, M_PI, LibBoard::Transform::mapX(), LibBoard::TransformSVG::mapY(), LibBoard::Transform::scale(), LibBoard::Style::svgProperties(), LibBoard::Point::x, and LibBoard::Point::y.
|
overridevirtual |
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. |
Implements LibBoard::Shape.
References _angle, _center, LibBoard::ShapeWithStyle::_style, _xRadius, _yRadius, M_PI, LibBoard::Transform::mapX(), LibBoard::TransformSVG::mapY(), LibBoard::Transform::scale(), LibBoard::Style::tikzProperties(), LibBoard::Point::x, and LibBoard::Point::y.
|
overridevirtual |
Returns the generic name of the shape (e.g., Circle, Rectangle, etc.)
Reimplemented from LibBoard::Shape.
double LibBoard::Ellipse::perimeter | ( | ) | const |
Estimated perimeter of the ellipse.
References _xRadius, _yRadius, and M_PI.
Referenced by LibBoard::RoughVisitor::map(), and sampledPath().
Ellipse LibBoard::Ellipse::resized | ( | double | w, |
double | h, | ||
LineWidthFlag | lineWidthFlag | ||
) | const |
Returns a resized copy of the ellipse.
w | Width of the new ellipse. |
h | Height of the new ellipse. |
lineWidthFlag | Should the line width be considered when computing bounding boxes. |
References LibBoard::Shape::resize().
|
overridevirtual |
Rotate the shape around its center.
angle | The rotation angle in radian. |
Implements LibBoard::Shape.
Rotate the shape around a given center of rotation.
angle | The rotation angle in radian. |
center | The center of rotation. |
Implements LibBoard::Shape.
References _angle, _center, _xRadius, angle(), center(), rotate(), LibBoard::Point::rotated(), LibBoard::Point::x, and LibBoard::Point::y.
Referenced by ell(), LibBoard::hachures(), rotate(), rotate(), rotated(), rotated(), and rough().
Ellipse LibBoard::Ellipse::rotated | ( | double | angle | ) | const |
angle | |
center |
References angle(), center(), and rotate().
Referenced by sampledPath().
Path LibBoard::Ellipse::sampledPath | ( | int | n, |
SamplingStart | start = SamplingFromRight |
||
) | const |
Return uniformly sampled points along the ellipse (counterclockwise).
n | Number of sample points |
start | Position of the first point |
References _angle, _center, _xRadius, _yRadius, LibBoard::Path::Closed, M_PI, LibBoard::Path::moveCenter(), perimeter(), LibBoard::Path::pop_back(), LibBoard::Path::push_back(), rotated(), SamplingFromBottom, SamplingFromLeft, SamplingFromRight, and SamplingFromTop.
Referenced by LibBoard::RoughVisitor::map().
|
overridevirtual |
Scale the ellipse, given a scaling factor.
s | Scaling factor. |
Implements LibBoard::Shape.
References scale().
|
overridevirtual |
Scale the polyline, given two scaling factors.
sx | Scaling factor along the x axis. |
sy | Scaling factor along the y axis. |
Implements LibBoard::Shape.
References _angle, _xRadius, _yRadius, LibBoard::Tools::almostEqual(), M_PI, and LibBoard::ShapeWithStyle::updateLineWidth().
|
overridevirtual |
Scales all the values (positions, dimensions, etc.) associated with the shape.
s | The scaling factor. |
Implements LibBoard::Shape.
Ellipse LibBoard::Ellipse::scaled | ( | double | s | ) | const |
Returns a scaled copy of the ellipse.
s | The scaling factor. |
References scale().
Ellipse LibBoard::Ellipse::scaled | ( | double | sx, |
double | sy | ||
) | const |
Returns a scaled copy of the ellipse.
sx | The scaling factor along the x axis. |
sy | The scaling factor along the y axis. |
References scale().
void LibBoard::Ellipse::setCircleFlag | ( | ) |
Set flag to save the ellipse as a circle as soon as radii are equal.
References _isCreatedAsCircle.
Referenced by LibBoard::circle(), LibBoard::circle(), and LibBoard::circle().
|
overridevirtual |
Translate the ellipse by a given offset.
dx | The x offset. |
dy | The y offset. |
Implements LibBoard::Shape.
References _center.
Referenced by translated().
Ellipse LibBoard::Ellipse::translated | ( | double | dx, |
double | dy | ||
) | const |
Returns a translated copy of the ellipse.
dx | Shift of the first coordinate. |
dy | Shift of the second coordinate. |
References translate().
Referenced by main().
|
inline |
References _xRadius.
Referenced by LibBoard::hachures().
|
inline |
References _yRadius.
Referenced by LibBoard::hachures().
|
protected |
Referenced by angle(), boundingBox(), flushFIG(), flushPostscript(), flushSVG(), flushTikZ(), rotate(), sampledPath(), and scale().
|
protected |
Referenced by boundingBox(), center(), flushFIG(), flushPostscript(), flushSVG(), flushTikZ(), rotate(), sampledPath(), scaleAll(), and translate().
|
protected |
Referenced by setCircleFlag().
|
protected |
Referenced by boundingBox(), flushFIG(), flushPostscript(), flushSVG(), flushTikZ(), perimeter(), rotate(), sampledPath(), scale(), scaleAll(), and xRadius().
|
protected |
Referenced by boundingBox(), flushFIG(), flushPostscript(), flushSVG(), flushTikZ(), perimeter(), sampledPath(), scale(), scaleAll(), and yRadius().