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"
37 #define M_PI 3.14159265358979323846
41 #define M_PI_2 1.57079632679489661923
87 virtual const std::string &
name()
const;
167 virtual Shape &
scale(
double sx,
double sy ) = 0;
214 virtual void scaleAll(
double s ) = 0;
225 const TransformEPS & transform )
const = 0;
234 virtual void flushFIG( std::ostream & stream,
235 const TransformFIG & transform,
236 std::map<DGtal::Color,int> & colormap )
const = 0;
245 virtual void flushSVG( std::ostream & stream,
246 const TransformSVG & transform )
const = 0;
256 virtual void flushCairo( cairo_t *cr,
257 const TransformCairo & transform )
const = 0;
267 virtual void flushTikZ( std::ostream & stream,
268 const TransformTikZ & transform )
const = 0;
270 inline int depth()
const;
272 virtual void depth(
int );
281 static const std::string
_name;
299 std::string
svgProperties(
const TransformSVG & transform )
const;
316 void setCairoDashStyle(cairo_t *cr,
LineStyle type)
const;
324 std::string
tikzProperties(
const TransformTikZ & transform )
const;
371 return rotate( angle * ( M_PI / 180.0 ), aCenter );
388 struct Dot :
public Shape {
390 inline Dot(
double x,
double y,
400 const std::string &
name()
const;
476 Dot scaled(
double sx,
double sy )
const;
489 const TransformEPS & transform )
const;
491 void flushFIG( std::ostream & stream,
492 const TransformFIG & transform,
493 std::map<DGtal::Color,int> & colormap )
const;
495 void flushSVG( std::ostream & stream,
496 const TransformSVG & transform )
const;
499 void flushCairo( cairo_t *cr,
500 const TransformCairo & transform )
const;
504 const TransformTikZ & transform )
const;
511 static const std::string
_name;
522 struct Line :
public Shape {
535 inline Line(
double x1,
double y1,
double x2,
double y2,
548 const std::string &
name()
const;
612 const TransformEPS & transform )
const;
614 void flushFIG( std::ostream & stream,
615 const TransformFIG & transform,
616 std::map<DGtal::Color,int> & colormap )
const;
618 void flushSVG( std::ostream & stream,
619 const TransformSVG & transform )
const;
622 void flushCairo( cairo_t *cr,
623 const TransformCairo & transform )
const;
627 const TransformTikZ & transform )
const;
634 static const std::string
_name;
650 struct Arrow :
public Line {
664 inline Arrow(
double x1,
double y1,
double x2,
double y2,
677 const std::string &
name()
const;
721 const TransformEPS & transform )
const;
723 void flushFIG( std::ostream & stream,
724 const TransformFIG & transform,
725 std::map<DGtal::Color,int> & colormap )
const;
726 void flushSVG( std::ostream & stream,
727 const TransformSVG & transform )
const;
730 void flushCairo( cairo_t *cr,
731 const TransformCairo & transform )
const;
735 const TransformTikZ & transform )
const;
740 static const std::string
_name;
747 struct Polyline :
public Shape {
748 inline Polyline(
const std::vector<Point> & points,
777 const std::string &
name()
const;
862 const TransformEPS & transform )
const;
864 void flushFIG( std::ostream & stream,
865 const TransformFIG & transform,
866 std::map<DGtal::Color,int> & colormap )
const;
868 void flushSVG( std::ostream & stream,
869 const TransformSVG & transform )
const;
872 void flushCairo( cairo_t *cr,
873 const TransformCairo & transform )
const;
877 const TransformTikZ & transform )
const;
884 static const std::string
_name;
894 struct Rectangle :
public Polyline {
896 inline Rectangle(
double x,
double y,
double width,
double height,
917 const std::string &
name()
const;
919 double x()
const {
return _path[0].x; }
920 double y()
const {
return _path[0].y; }
978 void flushFIG( std::ostream & stream,
979 const TransformFIG & transform,
980 std::map<DGtal::Color,int> & colormap )
const;
982 void flushSVG( std::ostream & stream,
983 const TransformSVG & transform )
const;
986 void flushCairo( cairo_t *cr,
987 const TransformCairo & transform )
const;
991 const TransformTikZ & transform )
const;
996 static const std::string
_name;
1008 struct Image :
public Rectangle {
1022 inline Image(
double x0,
double y0,
double width,
double height,
1023 std::string fileName,
int depthValue,
double alpha=1.0 );
1029 const std::string &
name()
const;
1031 Image *
clone()
const;
1033 void flushFIG( std::ostream & stream,
1034 const TransformFIG & transform,
1035 std::map<DGtal::Color,int> & colormap )
const;
1037 void flushSVG( std::ostream & stream,
1038 const TransformSVG & transform )
const;
1041 void flushCairo( cairo_t *cr,
1042 const TransformCairo & transform )
const;
1046 const TransformTikZ & transform )
const;
1050 static const std::string
_name;
1067 struct Triangle :
public Polyline {
1076 int depthValue = -1 )
1077 :
Polyline( std::vector<
Point>(), true, pen, fill, lineWidth, style, cap, join, depthValue ) {
1083 Triangle(
const double x1,
const double y1,
1084 const double x2,
const double y2,
1085 const double x3,
const double y3,
1092 int depthValue = -1 )
1093 :
Polyline( std::vector<
Point>(), true, pen, fill, lineWidth, style, cap, join, depthValue ) {
1104 const std::string &
name()
const;
1133 static const std::string
_name;
1143 struct GouraudTriangle :
public Polyline {
1153 const Point & p1,
float brightness1,
1154 const Point & p2,
float brightness2,
1164 const std::string &
name()
const;
1214 const TransformEPS & transform )
const;
1228 void flushFIG( std::ostream & stream,
1229 const TransformFIG & transform,
1230 std::map<DGtal::Color,int> & colormap )
const;
1232 void flushSVG( std::ostream & stream,
1233 const TransformSVG & transform )
const;
1236 void flushCairo( cairo_t *cr,
1237 const TransformCairo & transform )
const;
1241 const TransformTikZ & transform )
const;
1246 static const std::string
_name;
1259 struct Ellipse :
public Shape {
1262 double xRadius,
double yRadius,
1266 int depthValue = -1 )
1281 const std::string &
name()
const;
1345 const TransformEPS & transform )
const;
1347 void flushFIG( std::ostream & stream,
1348 const TransformFIG & transform,
1349 std::map<DGtal::Color,int> & colormap )
const;
1351 void flushSVG( std::ostream & stream,
1352 const TransformSVG & transform )
const;
1355 void flushCairo( cairo_t *cr,
1356 const TransformCairo & transform )
const;
1360 const TransformTikZ & transform )
const;
1367 static const std::string
_name;
1381 struct Circle :
public Ellipse {
1383 Circle(
double x,
double y,
double radius,
1387 int depthValue = -1 )
1388 :
Ellipse( x, y, radius, radius, pen, fill, lineWidth, style, depthValue )
1396 const std::string &
name()
const;
1428 void flushSVG( std::ostream & stream,
1429 const TransformSVG & transform )
const;
1432 void flushCairo( cairo_t *cr,
1433 const TransformCairo & transform )
const;
1437 const TransformTikZ & transform )
const;
1442 static const std::string
_name;
1449 struct Arc :
public Circle {
1451 Arc(
double x,
double y,
double radius,
double angle1,
double angle2,
bool negative,
1455 int depthValue = -1 )
1456 :
Circle( x, y, radius, pen, fill, lineWidth, style, depthValue )
1464 const std::string &
name()
const;
1467 const TransformEPS & transform )
const;
1470 const TransformSVG & transform )
const;
1473 void flushCairo( cairo_t *cr,
1474 const TransformCairo & transform )
const;
1479 const TransformTikZ & transform )
const;
1482 static const std::string
_name;
1495 struct Text :
public Shape {
1510 Text(
double x,
double y,
1511 const std::string & text,
1515 int depthValue = -1 )
1536 Text(
double x,
double y,
1537 const std::string & text,
1539 const std::string & svgFont,
1542 int depthValue = -1 )
1555 const std::string &
name()
const;
1588 const TransformEPS & transform )
const;
1590 void flushFIG( std::ostream & stream,
1591 const TransformFIG & transform,
1592 std::map<DGtal::Color,int> & colormap )
const;
1594 void flushSVG( std::ostream & stream,
1595 const TransformSVG & transform )
const;
1598 void flushCairo( cairo_t *cr,
1599 const TransformCairo & transform )
const;
1603 const TransformTikZ & transform )
const;
1610 static const std::string
_name;
1639 #include "Shapes.ih"