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 <librevenge/librevenge.h>
15
16 namespace libcdr
17 {
18
19 class CDRTransform
20 {
21 public:
22 CDRTransform();
23 CDRTransform(double v0, double v1, double x0, double v3, double v4, double y0);
24 CDRTransform(const CDRTransform &trafo);
25
26 void applyToPoint(double &x, double &y) const;
27 void applyToArc(double &rx, double &ry, double &rotation, bool &sweep, double &endx, double &endy) const;
28 double getScaleX() const;
29 double getScaleY() const;
30 double getTranslateX() const;
31 double getTranslateY() const;
32 bool getFlipX() const;
33 bool getFlipY() const;
34
35 librevenge::RVNGString toString() const;
36
37 private:
38 double _getScaleX() const;
39 double _getScaleY() const;
40 double m_v0;
41 double m_v1;
42 double m_x0;
43 double m_v3;
44 double m_v4;
45 double m_y0;
46 };
47
48 class CDRTransforms
49 {
50 public:
51 CDRTransforms();
52 CDRTransforms(const CDRTransforms &trafos);
53 ~CDRTransforms();
54
55 void append(double v0, double v1, double x0, double v3, double v4, double y0);
56 void append(const CDRTransform &trafo);
57 void clear();
58 bool empty() const;
59
60 void applyToPoint(double &x, double &y) const;
61 void applyToArc(double &rx, double &ry, double &rotation, bool &sweep, double &x, double &y) const;
62 double getScaleX() const;
63 double getScaleY() const;
64 double getTranslateX() const;
65 double getTranslateY() const;
66 bool getFlipX() const;
67 bool getFlipY() const;
68
69 private:
70 double _getScaleX() const;
71 double _getScaleY() const;
72 std::vector<CDRTransform> m_trafos;
73 };
74
75 } // namespace libcdr
76
77 #endif /* __CDRTRANSFORMS_H__ */
78 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libcdr::CDRTransform::m_v4
double m_v4
Definition: CDRTransforms.h:44
libcdr::CDRTransform::m_v1
double m_v1
Definition: CDRTransforms.h:41
libcdr::CDRTransform::getTranslateY
double getTranslateY() const
Definition: CDRTransforms.cpp:204
libcdr::CDRTransforms::clear
void clear()
Definition: CDRTransforms.cpp:244
libcdr::CDRTransform::m_y0
double m_y0
Definition: CDRTransforms.h:45
libcdr::CDRTransforms::_getScaleY
double _getScaleY() const
Definition: CDRTransforms.cpp:287
libcdr::CDRTransform::m_v3
double m_v3
Definition: CDRTransforms.h:43
libcdr::CDRTransforms::CDRTransforms
CDRTransforms()
Definition: CDRTransforms.cpp:220
libcdr::CDRTransform::getScaleX
double getScaleX() const
Definition: CDRTransforms.cpp:165
CDRTransforms.h
libcdr::CDRTransform
Definition: CDRTransforms.h:19
libcdr::CDRTransform::applyToPoint
void applyToPoint(double &x, double &y) const
Definition: CDRTransforms.cpp:31
libcdr::CDRTransforms::getTranslateY
double getTranslateY() const
Definition: CDRTransforms.cpp:316
libcdr::CDRTransform::getFlipY
bool getFlipY() const
Definition: CDRTransforms.cpp:191
libcdr::CDRTransform::getScaleY
double getScaleY() const
Definition: CDRTransforms.cpp:186
libcdr::CDRTransform::getTranslateX
double getTranslateX() const
Definition: CDRTransforms.cpp:196
libcdr::CDRTransforms::getTranslateX
double getTranslateX() const
Definition: CDRTransforms.cpp:308
libcdr::CDRTransform::CDRTransform
CDRTransform()
Definition: CDRTransforms.cpp:15
libcdr
Definition: CDRCollector.h:24
libcdr::CDRTransform::getFlipX
bool getFlipX() const
Definition: CDRTransforms.cpp:170
libcdr::CDRTransforms::applyToPoint
void applyToPoint(double &x, double &y) const
Definition: CDRTransforms.cpp:254
libcdr::CDRTransforms::getScaleX
double getScaleX() const
Definition: CDRTransforms.cpp:277
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::CDRTransforms::~CDRTransforms
~CDRTransforms()
Definition: CDRTransforms.cpp:230
CDR_ALMOST_ZERO
#define CDR_ALMOST_ZERO(m)
Definition: libcdr_utils.h:31
libcdr::CDRTransforms::getFlipX
bool getFlipX() const
Definition: CDRTransforms.cpp:282
libcdr::CDRTransform::toString
librevenge::RVNGString toString() const
Definition: CDRTransforms.cpp:212
libcdr::CDRTransforms
Definition: CDRTransforms.h:48
libcdr::CDRTransform::m_v0
double m_v0
Definition: CDRTransforms.h:40
libcdr::CDRTransforms::_getScaleX
double _getScaleX() const
Definition: CDRTransforms.cpp:266
M_PI
#define M_PI
Definition: libcdr_utils.h:27
libcdr::CDRTransforms::empty
bool empty() const
Definition: CDRTransforms.cpp:249
libcdr::CDRTransforms::getFlipY
bool getFlipY() const
Definition: CDRTransforms.cpp:303
libcdr::CDRTransform::_getScaleX
double _getScaleX() const
Definition: CDRTransforms.cpp:154
libcdr::CDRTransforms::m_trafos
std::vector< CDRTransform > m_trafos
Definition: CDRTransforms.h:72
libcdr::CDRTransforms::getScaleY
double getScaleY() const
Definition: CDRTransforms.cpp:298
libcdr::CDRTransform::_getScaleY
double _getScaleY() const
Definition: CDRTransforms.cpp:175
libcdr_utils.h
libcdr::CDRTransform::m_x0
double m_x0
Definition: CDRTransforms.h:42
libcdr::CDRTransforms::applyToArc
void applyToArc(double &rx, double &ry, double &rotation, bool &sweep, double &x, double &y) const
Definition: CDRTransforms.cpp:260