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) = default;
25
26 CDRTransform &operator=(const CDRTransform &trafo) = default;
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) = default;
55 ~CDRTransforms();
56
57 CDRTransforms &operator=(const CDRTransforms &trafo) = default;
58
59 void append(double v0, double v1, double x0, double v3, double v4, double y0);
60 void append(const CDRTransform &trafo);
61 void clear();
62 bool empty() const;
63
64 void applyToPoint(double &x, double &y) const;
65 void applyToArc(double &rx, double &ry, double &rotation, bool &sweep, double &x, double &y) const;
66 double getScaleX() const;
67 double getScaleY() const;
68 double getTranslateX() const;
69 double getTranslateY() const;
70 bool getFlipX() const;
71 bool getFlipY() const;
72
73 private:
74 double _getScaleX() const;
75 double _getScaleY() const;
76 std::vector<CDRTransform> m_trafos;
77};
78
79} // namespace libcdr
80
81#endif /* __CDRTRANSFORMS_H__ */
82/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libcdr::CDRTransform
Definition: CDRTransforms.h:20
libcdr::CDRTransform::CDRTransform
CDRTransform()
Definition: CDRTransforms.cpp:15
libcdr::CDRTransform::getTranslateY
double getTranslateY() const
Definition: CDRTransforms.cpp:199
libcdr::CDRTransform::getScaleX
double getScaleX() const
Definition: CDRTransforms.cpp:160
libcdr::CDRTransform::m_v3
double m_v3
Definition: CDRTransforms.h:45
libcdr::CDRTransform::m_y0
double m_y0
Definition: CDRTransforms.h:47
libcdr::CDRTransform::applyToPoint
void applyToPoint(double &x, double &y) const
Definition: CDRTransforms.cpp:26
libcdr::CDRTransform::applyToArc
void applyToArc(double &rx, double &ry, double &rotation, bool &sweep, double &endx, double &endy) const
Definition: CDRTransforms.cpp:33
libcdr::CDRTransform::operator=
CDRTransform & operator=(const CDRTransform &trafo)=default
libcdr::CDRTransform::_getScaleX
double _getScaleX() const
Definition: CDRTransforms.cpp:149
libcdr::CDRTransform::m_v1
double m_v1
Definition: CDRTransforms.h:43
libcdr::CDRTransform::getFlipY
bool getFlipY() const
Definition: CDRTransforms.cpp:186
libcdr::CDRTransform::getTranslateX
double getTranslateX() const
Definition: CDRTransforms.cpp:191
libcdr::CDRTransform::m_v4
double m_v4
Definition: CDRTransforms.h:46
libcdr::CDRTransform::m_x0
double m_x0
Definition: CDRTransforms.h:44
libcdr::CDRTransform::getFlipX
bool getFlipX() const
Definition: CDRTransforms.cpp:165
libcdr::CDRTransform::getScaleY
double getScaleY() const
Definition: CDRTransforms.cpp:181
libcdr::CDRTransform::m_v0
double m_v0
Definition: CDRTransforms.h:42
libcdr::CDRTransform::toString
librevenge::RVNGString toString() const
Definition: CDRTransforms.cpp:207
libcdr::CDRTransform::_getScaleY
double _getScaleY() const
Definition: CDRTransforms.cpp:170
libcdr::CDRTransform::CDRTransform
CDRTransform(const CDRTransform &trafo)=default
libcdr::CDRTransforms
Definition: CDRTransforms.h:51
libcdr::CDRTransforms::~CDRTransforms
~CDRTransforms()
Definition: CDRTransforms.cpp:220
libcdr::CDRTransforms::getTranslateX
double getTranslateX() const
Definition: CDRTransforms.cpp:298
libcdr::CDRTransforms::m_trafos
std::vector< CDRTransform > m_trafos
Definition: CDRTransforms.h:76
libcdr::CDRTransforms::applyToArc
void applyToArc(double &rx, double &ry, double &rotation, bool &sweep, double &x, double &y) const
Definition: CDRTransforms.cpp:250
libcdr::CDRTransforms::operator=
CDRTransforms & operator=(const CDRTransforms &trafo)=default
libcdr::CDRTransforms::clear
void clear()
Definition: CDRTransforms.cpp:234
libcdr::CDRTransforms::CDRTransforms
CDRTransforms(const CDRTransforms &trafos)=default
libcdr::CDRTransforms::applyToPoint
void applyToPoint(double &x, double &y) const
Definition: CDRTransforms.cpp:244
libcdr::CDRTransforms::empty
bool empty() const
Definition: CDRTransforms.cpp:239
libcdr::CDRTransforms::getFlipX
bool getFlipX() const
Definition: CDRTransforms.cpp:272
libcdr::CDRTransforms::getTranslateY
double getTranslateY() const
Definition: CDRTransforms.cpp:306
libcdr::CDRTransforms::getFlipY
bool getFlipY() const
Definition: CDRTransforms.cpp:293
libcdr::CDRTransforms::getScaleX
double getScaleX() const
Definition: CDRTransforms.cpp:267
libcdr::CDRTransforms::_getScaleX
double _getScaleX() const
Definition: CDRTransforms.cpp:256
libcdr::CDRTransforms::getScaleY
double getScaleY() const
Definition: CDRTransforms.cpp:288
libcdr::CDRTransforms::_getScaleY
double _getScaleY() const
Definition: CDRTransforms.cpp:277
libcdr::CDRTransforms::CDRTransforms
CDRTransforms()
Definition: CDRTransforms.cpp:215
libcdr::CDRTransforms::append
void append(double v0, double v1, double x0, double v3, double v4, double y0)
Definition: CDRTransforms.cpp:224
libcdr
Definition: CDRDocument.h:17