Debian Codegraph @

src/lib/CDRPath.h

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