Board  0.9.2
Transforms.h
Go to the documentation of this file.
1 /* -*- mode: c++ -*- */
26 #ifndef _BOARD_TRANSFORMS_H_
27 #define _BOARD_TRANSFORMS_H_
28 
29 #include <limits>
30 #include <vector>
31 #include <cmath>
32 #include "TransformMatrix.h"
33 
34 namespace LibBoard {
35 
36 struct Rect;
37 struct Shape;
38 struct ShapeList;
39 
44 struct Transform {
45 public:
46  inline Transform();
47  virtual ~Transform() { };
48  virtual double mapX( double x ) const;
49  virtual double mapY( double y ) const = 0;
50  Point map( const Point & ) const;
51  virtual void apply( double & x, double & y ) const;
52  virtual double scale( double x ) const;
53  virtual double rounded( double x ) const;
54  virtual void setBoundingBox( const Rect & rect,
55  const double pageWidth,
56  const double pageHeight,
57  const double margin ) = 0;
58 
59  static inline double round( const double & x );
60 
61 protected:
62  double _scale;
63  double _deltaX;
64  double _deltaY;
65  double _height;
66 };
67 
73 struct TransformEPS : public Transform {
74 public:
75  double mapY( double y ) const;
76  void setBoundingBox( const Rect & rect,
77  const double pageWidth,
78  const double pageHeight,
79  const double margin );
80 };
81 
87 struct TransformFIG : public Transform {
88 public:
89  inline TransformFIG();
90  double rounded( double x ) const;
91  double mapY( double y ) const;
92  int mapWidth( double width ) const;
93  void setBoundingBox( const Rect & rect,
94  const double pageWidth,
95  const double pageHeight,
96  const double margin );
97  void setDepthRange( const ShapeList & shapes );
98  int mapDepth( int depth ) const;
99 private:
100  int _maxDepth;
101  int _minDepth;
102 };
103 
109 struct TransformSVG : public Transform {
110 public:
111  double rounded( double x ) const;
112  double mapY( double y ) const;
113  double mapWidth( double width ) const;
114  void setBoundingBox( const Rect & rect,
115  const double pageWidth,
116  const double pageHeight,
117  const double margin );
118  TransformMatrix matrix() const;
119  Point translation() const;
120  double deltaX() const;
121  double deltaY() const;
122 
123 };
124 
130 struct TransformTikZ : public TransformSVG {
131 };
132 
133 
134 #include "Transforms.ih"
135 
136 } // namespace LibBoard
137 
138 #endif /* _TRANSFORMS_H_ */
Definition: TransformMatrix.h:35
Definition: Transforms.h:44
Structure representing a scaling and translation suitable for an TikZ output.
Definition: Transforms.h:130
Definition: Board.h:40
Struct representing a 2D point.
Definition: Point.h:38
Structure representing a scaling and translation suitable for an XFig output.
Definition: Transforms.h:87
Structure representing a scaling and translation suitable for an SVG output.
Definition: Transforms.h:109
A group of shapes.
Definition: ShapeList.h:41
Structure representing a scaling and translation suitable for an EPS output.
Definition: Transforms.h:73
@copyright This source code is part of the Board project, a C++ library whose purpose is to allow sim...
Struct representing a rectangle on the plane.
Definition: Rect.h:38