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 <memory>
14#include <utility>
15#include <vector>
16#include <librevenge/librevenge.h>
17
18namespace libcdr
19{
20
21class CDRTransform;
22class CDRTransforms;
23
25{
26public:
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
36class CDRPath : public CDRPathElement
37{
38public:
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
64private:
65 std::vector<std::unique_ptr<CDRPathElement>> m_elements;
67};
68
69} // namespace libcdr
70
71#endif /* __CDRPATH_H__ */
72/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
virtual void transform(const CDRTransform &trafo)=0
CDRPathElement()
Definition CDRPath.h:27
virtual void writeOut(librevenge::RVNGPropertyListVector &vec) const =0
virtual void transform(const CDRTransforms &trafos)=0
virtual ~CDRPathElement()
Definition CDRPath.h:28
virtual std::unique_ptr< CDRPathElement > clone()=0
Definition CDRPath.h:37
void appendPath(const CDRPath &path)
Definition CDRPath.cpp:694
void appendArcTo(double rx, double ry, double rotation, bool longAngle, bool sweep, double x, double y)
Definition CDRPath.cpp:656
CDRPath & operator=(const CDRPath &path)
Definition CDRPath.cpp:678
std::unique_ptr< CDRPathElement > clone() override
Definition CDRPath.cpp:860
void appendMoveTo(double x, double y)
Definition CDRPath.cpp:636
bool isClosed() const
Definition CDRPath.cpp:876
void writeOut(librevenge::RVNGPropertyListVector &vec) const override
Definition CDRPath.cpp:700
void appendSplineTo(const std::vector< std::pair< double, double > > &points)
Definition CDRPath.cpp:661
bool empty() const
Definition CDRPath.cpp:871
bool m_isClosed
Definition CDRPath.h:66
~CDRPath() override
Definition CDRPath.cpp:690
CDRPath()
Definition CDRPath.h:39
void appendQuadraticBezierTo(double x1, double y1, double x, double y)
Definition CDRPath.cpp:651
void appendLineTo(double x, double y)
Definition CDRPath.cpp:641
void transform(const CDRTransforms &trafos) override
Definition CDRPath.cpp:848
std::vector< std::unique_ptr< CDRPathElement > > m_elements
Definition CDRPath.h:65
void appendCubicBezierTo(double x1, double y1, double x2, double y2, double x, double y)
Definition CDRPath.cpp:646
void appendClosePath()
Definition CDRPath.cpp:666
void clear()
Definition CDRPath.cpp:865
Definition CDRTransforms.h:20
Definition CDRTransforms.h:51
Definition CDRCollector.h:25

Generated for libcdr by doxygen 1.14.0