CDRPath.h Source File documentation

CDRPath.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 __CDRPATH_H__
11 #define __CDRPATH_H__
12
13 #include <vector>
14 #include <librevenge/librevenge.h>
15
16 namespace libcdr
17 {
18
19 class CDRTransform;
20 class CDRTransforms;
21
22 class CDRPathElement
23 {
24 public:
25 CDRPathElement() {}
26 virtual ~CDRPathElement() {}
27 virtual void writeOut(librevenge::RVNGPropertyListVector &vec) const = 0;
28 virtual void transform(const CDRTransforms &trafos) = 0;
29 virtual void transform(const CDRTransform &trafo) = 0;
30 virtual CDRPathElement *clone() = 0;
31 };
32
33
34 class CDRPath : public CDRPathElement
35 {
36 public:
37 CDRPath() : m_elements(), m_isClosed(false) {}
38 CDRPath(const CDRPath &path);
39 ~CDRPath() override;
40
41 CDRPath &operator=(const CDRPath &path);
42
43 void appendMoveTo(double x, double y);
44 void appendLineTo(double x, double y);
45 void appendCubicBezierTo(double x1, double y1, double x2, double y2, double x, double y);
46 void appendQuadraticBezierTo(double x1, double y1, double x, double y);
47 void appendSplineTo(std::vector<std::pair<double, double> > &points);
48 void appendArcTo(double rx, double ry, double rotation, bool longAngle, bool sweep, double x, double y);
49 void appendClosePath();
50 void appendPath(const CDRPath &path);
51
52 void writeOut(librevenge::RVNGPropertyListVector &vec) const override;
53 void writeOut(librevenge::RVNGString &path, librevenge::RVNGString &viewBox, double &width) const;
54 void transform(const CDRTransforms &trafos) override;
55 void transform(const CDRTransform &trafo) override;
56 CDRPathElement *clone() override;
57
58 void clear();
59 bool empty() const;
60 bool isClosed() const;
61
62 private:
63 std::vector<CDRPathElement *> m_elements;
64 bool m_isClosed;
65 };
66
67 } // namespace libcdr
68
69 #endif /* __CDRPATH_H__ */
70 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libcdr::CDRPath::operator=
CDRPath & operator=(const CDRPath &path)
Definition: CDRPath.cpp:679
libcdr::CDRPath::clear
void clear()
Definition: CDRPath.cpp:868
libcdr::CDRPath::empty
bool empty() const
Definition: CDRPath.cpp:877
libcdr::CDRPathElement::~CDRPathElement
virtual ~CDRPathElement()
Definition: CDRPath.h:26
libcdr::CDRPath::isClosed
bool isClosed() const
Definition: CDRPath.cpp:882
libcdr::CDRPath
Definition: CDRPath.h:34
libcdr::CDRPath::appendLineTo
void appendLineTo(double x, double y)
Definition: CDRPath.cpp:641
libcdr::CDRPath::CDRPath
CDRPath()
Definition: CDRPath.h:37
libcdr::CDRPath::appendSplineTo
void appendSplineTo(std::vector< std::pair< double, double > > &points)
Definition: CDRPath.cpp:661
libcdr::CDRPath::appendMoveTo
void appendMoveTo(double x, double y)
Definition: CDRPath.cpp:636
libcdr::CDRPath::appendPath
void appendPath(const CDRPath &path)
Definition: CDRPath.cpp:697
libcdr::CDRTransform
Definition: CDRTransforms.h:21
libcdr::CDRPath::appendCubicBezierTo
void appendCubicBezierTo(double x1, double y1, double x2, double y2, double x, double y)
Definition: CDRPath.cpp:646
libcdr::CDRPath::appendQuadraticBezierTo
void appendQuadraticBezierTo(double x1, double y1, double x, double y)
Definition: CDRPath.cpp:651
libcdr::CDRPathElement::transform
virtual void transform(const CDRTransforms &trafos)=0
libcdr::CDRPath::appendArcTo
void appendArcTo(double rx, double ry, double rotation, bool longAngle, bool sweep, double x, double y)
Definition: CDRPath.cpp:656
libcdr::CDRPath::appendClosePath
void appendClosePath()
Definition: CDRPath.cpp:666
libcdr
Definition: CDRCollector.h:29
libcdr::CDRPath::writeOut
void writeOut(librevenge::RVNGPropertyListVector &vec) const override
Definition: CDRPath.cpp:703
libcdr::CDRPath::~CDRPath
~CDRPath() override
Definition: CDRPath.cpp:692
libcdr::CDRPathElement::clone
virtual CDRPathElement * clone()=0
libcdr::CDRPath::clone
CDRPathElement * clone() override
Definition: CDRPath.cpp:863
libcdr::CDRPathElement::CDRPathElement
CDRPathElement()
Definition: CDRPath.h:25
libcdr::CDRPath::m_isClosed
bool m_isClosed
Definition: CDRPath.h:64
libcdr::CDRPathElement
Definition: CDRPath.h:22
libcdr::CDRPath::m_elements
std::vector< CDRPathElement * > m_elements
Definition: CDRPath.h:63
libcdr::CDRPathElement::writeOut
virtual void writeOut(librevenge::RVNGPropertyListVector &vec) const =0
libcdr::CDRPath::transform
void transform(const CDRTransforms &trafos) override
Definition: CDRPath.cpp:851
libcdr::CDRTransforms
Definition: CDRTransforms.h:50