CDRTransforms.h Source File documentation

CDRTransforms.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /*
3 * This file is part of the libcdr project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
9
10 #ifndef __CDRTRANSFORMS_H__
11 #define __CDRTRANSFORMS_H__
12
13 #include <vector>
14 #include <math.h>
15 #include <librevenge/librevenge.h>
16
17 namespace libcdr
18 {
19 class CDRPath;
20
21 class CDRTransform
22 {
23 public:
24 CDRTransform();
25 CDRTransform(double v0, double v1, double x0, double v3, double v4, double y0);
26 CDRTransform(const CDRTransform &trafo);
27
28 void applyToPoint(double &x, double &y) const;
29 void applyToArc(double &rx, double &ry, double &rotation, bool &sweep, double &endx, double &endy) const;
30 double getScaleX() const;
31 double getScaleY() const;
32 double getTranslateX() const;
33 double getTranslateY() const;
34 bool getFlipX() const;
35 bool getFlipY() const;
36
37 librevenge::RVNGString toString() const;
38
39 private:
40 double _getScaleX() const;
41 double _getScaleY() const;
42 double m_v0;
43 double m_v1;
44 double m_x0;
45 double m_v3;
46 double m_v4;
47 double m_y0;
48 };
49
50 class CDRTransforms
51 {
52 public:
53 CDRTransforms();
54 CDRTransforms(const CDRTransforms &trafos);
55 ~CDRTransforms();
56
57 void append(double v0, double v1, double x0, double v3, double v4, double y0);
58 void append(const CDRTransform &trafo);
59 void clear();
60 bool empty() const;
61
62 void applyToPoint(double &x, double &y) const;
63 void applyToArc(double &rx, double &ry, double &rotation, bool &sweep, double &x, double &y) const;
64 double getScaleX() const;
65 double getScaleY() const;
66 double getTranslateX() const;
67 double getTranslateY() const;
68 bool getFlipX() const;
69 bool getFlipY() const;
70
71 private:
72 double _getScaleX() const;
73 double _getScaleY() const;
74 std::vector<CDRTransform> m_trafos;
75 };
76
77 } // namespace libcdr
78
79 #endif /* __CDRTRANSFORMS_H__ */
80 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libcdr::CDRTransforms::getScaleY
double getScaleY() const
Definition: CDRTransforms.cpp:298
libcdr::CDRTransforms::_getScaleY
double _getScaleY() const
Definition: CDRTransforms.cpp:287
libcdr::CDRTransforms::empty
bool empty() const
Definition: CDRTransforms.cpp:249
libcdr::CDRTransform::getScaleX
double getScaleX() const
Definition: CDRTransforms.cpp:165
libcdr::CDRTransforms::applyToArc
void applyToArc(double &rx, double &ry, double &rotation, bool &sweep, double &x, double &y) const
Definition: CDRTransforms.cpp:260
libcdr::CDRTransform::m_v1
double m_v1
Definition: CDRTransforms.h:43
libcdr::CDRTransform::getFlipY
bool getFlipY() const
Definition: CDRTransforms.cpp:191
libcdr::CDRTransforms::CDRTransforms
CDRTransforms()
Definition: CDRTransforms.cpp:220
libcdr::CDRTransform
Definition: CDRTransforms.h:21
libcdr::CDRTransform::toString
librevenge::RVNGString toString() const
Definition: CDRTransforms.cpp:212
libcdr::CDRTransform::applyToArc
void applyToArc(double &rx, double &ry, double &rotation, bool &sweep, double &endx, double &endy) const
Definition: CDRTransforms.cpp:38
libcdr::CDRTransforms::append
void append(double v0, double v1, double x0, double v3, double v4, double y0)
Definition: CDRTransforms.cpp:234
libcdr::CDRTransform::getTranslateY
double getTranslateY() const
Definition: CDRTransforms.cpp:204
libcdr::CDRTransform::applyToPoint
void applyToPoint(double &x, double &y) const
Definition: CDRTransforms.cpp:31
libcdr::CDRTransform::getScaleY
double getScaleY() const
Definition: CDRTransforms.cpp:186
libcdr::CDRTransform::getFlipX
bool getFlipX() const
Definition: CDRTransforms.cpp:170
libcdr::CDRTransforms::getScaleX
double getScaleX() const
Definition: CDRTransforms.cpp:277
libcdr::CDRTransform::CDRTransform
CDRTransform()
Definition: CDRTransforms.cpp:15
libcdr
Definition: CDRCollector.h:29
libcdr::CDRTransform::m_v3
double m_v3
Definition: CDRTransforms.h:45
libcdr::CDRTransforms::clear
void clear()
Definition: CDRTransforms.cpp:244
libcdr::CDRTransforms::getTranslateY
double getTranslateY() const
Definition: CDRTransforms.cpp:316
libcdr::CDRTransform::getTranslateX
double getTranslateX() const
Definition: CDRTransforms.cpp:196
libcdr::CDRTransform::m_v4
double m_v4
Definition: CDRTransforms.h:46
libcdr::CDRTransforms::applyToPoint
void applyToPoint(double &x, double &y) const
Definition: CDRTransforms.cpp:254
libcdr::CDRTransforms::getFlipY
bool getFlipY() const
Definition: CDRTransforms.cpp:303
libcdr::CDRTransform::m_v0
double m_v0
Definition: CDRTransforms.h:42
libcdr::CDRTransform::m_y0
double m_y0
Definition: CDRTransforms.h:47
libcdr::CDRTransform::_getScaleX
double _getScaleX() const
Definition: CDRTransforms.cpp:154
libcdr::CDRTransforms::getTranslateX
double getTranslateX() const
Definition: CDRTransforms.cpp:308
libcdr::CDRTransforms::getFlipX
bool getFlipX() const
Definition: CDRTransforms.cpp:282
libcdr::CDRTransform::m_x0
double m_x0
Definition: CDRTransforms.h:44
libcdr::CDRTransforms::_getScaleX
double _getScaleX() const
Definition: CDRTransforms.cpp:266
libcdr::CDRTransforms::m_trafos
std::vector< CDRTransform > m_trafos
Definition: CDRTransforms.h:74
libcdr::CDRTransforms::~CDRTransforms
~CDRTransforms()
Definition: CDRTransforms.cpp:230
libcdr::CDRTransforms
Definition: CDRTransforms.h:50
libcdr::CDRTransform::_getScaleY
double _getScaleY() const
Definition: CDRTransforms.cpp:175