14 #ifndef _BOARD_SHAPES_H_
15 #define _BOARD_SHAPES_H_
17 #include "Board/Point.h"
18 #include "Board/Rect.h"
19 #include "Board/Path.h"
20 #include "Board/Transforms.h"
21 #include "Board/PSFonts.h"
22 #include "Board/Tools.h"
29 #include "DGtal/io/Color.h"
33 #if defined(__clang__)
34 #pragma clang diagnostic push
35 #pragma clang diagnostic ignored "-Wdocumentation"
38 #if defined(__clang__)
39 #pragma clang diagnostic pop
44 #define M_PI 3.14159265358979323846
48 #define M_PI_2 1.57079632679489661923
97 virtual const std::string &
name()
const;
246 std::map<DGtal::Color,int> & colormap )
const = 0;
280 inline int depth()
const;
282 virtual void depth(
int );
381 return rotate( angle * ( M_PI / 180.0 ), aCenter );
400 inline Dot(
double x,
double y,
410 const std::string &
name()
const;
486 Dot scaled(
double sx,
double sy )
const;
501 void flushFIG( std::ostream & stream,
503 std::map<DGtal::Color,int> & colormap )
const;
505 void flushSVG( std::ostream & stream,
550 inline Line(
double x1,
double y1,
double x2,
double y2,
563 const std::string &
name()
const;
629 void flushFIG( std::ostream & stream,
631 std::map<DGtal::Color,int> & colormap )
const;
633 void flushSVG( std::ostream & stream,
682 inline Arrow(
double x1,
double y1,
double x2,
double y2,
695 const std::string &
name()
const;
741 void flushFIG( std::ostream & stream,
743 std::map<DGtal::Color,int> & colormap )
const;
744 void flushSVG( std::ostream & stream,
766 inline Polyline(
const std::vector<Point> & points,
795 const std::string &
name()
const;
882 void flushFIG( std::ostream & stream,
884 std::map<DGtal::Color,int> & colormap )
const;
886 void flushSVG( std::ostream & stream,
914 inline Rectangle(
double x,
double y,
double width,
double height,
935 const std::string &
name()
const;
996 void flushFIG( std::ostream & stream,
998 std::map<DGtal::Color,int> & colormap )
const;
1000 void flushSVG( std::ostream & stream,
1040 inline Image(
double x0,
double y0,
double width,
double height,
1041 std::string fileName,
int depthValue,
double alpha=1.0 );
1047 const std::string &
name()
const;
1051 void flushFIG( std::ostream & stream,
1053 std::map<DGtal::Color,int> & colormap )
const;
1055 void flushSVG( std::ostream & stream,
1094 int depthValue = -1 )
1095 :
Polyline( std::vector<
Point>(), true, pen, fill, lineWidth, style, cap, join, depthValue ) {
1102 const double x2,
const double y2,
1103 const double x3,
const double y3,
1110 int depthValue = -1 )
1111 :
Polyline( std::vector<
Point>(), true, pen, fill, lineWidth, style, cap, join, depthValue ) {
1122 const std::string &
name()
const;
1186 int depthValue = -1 )
1187 :
Triangle(x1, y1, x2, y2, x3, y3, pen, fill, lineWidth, style, cap, join, depthValue) {}
1192 void flushFIG( std::ostream & stream,
1194 std::map<DGtal::Color,int> & colormap )
const;
1196 void flushSVG( std::ostream & stream,
1212 const std::string &
name()
const;
1233 const Point & p1,
float brightness1,
1234 const Point & p2,
float brightness2,
1244 const std::string &
name()
const;
1307 void flushFIG( std::ostream & stream,
1309 std::map<DGtal::Color,int> & colormap )
const;
1311 void flushSVG( std::ostream & stream,
1341 double xRadius,
double yRadius,
1345 int depthValue = -1 )
1360 const std::string &
name()
const;
1426 void flushFIG( std::ostream & stream,
1428 std::map<DGtal::Color,int> & colormap )
const;
1430 void flushSVG( std::ostream & stream,
1466 int depthValue = -1 )
1467 :
Ellipse( x, y, radius, radius, pen, fill, lineWidth, style, depthValue )
1475 const std::string &
name()
const;
1507 void flushSVG( std::ostream & stream,
1530 Arc(
double x,
double y,
double radius,
double angle1,
double angle2,
bool negative,
1534 int depthValue = -1 )
1535 :
Circle( x, y, radius, pen, fill, lineWidth, style, depthValue )
1543 const std::string &
name()
const;
1589 const std::string & text,
1593 int depthValue = -1 )
1614 const std::string & text,
1616 const std::string & svgFont,
1619 int depthValue = -1 )
1632 const std::string &
name()
const;
1667 void flushFIG( std::ostream & stream,
1669 std::map<DGtal::Color,int> & colormap )
const;
1671 void flushSVG( std::ostream & stream,
1716 #include "Shapes.ih"
Structure representing an RGB triple with alpha component.
DGtal is the top-level namespace which contains all DGtal functions and types.
bool shapeGreaterDepth(const Shape *s1, const Shape *s2)
static const std::string _name
void flushPostscript(std::ostream &stream, const TransformEPS &transform) const
const std::string & name() const
void flushCairo(cairo_t *cr, const TransformCairo &transform) const
void flushSVG(std::ostream &stream, const TransformSVG &transform) const
Arc(double x, double y, double radius, double angle1, double angle2, bool negative, DGtal::Color pen, DGtal::Color fill, double lineWidth, const LineStyle style=SolidStyle, int depthValue=-1)
void flushTikZ(std::ostream &stream, const TransformTikZ &transform) const
A line between two points with an arrow at one extremity.
Arrow(double x1, double y1, double x2, double y2, DGtal::Color penColor, DGtal::Color fillColor, double lineWidth, const LineStyle style=SolidStyle, const LineCap cap=ButtCap, const LineJoin join=MiterJoin, int depth=-1)
Arrow translated(double dx, double dy) const
void flushSVG(std::ostream &stream, const TransformSVG &transform) const
void flushFIG(std::ostream &stream, const TransformFIG &transform, std::map< DGtal::Color, int > &colormap) const
static const std::string _name
void flushCairo(cairo_t *cr, const TransformCairo &transform) const
void flushTikZ(std::ostream &stream, const TransformTikZ &transform) const
Arrow rotated(double angle, const Point ¢er) const
void flushPostscript(std::ostream &stream, const TransformEPS &transform) const
Arrow scaled(double sx, double sy) const
const std::string & name() const
const std::string & name() const
Circle & translate(double dx, double dy)
Circle rotated(double angle, const Point ¢er) const
static const std::string _name
Circle & rotate(double angle, const Point ¢er)
Circle translated(double dx, double dy) const
Shape & scale(double sx, double sy)
void flushCairo(cairo_t *cr, const TransformCairo &transform) const
void flushSVG(std::ostream &stream, const TransformSVG &transform) const
Circle(double x, double y, double radius, DGtal::Color pen, DGtal::Color fill, double lineWidth, const LineStyle style=SolidStyle, int depthValue=-1)
Circle scaled(double sx, double sy) const
void flushTikZ(std::ostream &stream, const TransformTikZ &transform) const
A line between two points.
void flushFIG(std::ostream &stream, const TransformFIG &transform, std::map< DGtal::Color, int > &colormap) const
Dot(double x, double y, DGtal::Color color, double lineWidth, int depth=-1)
Dot scaled(double sx, double sy) const
Dot & rotate(double angle, const Point ¢er)
void flushPostscript(std::ostream &stream, const TransformEPS &transform) const
void flushCairo(cairo_t *cr, const TransformCairo &transform) const
Dot translated(double dx, double dy) const
static const std::string _name
void flushTikZ(std::ostream &stream, const TransformTikZ &transform) const
Dot & translate(double dx, double dy)
Shape & scale(double sx, double sy)
void flushSVG(std::ostream &stream, const TransformSVG &transform) const
const std::string & name() const
Dot rotated(double angle, const Point ¢er) const
static const std::string _name
void flushTikZ(std::ostream &stream, const TransformTikZ &transform) const
Shape & scale(double sx, double sy)
void flushFIG(std::ostream &stream, const TransformFIG &transform, std::map< DGtal::Color, int > &colormap) const
void flushSVG(std::ostream &stream, const TransformSVG &transform) const
const std::string & name() const
void flushCairo(cairo_t *cr, const TransformCairo &transform) const
void flushPostscript(std::ostream &stream, const TransformEPS &transform) const
Ellipse & rotate(double angle, const Point ¢er)
Ellipse(double x, double y, double xRadius, double yRadius, DGtal::Color pen, DGtal::Color fill, double lineWidth, const LineStyle lineStyle=SolidStyle, int depthValue=-1)
Ellipse scaled(double sx, double sy) const
Ellipse rotated(double angle, const Point ¢er) const
Ellipse & translate(double dx, double dy)
Ellipse translated(double dx, double dy) const
A triangle with shaded filling according to colors given for each vertex.
GouraudTriangle * clone() const
GouraudTriangle rotated(double angle, const Point ¢er) const
GouraudTriangle scaled(double sx, double sy) const
GouraudTriangle & rotate(double angle, const Point ¢er)
void flushSVG(std::ostream &stream, const TransformSVG &transform) const
void flushFIG(std::ostream &stream, const TransformFIG &transform, std::map< DGtal::Color, int > &colormap) const
void flushTikZ(std::ostream &stream, const TransformTikZ &transform) const
GouraudTriangle translated(double dx, double dy) const
GouraudTriangle(const Point &p0, const DGtal::Color &color0, const Point &p1, const DGtal::Color &color1, const Point &p2, const DGtal::Color &color2, int subdivisions, int depth=-1)
void flushPostscript(std::ostream &stream, const TransformEPS &transform) const
void flushCairo(cairo_t *cr, const TransformCairo &transform) const
const std::string & name() const
static const std::string _name
Used to draw image in figure.
void flushFIG(std::ostream &stream, const TransformFIG &transform, std::map< DGtal::Color, int > &colormap) const
const std::string & name() const
void flushSVG(std::ostream &stream, const TransformSVG &transform) const
void flushTikZ(std::ostream &stream, const TransformTikZ &transform) const
void flushCairo(cairo_t *cr, const TransformCairo &transform) const
static const std::string _name
Image(double x0, double y0, double width, double height, std::string fileName, int depthValue, double alpha=1.0)
A line between two points.
Line & rotate(double angle, const Point ¢er)
Line(double x1, double y1, double x2, double y2, DGtal::Color color, double lineWidth, const LineStyle style=SolidStyle, const LineCap cap=ButtCap, const LineJoin join=MiterJoin, int depth=-1)
Line rotated(double angle, const Point ¢er) const
void flushPostscript(std::ostream &stream, const TransformEPS &transform) const
void flushTikZ(std::ostream &stream, const TransformTikZ &transform) const
void flushSVG(std::ostream &stream, const TransformSVG &transform) const
Line translated(double dx, double dy) const
Line & translate(double dx, double dy)
void flushFIG(std::ostream &stream, const TransformFIG &transform, std::map< DGtal::Color, int > &colormap) const
Shape & scale(double sx, double sy)
static const std::string _name
void flushCairo(cairo_t *cr, const TransformCairo &transform) const
const std::string & name() const
Line scaled(double sx, double sy) const
A path, according to Postscript and SVG definition.
Struct representing a 2D point.
A polygonal line described by a series of 2D points.
void flushSVG(std::ostream &stream, const TransformSVG &transform) const
Polyline rotated(double angle, const Point ¢er) const
const std::string & name() const
void flushCairo(cairo_t *cr, const TransformCairo &transform) const
Shape & scale(double sx, double sy)
Polyline & operator<<(const Point &p)
Polyline translated(double dx, double dy) const
Polyline & rotate(double angle, const Point ¢er)
Point & operator[](const unsigned int n)
Polyline(const std::vector< Point > &points, bool closed, DGtal::Color penColor, DGtal::Color fillColor, double lineWidth, const LineStyle lineStyle=SolidStyle, const LineCap cap=ButtCap, const LineJoin join=MiterJoin, int depth=-1)
void flushFIG(std::ostream &stream, const TransformFIG &transform, std::map< DGtal::Color, int > &colormap) const
void flushTikZ(std::ostream &stream, const TransformTikZ &transform) const
Polyline(bool closed, DGtal::Color penColor, DGtal::Color fillColor, double lineWidth, const LineStyle lineStyle=SolidStyle, const LineCap cap=ButtCap, const LineJoin join=MiterJoin, int depth=-1)
Polyline & translate(double dx, double dy)
Polyline scaled(double sx, double sy) const
void flushPostscript(std::ostream &stream, const TransformEPS &transform) const
Polyline(const Path &path, DGtal::Color penColor, DGtal::Color fillColor, double lineWidth, const LineStyle lineStyle=SolidStyle, const LineCap cap=ButtCap, const LineJoin join=MiterJoin, int depth=-1)
static const std::string _name
A quadratic Bezier curve having 3 control points. NB. It is also a parabola arc.
void flushSVG(std::ostream &stream, const TransformSVG &transform) const
const std::string & name() const
void flushCairo(cairo_t *cr, const TransformCairo &transform) const
static const std::string _name
void flushPostscript(std::ostream &stream, const TransformEPS &transform) const
void flushTikZ(std::ostream &stream, const TransformTikZ &transform) const
QuadraticBezierCurve(double x1, double y1, double x2, double y2, double x3, double y3, DGtal::Color pen, DGtal::Color fill, double lineWidth, const LineStyle style=SolidStyle, const LineCap cap=ButtCap, const LineJoin join=MiterJoin, int depthValue=-1)
void flushFIG(std::ostream &stream, const TransformFIG &transform, std::map< DGtal::Color, int > &colormap) const
Struct representing a rectangle on the plane.
Rectangle rotated(double angle, const Point ¢er) const
Rectangle scaled(double sx, double sy) const
Rectangle(double x, double y, double width, double height, DGtal::Color penColor, DGtal::Color fillColor, double lineWidth, const LineStyle style=SolidStyle, const LineCap cap=ButtCap, const LineJoin join=MiterJoin, int depth=-1)
Rectangle translated(double dx, double dy) const
Rectangle * clone() const
Rectangle(const Rect &rect, DGtal::Color penColor, DGtal::Color fillColor, double lineWidth, const LineStyle style=SolidStyle, const LineCap cap=ButtCap, const LineJoin join=MiterJoin, int depth=-1)
void flushCairo(cairo_t *cr, const TransformCairo &transform) const
void flushTikZ(std::ostream &stream, const TransformTikZ &transform) const
const std::string & name() const
void flushFIG(std::ostream &stream, const TransformFIG &transform, std::map< DGtal::Color, int > &colormap) const
static const std::string _name
void flushSVG(std::ostream &stream, const TransformSVG &transform) const
Abstract structure for a 2D shape.
std::string svgProperties(const TransformSVG &transform) const
virtual void flushCairo(cairo_t *cr, const TransformCairo &transform) const =0
virtual void flushFIG(std::ostream &stream, const TransformFIG &transform, std::map< DGtal::Color, int > &colormap) const =0
virtual void flushTikZ(std::ostream &stream, const TransformTikZ &transform) const =0
virtual void scaleAll(double s)=0
virtual void shiftDepth(int shift)
virtual void flushPostscript(std::ostream &stream, const TransformEPS &transform) const =0
const DGtal::Color & penColor() const
std::string postscriptProperties() const
virtual const std::string & name() const
virtual Rect boundingBox() const =0
Shape & rotateDeg(double angle, const Point ¢er)
Shape(DGtal::Color penColor, DGtal::Color fillColor, double lineWidth, LineStyle style, const LineCap cap, const LineJoin join, int depth)
std::string tikzProperties(const TransformTikZ &transform) const
virtual Shape & translate(double dx, double dy)=0
virtual Shape & scale(double sx, double sy)=0
static const std::string _name
virtual Point center() const =0
void setCairoDashStyle(cairo_t *cr, LineStyle type) const
virtual Shape * clone() const =0
virtual Shape & scale(double s)=0
virtual Shape & rotate(double angle, const Point ¢er)=0
virtual void flushSVG(std::ostream &stream, const TransformSVG &transform) const =0
const DGtal::Color & fillColor() const
virtual Shape & rotate(double angle)=0
void flushSVG(std::ostream &stream, const TransformSVG &transform) const
Text & translate(double dx, double dy)
Text(double x, double y, const std::string &text, const Fonts::Font font, double size, DGtal::Color color=DGtal::Color::Black, int depthValue=-1)
Text scaled(double sx, double sy) const
const std::string & name() const
static const std::string _name
Text translated(double dx, double dy) const
void flushFIG(std::ostream &stream, const TransformFIG &transform, std::map< DGtal::Color, int > &colormap) const
Text rotated(double angle, const Point ¢er) const
void flushTikZ(std::ostream &stream, const TransformTikZ &transform) const
void flushPostscript(std::ostream &stream, const TransformEPS &transform) const
Text & rotate(double angle, const Point ¢er)
Text(double x, double y, const std::string &text, const Fonts::Font font, const std::string &svgFont, double size, DGtal::Color color=DGtal::Color::Black, int depthValue=-1)
Shape & scale(double sx, double sy)
void flushCairo(cairo_t *cr, const TransformCairo &transform) const
A triangle. Basically a Polyline with a convenient constructor.
Triangle(const double x1, const double y1, const double x2, const double y2, const double x3, const double y3, DGtal::Color pen, DGtal::Color fill, double lineWidth, const LineStyle style=SolidStyle, const LineCap cap=ButtCap, const LineJoin join=MiterJoin, int depthValue=-1)
static const std::string _name
Triangle translated(double dx, double dy) const
Triangle(const Point &p1, const Point &p2, const Point &p3, DGtal::Color pen, DGtal::Color fill, double lineWidth, const LineStyle style=SolidStyle, const LineCap cap=ButtCap, const LineJoin join=MiterJoin, int depthValue=-1)
Triangle rotated(double angle) const
const std::string & name() const
Triangle scaled(double sx, double sy) const