DGtal 1.3.0
Loading...
Searching...
No Matches
Transforms.h
1/* -*- mode: c++ -*- */
9/*
10 * \@copyright This File is part of the Board library which is
11 * licensed under the terms of the GNU Lesser General Public Licence.
12 * See the LICENCE file for further details.
13 */
14#ifndef _BOARD_TRANSFORMS_H_
15#define _BOARD_TRANSFORMS_H_
16
17#include <limits>
18#include <vector>
19#include <cmath>
20
21namespace LibBoard {
22
23struct Rect;
24struct Shape;
25struct ShapeList;
26
31struct Transform {
32public:
33 inline Transform();
34 virtual ~Transform() { };
35 virtual double mapX( double x ) const;
36 virtual double mapY( double y ) const = 0;
37 virtual void apply( double & x, double & y ) const;
38 virtual double scale( double x ) const;
39 virtual double rounded( double x ) const;
40 virtual void setBoundingBox( const Rect & rect,
41 const double pageWidth,
42 const double pageHeight,
43 const double margin ) = 0;
44
45 static inline double round( const double & x );
46
47protected:
48 double _scale;
49 double _deltaX;
50 double _deltaY;
51 double _height;
52};
53
59struct TransformEPS : public Transform {
60public:
61 double mapY( double y ) const;
62 void setBoundingBox( const Rect & rect,
63 const double pageWidth,
64 const double pageHeight,
65 const double margin );
66};
67
73struct TransformFIG : public Transform {
74public:
75 inline TransformFIG();
76 double rounded( double x ) const;
77 double mapY( double y ) const;
78 int mapWidth( double width ) const;
79 void setBoundingBox( const Rect & rect,
80 const double pageWidth,
81 const double pageHeight,
82 const double margin );
83 void setDepthRange( const ShapeList & shapes );
84 int mapDepth( int depth ) const;
85private:
88};
89
95struct TransformSVG : public Transform {
96public:
97 double rounded( double x ) const;
98 double mapY( double y ) const;
99 double mapWidth( double width ) const;
100 void setBoundingBox( const Rect & rect,
101 const double pageWidth,
102 const double pageHeight,
103 const double margin );
104};
105
106#ifdef WITH_CAIRO
112struct TransformCairo : public Transform {
113public:
114 double rounded( double x ) const;
115 double mapY( double y ) const;
116 double mapWidth( double width ) const;
117 void setBoundingBox( const Rect & rect,
118 const double pageWidth,
119 const double pageHeight,
120 const double margin );
121};
122#endif
123
130};
131
132#include "Transforms.ih"
133
134} // namespace LibBoard
135
136#endif /* _TRANSFORMS_H_ */
Struct representing a rectangle on the plane.
Definition: Rect.h:26
A group of shapes.
Definition: ShapeList.h:28
Structure representing a scaling and translation suitable for an Cairo output.
Definition: Transforms.h:112
void setBoundingBox(const Rect &rect, const double pageWidth, const double pageHeight, const double margin)
Definition: Transforms.cpp:247
double mapY(double y) const
Definition: Transforms.cpp:234
double mapWidth(double width) const
Definition: Transforms.cpp:240
double rounded(double x) const
Definition: Transforms.cpp:228
Structure representing a scaling and translation suitable for an EPS output.
Definition: Transforms.h:59
double mapY(double y) const
Definition: Transforms.cpp:62
void setBoundingBox(const Rect &rect, const double pageWidth, const double pageHeight, const double margin)
Definition: Transforms.cpp:68
Structure representing a scaling and translation suitable for an XFig output.
Definition: Transforms.h:73
int mapWidth(double width) const
Definition: Transforms.cpp:111
int mapDepth(int depth) const
Definition: Transforms.cpp:158
void setBoundingBox(const Rect &rect, const double pageWidth, const double pageHeight, const double margin)
Definition: Transforms.cpp:121
double rounded(double x) const
Definition: Transforms.cpp:99
double mapY(double y) const
Definition: Transforms.cpp:105
void setDepthRange(const ShapeList &shapes)
Definition: Transforms.cpp:151
Structure representing a scaling and translation suitable for an SVG output.
Definition: Transforms.h:95
double mapWidth(double width) const
Definition: Transforms.cpp:188
void setBoundingBox(const Rect &rect, const double pageWidth, const double pageHeight, const double margin)
Definition: Transforms.cpp:195
double rounded(double x) const
Definition: Transforms.cpp:176
double mapY(double y) const
Definition: Transforms.cpp:182
Structure representing a scaling and translation suitable for an TikZ output.
Definition: Transforms.h:129
base class for transforms.
Definition: Transforms.h:31
virtual double mapX(double x) const
Definition: Transforms.cpp:39
virtual void apply(double &x, double &y) const
Definition: Transforms.cpp:51
virtual void setBoundingBox(const Rect &rect, const double pageWidth, const double pageHeight, const double margin)=0
virtual ~Transform()
Definition: Transforms.h:34
virtual double mapY(double y) const =0
virtual double rounded(double x) const
Definition: Transforms.cpp:33
static double round(const double &x)
Astroid2D< Space > Shape