Board  0.9.2
Shapes.h
Go to the documentation of this file.
1 /* -*- mode: c++ -*- */
26 #ifndef _BOARD_SHAPES_H_
27 #define _BOARD_SHAPES_H_
28 
29 #include "board/Point.h"
30 #include "board/Rect.h"
31 #include "board/Path.h"
32 #include "board/Color.h"
33 #include "board/Transforms.h"
34 #include "board/PSFonts.h"
35 #include "board/Tools.h"
36 #include <string>
37 #include <vector>
38 #include <iostream>
39 #include <map>
40 #include <cmath>
41 
42 #ifndef M_PI
43 #define M_PI 3.14159265358979323846
44 #endif
45 
46 #ifndef M_PI_2
47 #define M_PI_2 1.57079632679489661923
48 #endif
49 
50 namespace LibBoard {
51 
56 struct Shape {
57 
58  enum LineCap { ButtCap = 0, RoundCap, SquareCap };
59  enum LineJoin { MiterJoin = 0, RoundJoin, BevelJoin };
60  enum LineStyle { SolidStyle = 0,
61  DashStyle,
62  DotStyle,
63  DashDotStyle,
64  DashDotDotStyle,
65  DashDotDotDotStyle };
66 
75  inline Shape( Color penColor, Color fillColor,
76  double lineWidth,
77  LineStyle style,
78  const LineCap cap,
79  const LineJoin join,
80  int depth );
81 
85  virtual ~Shape() { }
86 
92  virtual const std::string & name() const;
93 
99  virtual Shape * clone() const = 0;
100 
106  inline bool filled() const { return _fillColor != Color::None; }
107 
113  virtual Point center() const;
114 
123  virtual Shape & rotate( double angle, const Point & center ) = 0;
124 
132  virtual Shape & rotate( double angle ) = 0;
133 
142  inline Shape & rotateDeg( double angle, const Point & center );
143 
152  inline Shape & rotateDeg( double angle );
153 
162  virtual Shape & translate( double dx, double dy ) = 0;
163 
172  Shape & moveCenter( double x, double y );
173 
181  Shape & moveCenter( Point p );
182 
191  virtual Shape & scale( double sx, double sy ) = 0;
192 
200  virtual Shape & scale( double s ) = 0;
201 
207  virtual Rect boundingBox() const = 0;
208 
214  inline Rect bbox() const;
215 
221  inline Shape & operator--();
222 
228  inline Shape & operator++();
229 
236  virtual void scaleAll( double s ) = 0;
237 
245  virtual void flushPostscript( std::ostream & stream,
246  const TransformEPS & transform ) const = 0;
247 
255  virtual void flushFIG( std::ostream & stream,
256  const TransformFIG & transform,
257  std::map<Color,int> & colormap ) const = 0;
258 
265  virtual void flushSVG( std::ostream & stream,
266  const TransformSVG & transform ) const = 0;
267 
274  virtual void flushTikZ( std::ostream & stream,
275  const TransformTikZ & transform ) const = 0;
276 
277  inline int depth() const;
278 
279  virtual void depth( int );
280 
281  virtual void shiftDepth( int shift );
282 
283  inline const Color & penColor() const;
284 
285  inline const Color & fillColor() const;
286 
287 private:
288 
289  static const std::string _name;
291 protected:
292 
293  int _depth;
296  double _lineWidth;
297  LineStyle _lineStyle;
298  LineCap _lineCap;
299  LineJoin _lineJoin;
307  std::string svgProperties( const TransformSVG & transform ) const;
308 
309 
315  std::string postscriptProperties() const;
316 
322  std::string tikzProperties( const TransformTikZ & transform ) const;
323 
324 };
325 
334 struct Dot : public Shape {
335 
336  inline Dot( double x, double y,
337  Color color,
338  double lineWidth,
339  int depth = -1 );
340 
346  const std::string & name() const;
347 
348  Point center() const;
349 
358  Dot & rotate( double angle, const Point & center );
359 
368  Dot rotated( double angle, const Point & center ) const;
369 
377  Dot & rotate( double angle );
378 
386  Dot rotated( double angle ) const;
387 
396  Dot & translate( double dx, double dy );
397 
406  Dot translated( double dx, double dy ) const;
407 
416  Dot & scale( double sx, double sy );
417 
425  Dot & scale( double s );
426 
437  Dot scaled( double sx, double sy ) const;
438 
448  Dot scaled( double s ) const;
449 
456  void scaleAll( double s );
457 
458  void flushPostscript( std::ostream & stream,
459  const TransformEPS & transform ) const;
460 
461  void flushFIG( std::ostream & stream,
462  const TransformFIG & transform,
463  std::map<Color,int> & colormap ) const;
464 
465  void flushSVG( std::ostream & stream,
466  const TransformSVG & transform ) const;
467 
468  void flushTikZ( std::ostream & stream,
469  const TransformTikZ & transform ) const;
470 
471  Rect boundingBox() const;
472 
473  Dot * clone() const;
474 
475 private:
476 
477  static const std::string _name;
479 protected:
480  double _x;
481  double _y;
482 };
483 
488 struct Line : public Shape {
489 
501  inline Line( double x1, double y1, double x2, double y2,
502  Color color,
503  double lineWidth,
504  const LineStyle style = SolidStyle,
505  const LineCap cap = ButtCap,
506  const LineJoin join = MiterJoin,
507  int depth = -1 );
508 
514  const std::string & name() const;
515 
516  Point center() const;
517 
518  Line & rotate( double angle, const Point & center );
519 
528  Line rotated( double angle, const Point & center ) const;
529 
530  Line & rotate( double angle );
531 
539  Line rotated( double angle ) const;
540 
541 
550  Line & translate( double dx, double dy );
551 
560  Line translated( double dx, double dy ) const;
561 
570  Line & scale( double sx, double sy );
571 
579  Line & scale( double s );
580 
589  Line scaled( double sx, double sy ) const;
590 
598  Line scaled( double s ) const;
599 
606  void scaleAll( double s );
607 
608  void flushPostscript( std::ostream & stream,
609  const TransformEPS & transform ) const;
610 
611  void flushFIG( std::ostream & stream,
612  const TransformFIG & transform,
613  std::map<Color,int> & colormap ) const;
614 
615  void flushSVG( std::ostream & stream,
616  const TransformSVG & transform ) const;
617 
618  void flushTikZ( std::ostream & stream,
619  const TransformTikZ & transform ) const;
620 
621  Rect boundingBox() const;
622 
623  Line * clone() const;
624 
625 private:
626  static const std::string _name;
628 protected:
629  double _x1;
630  double _y1;
631  double _x2;
632  double _y2;
633 };
634 
639 struct Arrow : public Line {
640 
653  inline Arrow( double x1, double y1, double x2, double y2,
654  Color penColor, Color fillColor,
655  double lineWidth,
656  const LineStyle style = SolidStyle,
657  const LineCap cap = ButtCap,
658  const LineJoin join = MiterJoin,
659  int depth = -1 );
660 
666  const std::string & name() const;
667 
676  Arrow rotated( double angle, const Point & center ) const;
677 
685  Arrow rotated( double angle ) const;
686 
695  Arrow translated( double dx, double dy ) const;
696 
705  Arrow scaled( double sx, double sy ) const;
706 
714  Arrow scaled( double s ) const;
715 
716  void flushPostscript( std::ostream & stream,
717  const TransformEPS & transform ) const;
718 
719  void flushFIG( std::ostream & stream,
720  const TransformFIG & transform,
721  std::map<Color,int> & colormap ) const;
722 
723  void flushSVG( std::ostream & stream,
724  const TransformSVG & transform ) const;
725 
726  void flushTikZ( std::ostream & stream,
727  const TransformTikZ & transform ) const;
728 
729  Arrow * clone() const;
730 
731 private:
732  static const std::string _name;
733 };
734 
739 struct Polyline : public Shape {
740 
741  inline Polyline( const std::vector<Point> & points,
742  bool closed,
743  Color penColor, Color fillColor,
744  double lineWidth,
745  const LineStyle lineStyle = SolidStyle,
746  const LineCap cap = ButtCap,
747  const LineJoin join = MiterJoin,
748  int depth = -1 );
749 
750  inline Polyline( const Path & path,
751  Color penColor, Color fillColor,
752  double lineWidth,
753  const LineStyle lineStyle = SolidStyle,
754  const LineCap cap = ButtCap,
755  const LineJoin join = MiterJoin,
756  int depth = -1 );
757 
758  inline Polyline( bool closed, Color penColor, Color fillColor,
759  double lineWidth,
760  const LineStyle lineStyle = SolidStyle,
761  const LineCap cap = ButtCap,
762  const LineJoin join = MiterJoin,
763  int depth = -1 );
764 
770  const std::string & name() const;
771 
772  Point center() const;
773 
781  Polyline & operator<<( const Point & p );
782 
790  Point & operator[]( const std::size_t n ) {
791  return _path[ n ];
792  }
793 
801  const Point & operator[]( const std::size_t n ) const {
802  return _path[ n ];
803  }
804 
805  Polyline & rotate( double angle, const Point & center );
806 
815  Polyline rotated( double angle, const Point & center ) const;
816 
817  Polyline & rotate( double angle );
818 
826  Polyline rotated( double angle ) const;
827 
836  Polyline & translate( double dx, double dy );
837 
846  Polyline translated( double dx, double dy ) const;
847 
856  Polyline & scale( double sx, double sy );
857 
865  Polyline & scale( double s );
866 
875  Polyline scaled( double sx, double sy ) const;
876 
884  Polyline scaled( double s ) const;
885 
892  void scaleAll( double s );
893 
894  void flushPostscript( std::ostream & stream,
895  const TransformEPS & transform ) const;
896 
897  void flushFIG( std::ostream & stream,
898  const TransformFIG & transform,
899  std::map<Color,int> & colormap ) const;
900 
901  void flushSVG( std::ostream & stream,
902  const TransformSVG & transform ) const;
903 
904  void flushTikZ( std::ostream & stream,
905  const TransformTikZ & transform ) const;
906 
907  Rect boundingBox() const;
908 
909  Polyline * clone() const;
910 
911  inline std::size_t vertexCount() const;
912 
913 private:
914  static const std::string _name;
916 protected:
917  Path _path;
918 };
919 
924 struct Rectangle : public Polyline {
925 
926  inline Rectangle( double left, double top, double width, double height,
927  Color penColor, Color fillColor,
928  double lineWidth,
929  const LineStyle style = SolidStyle,
930  const LineCap cap = ButtCap,
931  const LineJoin join = MiterJoin,
932  int depth = -1 );
933 
934  inline Rectangle( const Rect & rect,
935  Color penColor, Color fillColor,
936  double lineWidth,
937  const LineStyle style = SolidStyle,
938  const LineCap cap = ButtCap,
939  const LineJoin join = MiterJoin,
940  int depth = -1 );
941 
947  const std::string & name() const;
948  double x() const { return _path[0].x; }
949  double y() const { return _path[0].y; }
950  double width() const { return (_path[1] - _path[0]).norm(); }
951  double height() const { return (_path[0] - _path[3]).norm(); }
952  Point topLeft() const { return Point( _path[0].x, _path[0].y ); }
953  Point topRight() const { return Point( _path[1].x, _path[1].y ); }
954  Point bottomLeft() const { return Point( _path[3].x, _path[3].y ); }
955  Point bottomRight() const { return Point( _path[2].x, _path[2].y ); }
956 
965  Rectangle rotated( double angle, const Point & center ) const;
966 
974  Rectangle rotated( double angle ) const;
975 
984  Rectangle translated( double dx, double dy ) const;
985 
994  Rectangle scaled( double sx, double sy ) const;
995 
1003  Rectangle scaled( double s ) const;
1004 
1011  void scaleAll( double s );
1012 
1013  void flushFIG( std::ostream & stream,
1014  const TransformFIG & transform,
1015  std::map<Color,int> & colormap ) const;
1016 
1017  void flushSVG( std::ostream & stream,
1018  const TransformSVG & transform ) const;
1019 
1020  void flushTikZ( std::ostream & stream,
1021  const TransformTikZ & transform ) const;
1022 
1023  Rectangle * clone() const;
1024 
1025 private:
1026  static const std::string _name;
1028 protected:
1029  bool _isRectangle;
1030 };
1031 
1032 
1037 struct Triangle : public Polyline {
1038 
1039  Triangle( const Point & p1, const Point & p2, const Point & p3,
1040  Color penColor, Color fillColor,
1041  double lineWidth,
1042  const LineStyle style = SolidStyle,
1043  const LineCap cap = ButtCap,
1044  const LineJoin join = MiterJoin,
1045  int depth = -1 )
1046  : Polyline( std::vector<Point>(), true, penColor, fillColor, lineWidth, style, cap, join, depth ) {
1047  _path << p1;
1048  _path << p2;
1049  _path << p3;
1050  }
1051 
1052  Triangle( const double x1, const double y1,
1053  const double x2, const double y2,
1054  const double x3, const double y3,
1055  Color penColor, Color fillColor,
1056  double lineWidth,
1057  const LineStyle style = SolidStyle,
1058  const LineCap cap = ButtCap,
1059  const LineJoin join = MiterJoin,
1060  int depth = -1 )
1061  : Polyline( std::vector<Point>(), true, penColor, fillColor, lineWidth, style, cap, join, depth ) {
1062  _path << Point( x1, y1 );
1063  _path << Point( x2, y2 );
1064  _path << Point( x3, y3 );
1065  }
1066 
1072  const std::string & name() const;
1073 
1074  Triangle rotated( double angle ) const;
1075 
1084  Triangle translated( double dx, double dy ) const;
1085 
1094  Triangle scaled( double sx, double sy ) const;
1095 
1103  Triangle scaled( double s ) const;
1104 
1105  Triangle * clone() const;
1106 
1107 private:
1108  static const std::string _name;
1110 protected:
1111 };
1112 
1113 
1118 struct GouraudTriangle : public Polyline {
1119 
1120 
1121  GouraudTriangle( const Point & p0, const Color & color0,
1122  const Point & p1, const Color & color1,
1123  const Point & p2, const Color & color2,
1124  int subdivisions,
1125  int depth = -1 );
1126 
1127  GouraudTriangle( const Point & p0, float brightness0,
1128  const Point & p1, float brightness1,
1129  const Point & p2, float brightness2,
1130  const Color & fillColor,
1131  int subdivisions,
1132  int depth = -1 );
1133 
1139  const std::string & name() const;
1140 
1141  Point center() const;
1142 
1143  GouraudTriangle & rotate( double angle, const Point & center );
1144 
1145  GouraudTriangle rotated( double angle, const Point & center ) const;
1146 
1147  GouraudTriangle & rotate( double angle );
1148 
1149  GouraudTriangle rotated( double angle ) const;
1150 
1159  GouraudTriangle translated( double dx, double dy ) const;
1160 
1169  GouraudTriangle scaled( double sx, double sy ) const;
1170 
1178  GouraudTriangle scaled( double s ) const;
1179 
1180 
1187  void scaleAll( double s );
1188 
1195  void flushPostscript( std::ostream & stream,
1196  const TransformEPS & transform ) const;
1197 
1210  void flushFIG( std::ostream & stream,
1211  const TransformFIG & transform,
1212  std::map<Color,int> & colormap ) const;
1213 
1214  void flushSVG( std::ostream & stream,
1215  const TransformSVG & transform ) const;
1216 
1217  void flushTikZ( std::ostream & stream,
1218  const TransformTikZ & transform ) const;
1219 
1220  GouraudTriangle * clone() const;
1221 
1222 private:
1223  static const std::string _name;
1225 protected:
1226  Color _color0;
1227  Color _color1;
1228  Color _color2;
1229  int _subdivisions;
1230 };
1231 
1236 struct Ellipse : public Shape {
1237 
1238  Ellipse( double x, double y,
1239  double xRadius, double yRadius,
1240  Color penColor, Color fillColor,
1241  double lineWidth,
1242  const LineStyle lineStyle = SolidStyle,
1243  int depth = -1 )
1244  : Shape( penColor, fillColor,
1245  lineWidth, lineStyle, ButtCap, MiterJoin, depth ),
1246  _center( x, y ), _xRadius( xRadius ), _yRadius( yRadius ),
1247  _angle( 0.0 ),
1248  _circle( false ) {
1249  while ( _angle > M_PI_2 ) _angle -= M_PI;
1250  while ( _angle < -M_PI_2 ) _angle += M_PI;
1251  }
1252 
1258  const std::string & name() const;
1259 
1260  Point center() const;
1261 
1262  Ellipse & rotate( double angle, const Point & center );
1263 
1272  Ellipse rotated( double angle, const Point & center ) const;
1273 
1274  Ellipse & rotate( double angle );
1275 
1283  Ellipse rotated( double angle ) const;
1284 
1293  Ellipse & translate( double dx, double dy );
1294 
1303  Ellipse translated( double dx, double dy ) const;
1304 
1313  Ellipse & scale( double sx, double sy );
1314 
1322  Ellipse & scale( double s );
1323 
1332  Ellipse scaled( double sx, double sy ) const;
1333 
1341  Ellipse scaled( double s ) const;
1342 
1349  void scaleAll( double s );
1350 
1351  void flushPostscript( std::ostream & stream,
1352  const TransformEPS & transform ) const;
1353 
1354  void flushFIG( std::ostream & stream,
1355  const TransformFIG & transform,
1356  std::map<Color,int> & colormap ) const;
1357 
1358  void flushSVG( std::ostream & stream,
1359  const TransformSVG & transform ) const;
1360 
1361  void flushTikZ( std::ostream & stream,
1362  const TransformTikZ & transform ) const;
1363 
1364  Rect boundingBox() const;
1365 
1366  Ellipse * clone() const;
1367 
1368 private:
1369  static const std::string _name;
1371 protected:
1372  Point _center;
1373  double _xRadius;
1374  double _yRadius;
1375  double _angle;
1376  bool _circle;
1377 };
1378 
1383 struct Circle : public Ellipse {
1384 
1385  Circle( double x, double y, double radius,
1386  Color penColor, Color fillColor,
1387  double lineWidth,
1388  const LineStyle style = SolidStyle,
1389  int depth = -1 )
1390  : Ellipse( x, y, radius, radius, penColor, fillColor, lineWidth, style, depth )
1391  { _circle = true; }
1392 
1398  const std::string & name() const;
1399 
1400  Point center() const;
1401 
1402  Circle & rotate( double angle, const Point & center );
1403 
1404  Circle rotated( double angle, const Point & center ) const;
1405 
1406  Circle & rotate( double angle );
1407 
1408  Circle rotated( double angle ) const;
1409 
1418  Circle & translate( double dx, double dy );
1419 
1428  Circle translated( double dx, double dy ) const;
1429 
1438  Circle & scale( double sx, double sy );
1439 
1447  Circle & scale( double s );
1448 
1457  Circle scaled( double sx, double sy ) const;
1458 
1466  Circle scaled( double s ) const;
1467 
1474  void scaleAll( double s );
1475 
1476  void flushSVG( std::ostream & stream,
1477  const TransformSVG & transform ) const;
1478 
1479  void flushTikZ( std::ostream & stream,
1480  const TransformTikZ & transform ) const;
1481 
1482  Circle * clone() const;
1483 
1484 private:
1485  static const std::string _name;
1486 };
1487 
1492 struct Text : public Shape {
1493 
1507  Text( double x, double y,
1508  const std::string & text,
1509  const Fonts::Font font,
1510  double size,
1511  Color color = Color::Black,
1512  int depth = -1 )
1513  : Shape( color, Color::None, 1.0, SolidStyle, ButtCap, MiterJoin, depth ),
1514  _position( x, y ), _text( text ), _font( font ),
1515  _angle( 0.0 ), _size( size ),
1516  _xScale( 1.0 ), _yScale( 1.0 ) { }
1517 
1518 
1533  Text( double x, double y,
1534  const std::string & text,
1535  const Fonts::Font font,
1536  const std::string & svgFont,
1537  double size,
1538  Color color = Color::Black,
1539  int depth = -1 )
1540  : Shape( color, Color::None, 1.0, SolidStyle, ButtCap, MiterJoin, depth ),
1541  _position( x, y ),
1542  _text( text ), _font( font ), _svgFont( svgFont ),
1543  _angle( 0.0 ),
1544  _size( size ),
1545  _xScale( 1.0 ), _yScale( 1.0 ) { }
1546 
1552  const std::string & name() const;
1553 
1554  Point center() const;
1555 
1556  Text & rotate( double angle, const Point & center );
1557 
1558  Text rotated( double angle, const Point & center ) const;
1559 
1560  Text & rotate( double angle );
1561 
1562  Text rotated( double angle ) const;
1563 
1572  Text & translate( double dx, double dy );
1573 
1582  Text translated( double dx, double dy ) const;
1583 
1592  Text & scale( double sx, double sy );
1593 
1601  Text & scale( double s );
1602 
1611  Text scaled( double sx, double sy ) const;
1612 
1620  Text scaled( double s ) const;
1621 
1628  void scaleAll( double s );
1629 
1630  void flushPostscript( std::ostream & stream,
1631  const TransformEPS & transform ) const;
1632 
1633  void flushFIG( std::ostream & stream,
1634  const TransformFIG & transform,
1635  std::map<Color,int> & colormap ) const;
1636 
1637  void flushSVG( std::ostream & stream,
1638  const TransformSVG & transform ) const;
1639 
1640  void flushTikZ( std::ostream & stream,
1641  const TransformTikZ & transform ) const;
1642 
1643  Rect boundingBox() const;
1644 
1645  Text * clone() const;
1646 
1647 private:
1648  static const std::string _name;
1650 protected:
1651  Point _position;
1652  std::string _text;
1653  Fonts::Font _font;
1654  std::string _svgFont;
1655  double _angle;
1656  double _size;
1657  double _xScale;
1658  double _yScale;
1659 };
1660 
1669 bool shapeGreaterDepth( const Shape *s1, const Shape *s2 );
1670 
1671 
1672 } // namespace LibBoard
1673 
1674 /*
1675  * Inline methods
1676  */
1677 #include "Shapes.ih"
1678 
1679 
1680 #endif /* _SHAPE_H_ */
1681 
Ellipse & translate(double dx, double dy)
Definition: Shapes.cpp:815
A circle.
Definition: Shapes.h:1383
Abstract structure for a 2D shape.
Definition: Shapes.h:56
Arrow translated(double dx, double dy) const
Definition: Shapes.cpp:583
GouraudTriangle translated(double dx, double dy) const
Definition: Shapes.cpp:1597
A line between two points.
Definition: Shapes.h:334
virtual Shape & rotate(double angle, const Point &center)=0
const std::string & name() const
Definition: Shapes.cpp:1031
Polyline * clone() const
Definition: Shapes.cpp:1252
Ellipse scaled(double sx, double sy) const
Definition: Shapes.cpp:884
Dot & scale(double sx, double sy)
Definition: Shapes.cpp:239
Structure representing an RGB triple.
Definition: Color.h:39
Shape(Color penColor, Color fillColor, double lineWidth, LineStyle style, const LineCap cap, const LineJoin join, int depth)
int _depth
Definition: Shapes.h:293
A piece of text.
Definition: Shapes.h:1492
A polygonal line described by a series of 2D points.
Definition: Shapes.h:739
An ellipse.
Definition: Shapes.h:1236
Structure representing a scaling and translation suitable for an TikZ output.
Definition: Transforms.h:130
virtual void flushFIG(std::ostream &stream, const TransformFIG &transform, std::map< Color, int > &colormap) const =0
virtual Shape & scale(double sx, double sy)=0
void flushFIG(std::ostream &stream, const TransformFIG &transform, std::map< Color, int > &colormap) const
Definition: Shapes.cpp:285
virtual Point center() const
Definition: Shapes.cpp:88
Dot rotated(double angle, const Point &center) const
Definition: Shapes.cpp:207
void flushPostscript(std::ostream &stream, const TransformEPS &transform) const
Definition: Shapes.cpp:909
Line * clone() const
Definition: Shapes.cpp:459
A line between two points with an arrow at one extremity.
Definition: Shapes.h:639
double _x1
Definition: Shapes.h:629
A triangle. Basically a Polyline with a convenient constructor.
Definition: Shapes.h:1037
Color _fillColor
Definition: Shapes.h:295
void flushTikZ(std::ostream &stream, const TransformTikZ &transform) const
Definition: Shapes.cpp:1944
Rect boundingBox() const
Definition: Shapes.cpp:1000
void flushTikZ(std::ostream &stream, const TransformTikZ &transform) const
Definition: Shapes.cpp:984
void flushPostscript(std::ostream &stream, const TransformEPS &transform) const
Definition: Shapes.cpp:1626
void flushTikZ(std::ostream &stream, const TransformTikZ &transform) const
Definition: Shapes.cpp:1329
Text & rotate(double angle, const Point &center)
Definition: Shapes.cpp:1791
void flushSVG(std::ostream &stream, const TransformSVG &transform) const
Definition: Shapes.cpp:1313
Definition: Board.h:40
Ellipse & scale(double sx, double sy)
Definition: Shapes.cpp:828
void flushTikZ(std::ostream &stream, const TransformTikZ &transform) const
Definition: Shapes.cpp:324
virtual void flushSVG(std::ostream &stream, const TransformSVG &transform) const =0
The Point structure. @copyright This source code is part of the Board project, a C++ library whose pu...
Triangle scaled(double sx, double sy) const
Definition: Shapes.cpp:1757
void flushSVG(std::ostream &stream, const TransformSVG &transform) const
Definition: Shapes.cpp:312
std::string postscriptProperties() const
Definition: Shapes.cpp:142
const std::string & name() const
Definition: Shapes.cpp:773
Ellipse * clone() const
Definition: Shapes.cpp:904
Arrow rotated(double angle, const Point &center) const
Definition: Shapes.cpp:564
Triangle * clone() const
Definition: Shapes.cpp:1769
Polyline & scale(double sx, double sy)
Definition: Shapes.cpp:1220
Color _penColor
Definition: Shapes.h:294
A path, according to Postscript and SVG definition.
Definition: Path.h:41
Arrow * clone() const
Definition: Shapes.cpp:611
Text(double x, double y, const std::string &text, const Fonts::Font font, const std::string &svgFont, double size, Color color=Color::Black, int depth=-1)
Definition: Shapes.h:1533
LineCap _lineCap
Definition: Shapes.h:298
Circle & translate(double dx, double dy)
Definition: Shapes.cpp:1074
const std::string & name() const
Definition: Shapes.cpp:189
std::string tikzProperties(const TransformTikZ &transform) const
Definition: Shapes.cpp:154
Line rotated(double angle, const Point &center) const
Definition: Shapes.cpp:375
Dot translated(double dx, double dy) const
Definition: Shapes.cpp:233
Rect boundingBox() const
Definition: Shapes.cpp:1343
Text scaled(double sx, double sy) const
Definition: Shapes.cpp:1856
virtual void flushPostscript(std::ostream &stream, const TransformEPS &transform) const =0
A line between two points.
Definition: Shapes.h:488
Struct representing a 2D point.
Definition: Point.h:38
Shape & operator--()
void scaleAll(double s)
Definition: Shapes.cpp:1114
Structure representing a scaling and translation suitable for an XFig output.
Definition: Transforms.h:87
Shape & moveCenter(double x, double y)
Definition: Shapes.cpp:95
Ellipse & rotate(double angle, const Point &center)
Definition: Shapes.cpp:784
void flushPostscript(std::ostream &stream, const TransformEPS &transform) const
Definition: Shapes.cpp:1257
void flushSVG(std::ostream &stream, const TransformSVG &transform) const
Definition: Shapes.cpp:966
void flushTikZ(std::ostream &stream, const TransformTikZ &transform) const
Definition: Shapes.cpp:1142
Polyline & rotate(double angle, const Point &center)
Definition: Shapes.cpp:1181
void flushFIG(std::ostream &stream, const TransformFIG &transform, std::map< Color, int > &colormap) const
Definition: Shapes.cpp:1281
Point center() const
Definition: Shapes.cpp:1567
Line & scale(double sx, double sy)
Definition: Shapes.cpp:411
GouraudTriangle * clone() const
Definition: Shapes.cpp:1621
void flushPostscript(std::ostream &stream, const TransformEPS &transform) const
Definition: Shapes.cpp:270
Polyline & operator<<(const Point &p)
Definition: Shapes.cpp:1169
Polyline rotated(double angle, const Point &center) const
Definition: Shapes.cpp:1188
Arrow scaled(double sx, double sy) const
Definition: Shapes.cpp:592
const std::string & name() const
Definition: Shapes.cpp:350
void flushTikZ(std::ostream &stream, const TransformTikZ &transform) const
Definition: Shapes.cpp:1725
Circle translated(double dx, double dy) const
Definition: Shapes.cpp:1081
void flushSVG(std::ostream &stream, const TransformSVG &transform) const
Definition: Shapes.cpp:1912
void flushSVG(std::ostream &stream, const TransformSVG &transform) const
Definition: Shapes.cpp:508
Shape & rotateDeg(double angle, const Point &center)
double _y1
Definition: Shapes.h:630
Line & rotate(double angle, const Point &center)
Definition: Shapes.cpp:361
void flushFIG(std::ostream &stream, const TransformFIG &transform, std::map< Color, int > &colormap) const
Definition: Shapes.cpp:938
Line translated(double dx, double dy) const
Definition: Shapes.cpp:402
@copyright This source code is part of the Board project, a C++ library whose purpose is to allow sim...
const std::string & name() const
Definition: Shapes.cpp:1163
Polyline translated(double dx, double dy) const
Definition: Shapes.cpp:1214
GouraudTriangle & rotate(double angle, const Point &center)
Definition: Shapes.cpp:1572
void scaleAll(double s)
Definition: Shapes.cpp:1391
Structure representing a scaling and translation suitable for an SVG output.
Definition: Transforms.h:109
Text * clone() const
Definition: Shapes.cpp:1874
Text translated(double dx, double dy) const
Definition: Shapes.cpp:1835
virtual Shape & translate(double dx, double dy)=0
virtual ~Shape()
Definition: Shapes.h:85
void flushSVG(std::ostream &stream, const TransformSVG &transform) const
Definition: Shapes.cpp:1692
@copyright This source code is part of the Board project, a C++ library whose purpose is to allow sim...
const std::string & name() const
Definition: Shapes.cpp:1355
Text & scale(double sx, double sy)
Definition: Shapes.cpp:1841
LineJoin _lineJoin
Definition: Shapes.h:299
double _x2
Definition: Shapes.h:631
void flushSVG(std::ostream &stream, const TransformSVG &transform) const
Definition: Shapes.cpp:1446
void flushPostscript(std::ostream &stream, const TransformEPS &transform) const
Definition: Shapes.cpp:464
void flushFIG(std::ostream &stream, const TransformFIG &transform, std::map< Color, int > &colormap) const
Definition: Shapes.cpp:670
Point & operator[](const std::size_t n)
Definition: Shapes.h:790
The Point structure. @copyright This source code is part of the Board project, a C++ library whose pu...
Point center() const
Definition: Shapes.cpp:356
Point center() const
Definition: Shapes.cpp:779
void scaleAll(double s)
Definition: Shapes.cpp:1868
double _y2
Definition: Shapes.h:632
Dot & rotate(double angle, const Point &center)
Definition: Shapes.cpp:200
const std::string & name() const
Definition: Shapes.cpp:558
void flushTikZ(std::ostream &stream, const TransformTikZ &transform) const
Definition: Shapes.cpp:1502
const std::string & name() const
Definition: Shapes.cpp:1780
Ellipse translated(double dx, double dy) const
Definition: Shapes.cpp:822
Circle scaled(double sx, double sy) const
Definition: Shapes.cpp:1102
void scaleAll(double s)
Definition: Shapes.cpp:263
A rectangle.
Definition: Shapes.h:924
The Color structure. @copyright This source code is part of the Board project, a C++ library whose pu...
Triangle translated(double dx, double dy) const
Definition: Shapes.cpp:1751
Shape & operator++()
const Point & operator[](const std::size_t n) const
Definition: Shapes.h:801
void flushPostscript(std::ostream &stream, const TransformEPS &transform) const
Definition: Shapes.cpp:616
Line(double x1, double y1, double x2, double y2, Color color, double lineWidth, const LineStyle style=SolidStyle, const LineCap cap=ButtCap, const LineJoin join=MiterJoin, int depth=-1)
virtual void flushTikZ(std::ostream &stream, const TransformTikZ &transform) const =0
Dot scaled(double sx, double sy) const
Definition: Shapes.cpp:251
Point center() const
Definition: Shapes.cpp:1786
Point center() const
Definition: Shapes.cpp:1176
double _x
Definition: Shapes.h:480
Text & translate(double dx, double dy)
Definition: Shapes.cpp:1828
Dot & translate(double dx, double dy)
Definition: Shapes.cpp:225
GouraudTriangle scaled(double sx, double sy) const
Definition: Shapes.cpp:1603
void scaleAll(double s)
Definition: Shapes.cpp:896
Rectangle translated(double dx, double dy) const
Definition: Shapes.cpp:1373
std::string svgProperties(const TransformSVG &transform) const
Definition: Shapes.cpp:111
@copyright This source code is part of the Board project, a C++ library whose purpose is to allow sim...
virtual void scaleAll(double s)=0
Arrow(double x1, double y1, double x2, double y2, Color penColor, Color fillColor, double lineWidth, const LineStyle style=SolidStyle, const LineCap cap=ButtCap, const LineJoin join=MiterJoin, int depth=-1)
Circle & rotate(double angle, const Point &center)
Definition: Shapes.cpp:1042
void flushFIG(std::ostream &stream, const TransformFIG &transform, std::map< Color, int > &colormap) const
Definition: Shapes.cpp:1892
const std::string & name() const
Definition: Shapes.cpp:1739
bool filled() const
Definition: Shapes.h:106
Line & translate(double dx, double dy)
Definition: Shapes.cpp:394
Line scaled(double sx, double sy) const
Definition: Shapes.cpp:431
Circle * clone() const
Definition: Shapes.cpp:1122
Text(double x, double y, const std::string &text, const Fonts::Font font, double size, Color color=Color::Black, int depth=-1)
Definition: Shapes.h:1507
virtual Rect boundingBox() const =0
Rect boundingBox() const
Definition: Shapes.cpp:2002
Ellipse rotated(double angle, const Point &center) const
Definition: Shapes.cpp:797
void flushFIG(std::ostream &stream, const TransformFIG &transform, std::map< Color, int > &colormap) const
Definition: Shapes.cpp:1655
@copyright This source code is part of the Board project, a C++ library whose purpose is to allow sim...
Circle & scale(double sx, double sy)
Definition: Shapes.cpp:1087
void flushPostscript(std::ostream &stream, const TransformEPS &transform) const
Definition: Shapes.cpp:1879
Polyline scaled(double sx, double sy) const
Definition: Shapes.cpp:1234
Structure representing a scaling and translation suitable for an EPS output.
Definition: Transforms.h:73
void flushTikZ(std::ostream &stream, const TransformTikZ &transform) const
Definition: Shapes.cpp:755
Rect bbox() const
Rect boundingBox() const
Definition: Shapes.cpp:531
void scaleAll(double s)
Definition: Shapes.cpp:1246
double _lineWidth
Definition: Shapes.h:296
void flushFIG(std::ostream &stream, const TransformFIG &transform, std::map< Color, int > &colormap) const
Definition: Shapes.cpp:1402
Rect boundingBox() const
Definition: Shapes.cpp:333
void scaleAll(double s)
Definition: Shapes.cpp:1615
Struct representing a rectangle on the plane.
Definition: Rect.h:38
Rectangle rotated(double angle, const Point &center) const
Definition: Shapes.cpp:1361
double _y
Definition: Shapes.h:481
virtual Shape * clone() const =0
LineStyle _lineStyle
Definition: Shapes.h:297
Dot * clone() const
Definition: Shapes.cpp:339
Rectangle * clone() const
Definition: Shapes.cpp:1397
Polyline & translate(double dx, double dy)
Definition: Shapes.cpp:1207
Rectangle scaled(double sx, double sy) const
Definition: Shapes.cpp:1379
Point center() const
Definition: Shapes.cpp:195
void flushTikZ(std::ostream &stream, const TransformTikZ &transform) const
Definition: Shapes.cpp:520
void scaleAll(double s)
Definition: Shapes.cpp:450
void flushSVG(std::ostream &stream, const TransformSVG &transform) const
Definition: Shapes.cpp:703
virtual const std::string & name() const
Definition: Shapes.cpp:82
A triangle with shaded filling according to colors given for each vertex.
Definition: Shapes.h:1118
void flushFIG(std::ostream &stream, const TransformFIG &transform, std::map< Color, int > &colormap) const
Definition: Shapes.cpp:479
Point center() const
Definition: Shapes.cpp:1037
const std::string & name() const
Definition: Shapes.cpp:1516
void flushSVG(std::ostream &stream, const TransformSVG &transform) const
Definition: Shapes.cpp:1127