Board 0.9.6
Public Member Functions | Protected Attributes | List of all members
LibBoard::Dot Struct Reference

A line between two points. More...

#include <Dot.h>

Inheritance diagram for LibBoard::Dot:
LibBoard::ShapeWithStyle LibBoard::Shape

Public Member Functions

 Dot (double x, double y, Color color=Style::defaultPenColor(), double lineWidth=Style::defaultLineWidth())
 
 Dot (const Point &p, Color color=Style::defaultPenColor(), double lineWidth=Style::defaultLineWidth())
 
const std::string & name () const override
 
Point center (LineWidthFlag flage=IgnoreLineWidth) const override
 
Dot & rotate (double angle, const Point &center) override
 
Dot rotated (double angle, const Point &center) const
 
Dot & rotate (double angle) override
 
Dot rotated (double angle) const
 
Dot & translate (double dx, double dy) override
 
Dot translated (double dx, double dy) const
 
Dot & scale (double sx, double sy) override
 
Dot & scale (double s) override
 
Dot scaled (double sx, double sy) const
 
Dot scaled (double s) const
 
void scaleAll (double s) override
 
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
 
Dot * clone () const override
 
 Dot (const Dot &)=default
 
 Dot (Dot &&)=default
 
Dot & operator= (Dot &&)=default
 
Dot & operator= (const Dot &)=default
 
 ~Dot () 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 &center)=0
 
virtual Shape & rotate (double angle)=0
 
Shape & rotateDeg (double angle, const Point &center)
 
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

double _x
 
double _y
 
- 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)
 

Detailed Description

A line between two points.

The dot structure. This primitive ha been reported as "missing" by Manuel Peinado from Spain. Manuel also suggested that rendering a dot consists in drawing a line from a point to the same point with a roundcap style.

Examples
examples/Julia.cpp, examples/board_font_text.cpp, examples/example4.cpp, and examples/hull.cpp.

Constructor & Destructor Documentation

◆ Dot() [1/4]

LibBoard::Dot::Dot ( double  x,
double  y,
Color  color = Style::defaultPenColor(),
double  lineWidth = Style::defaultLineWidth() 
)
inline

◆ Dot() [2/4]

LibBoard::Dot::Dot ( const Point &  p,
Color  color = Style::defaultPenColor(),
double  lineWidth = Style::defaultLineWidth() 
)
inline

◆ Dot() [3/4]

LibBoard::Dot::Dot ( const Dot &  )
default

◆ Dot() [4/4]

LibBoard::Dot::Dot ( Dot &&  )
default

◆ ~Dot()

LibBoard::Dot::~Dot ( )
overridedefault

Member Function Documentation

◆ accept() [1/6]

Shape * LibBoard::Dot::accept ( CompositeShapeTransform &  transform) const
overridevirtual

Accept a composite shape transform.

Parameters
transformA composite shape transform object.

Reimplemented from LibBoard::Shape.

References LibBoard::CompositeShapeTransform::map().

◆ accept() [2/6]

Shape * LibBoard::Dot::accept ( const CompositeShapeTransform &  transform) const
overridevirtual

Accept a constant composite shape transform.

Parameters
transformA constant composite shape transform object..

Reimplemented from LibBoard::Shape.

References LibBoard::CompositeShapeTransform::map().

◆ accept() [3/6]

void LibBoard::Dot::accept ( const ConstShapeVisitor &  visitor) const
overridevirtual

Accepts a const-shape visitor object.

Parameters
visitorA const-shape visitor object.

Reimplemented from LibBoard::Shape.

References LibBoard::ConstShapeVisitor::visit().

◆ accept() [4/6]

void LibBoard::Dot::accept ( const ShapeVisitor &  visitor)
overridevirtual

Accepts a visitor object.

Parameters
visitorA visitor object.

Reimplemented from LibBoard::Shape.

References LibBoard::ShapeVisitor::visit().

◆ accept() [5/6]

void LibBoard::Dot::accept ( ConstShapeVisitor &  visitor) const
overridevirtual

Accepts a const-shape visitor object.

Parameters
visitorA const-shape visitor object.

Reimplemented from LibBoard::Shape.

References LibBoard::ConstShapeVisitor::visit().

◆ accept() [6/6]

void LibBoard::Dot::accept ( ShapeVisitor &  visitor)
overridevirtual

Accepts a visitor object.

Parameters
visitorA visitor object.

Reimplemented from LibBoard::Shape.

References LibBoard::ShapeVisitor::visit().

◆ boundingBox()

Rect LibBoard::Dot::boundingBox ( LineWidthFlag  lineWidthFlag) const
overridevirtual

Returns the bounding box of the dot.

Returns
The rectangle of the bounding box.

Implements LibBoard::Shape.

References _x, _y, LibBoard::IgnoreLineWidth, LibBoard::ShapeWithStyle::lineWidth(), and LibBoard::UseLineWidth.

◆ center()

Point LibBoard::Dot::center ( LineWidthFlag  lineWidthFlag = IgnoreLineWidth) const
overridevirtual

Returns the center of the shape.

Parameters
lineWidthFlagShould the line width be considered when computing bounding boxes.
Returns
The center of the shape, i.e. the center of its bounding box.

Reimplemented from LibBoard::Shape.

References _x, and _y.

Referenced by rotate(), and rotated().

◆ clone()

Dot * LibBoard::Dot::clone ( ) const
overridevirtual

Return a copy of the shape.

Returns
A copy of the shape.

Implements LibBoard::ShapeWithStyle.

◆ flushFIG()

void LibBoard::Dot::flushFIG ( std::ostream &  stream,
const TransformFIG &  transform,
std::map< Color, int > &  colormap 
) const
overridevirtual

◆ flushPostscript()

void LibBoard::Dot::flushPostscript ( std::ostream &  stream,
const TransformEPS &  transform 
) const
overridevirtual

Write the EPS code of the shape in a stream according to a transform.

Parameters
streamThe output stream.
transformA 2D transform to be applied.

Implements LibBoard::Shape.

References LibBoard::ShapeWithStyle::_style, _x, _y, LibBoard::Transform::mapX(), LibBoard::TransformEPS::mapY(), LibBoard::ShapeWithStyle::penColor(), LibBoard::Color::postscript(), and LibBoard::Style::postscriptProperties().

◆ flushSVG()

void LibBoard::Dot::flushSVG ( std::ostream &  stream,
const TransformSVG &  transform 
) const
overridevirtual

Write the SVG code of the shape in a stream according to a transform.

Parameters
streamThe output stream.
transformA 2D transform to be applied.

Implements LibBoard::Shape.

References LibBoard::ShapeWithStyle::_style, _x, _y, LibBoard::Transform::mapX(), LibBoard::TransformSVG::mapY(), and LibBoard::Style::svgProperties().

◆ flushTikZ()

void LibBoard::Dot::flushTikZ ( std::ostream &  stream,
const TransformTikZ &  transform 
) const
overridevirtual

Write the TikZ code of the shape in a stream according to a transform.

Parameters
streamThe output stream.
transformA 2D transform to be applied.

Implements LibBoard::Shape.

◆ name()

const std::string & LibBoard::Dot::name ( ) const
overridevirtual

Returns the generic name of the shape (e.g., Circle, Rectangle, etc.)

Returns

Reimplemented from LibBoard::Shape.

◆ operator=() [1/2]

Dot & LibBoard::Dot::operator= ( const Dot &  )
default

◆ operator=() [2/2]

Dot & LibBoard::Dot::operator= ( Dot &&  )
default

◆ rotate() [1/2]

Dot & LibBoard::Dot::rotate ( double  angle)
overridevirtual

Rotates the dot around its center (actually does nothing!).

Parameters
angleThe rotation angle.
Returns
A reference to the Dot itself.

Implements LibBoard::Shape.

◆ rotate() [2/2]

Dot & LibBoard::Dot::rotate ( double  angle,
const Point &  center 
)
overridevirtual

Rotates the dot around a given center of rotation.

Parameters
angleThe rotation angle.
centerThe center of rotation.
Returns
A reference to the Dot itself.

Implements LibBoard::Shape.

References _x, _y, center(), LibBoard::Point::get(), and LibBoard::Point::rotate().

Referenced by rotated().

◆ rotated() [1/2]

Dot LibBoard::Dot::rotated ( double  angle) const

Returns a copy of the dot rotated around its center (i.e. left unchanged!)

Parameters
angleThe rotation angle.
Returns
A copy of the dot.

◆ rotated() [2/2]

Dot LibBoard::Dot::rotated ( double  angle,
const Point &  center 
) const

Returns a rotated copy of the dot around a given rotation center.

Parameters
angleTh rotation angle.
centerThe center of rotation.
Returns
A rotated copy of the Dot.

References center(), and rotate().

◆ scale() [1/2]

Dot & LibBoard::Dot::scale ( double  s)
overridevirtual

Scale the dot, given a scaling factor.

Parameters
sScaling factor.
Returns
A reference to the dot itself, once scaled.

Implements LibBoard::Shape.

◆ scale() [2/2]

Dot & LibBoard::Dot::scale ( double  sx,
double  sy 
)
overridevirtual

Scale the dot, given two scaling factors.

Parameters
sxScaling factor along the x axis.
syScaling factor along the y axis.
Returns
A reference to the dot itself, once scaled.

Implements LibBoard::Shape.

◆ scaleAll()

void LibBoard::Dot::scaleAll ( double  s)
overridevirtual

Scales all the values (positions, dimensions, etc.) associated with the shape.

Parameters
sThe scaling factor.

Implements LibBoard::Shape.

References _x, and _y.

◆ scaled() [1/2]

Dot LibBoard::Dot::scaled ( double  s) const

Returns a scaled copy of the dot, i.e. the dot itself. (Dots are not actually scaled since their diameters is given by the line width.)

Parameters
sThe scaling factor.
Returns
A scaled copy of the Dot, i.e. the Dot itself.

◆ scaled() [2/2]

Dot LibBoard::Dot::scaled ( double  sx,
double  sy 
) const

Returns a scaled copy of the dot, i.e. the dot itself. (Dots are not actually scaled since their diameters is given by the line width.)

Parameters
sxThe scaling factor around the x axis.
syThe scaling factor around the y axis.
Returns
A scaled copy of the Dot, i.e. the Dot itself.

◆ translate()

Dot & LibBoard::Dot::translate ( double  dx,
double  dy 
)
overridevirtual

Translate the dot by a given offset.

Parameters
dxThe x offset.
dyThe y offset.
Returns
A reference to the dot itself.

Implements LibBoard::Shape.

References _x, and _y.

Referenced by translated().

◆ translated()

Dot LibBoard::Dot::translated ( double  dx,
double  dy 
) const

Returns a translated copy of the dot.

Parameters
dxShift of the first coordinate.
dyShift of the second coordinate.
Returns
A copy of the dot, translated.

References translate().

Member Data Documentation

◆ _x

double LibBoard::Dot::_x
protected

First coordinate of the dot.

Referenced by boundingBox(), center(), flushFIG(), flushPostscript(), flushSVG(), rotate(), scaleAll(), and translate().

◆ _y

double LibBoard::Dot::_y
protected

Second coordinate of the dot.

Referenced by boundingBox(), center(), flushFIG(), flushPostscript(), flushSVG(), rotate(), scaleAll(), and translate().


The documentation for this struct was generated from the following files: