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 
23 {
24 public:
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();
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;
53  void writeOut(librevenge::RVNGString &path, librevenge::RVNGString &viewBox, double &width) const;
54  void transform(const CDRTransforms &trafos);
55  void transform(const CDRTransform &trafo);
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: */
CDRPath & operator=(const CDRPath &path)
Definition: CDRPath.cpp:685
void clear()
Definition: CDRPath.cpp:874
virtual ~CDRPathElement()
Definition: CDRPath.h:26
Definition: CDRPath.h:34
bool empty() const
Definition: CDRPath.cpp:883
void appendLineTo(double x, double y)
Definition: CDRPath.cpp:647
~CDRPath()
Definition: CDRPath.cpp:698
CDRPath()
Definition: CDRPath.h:37
void appendSplineTo(std::vector< std::pair< double, double > > &points)
Definition: CDRPath.cpp:667
void appendMoveTo(double x, double y)
Definition: CDRPath.cpp:642
void appendPath(const CDRPath &path)
Definition: CDRPath.cpp:703
bool isClosed() const
Definition: CDRPath.cpp:888
Definition: CDRTransforms.h:20
void appendCubicBezierTo(double x1, double y1, double x2, double y2, double x, double y)
Definition: CDRPath.cpp:652
void appendQuadraticBezierTo(double x1, double y1, double x, double y)
Definition: CDRPath.cpp:657
virtual void transform(const CDRTransforms &trafos)=0
void transform(const CDRTransforms &trafos)
Definition: CDRPath.cpp:857
void appendArcTo(double rx, double ry, double rotation, bool longAngle, bool sweep, double x, double y)
Definition: CDRPath.cpp:662
void appendClosePath()
Definition: CDRPath.cpp:672
void writeOut(librevenge::RVNGPropertyListVector &vec) const
Definition: CDRPath.cpp:709
virtual CDRPathElement * clone()=0
CDRPathElement()
Definition: CDRPath.h:25
bool m_isClosed
Definition: CDRPath.h:64
Definition: CDRPath.h:22
std::vector< CDRPathElement * > m_elements
Definition: CDRPath.h:63
virtual void writeOut(librevenge::RVNGPropertyListVector &vec) const =0
CDRPathElement * clone()
Definition: CDRPath.cpp:869
Definition: CDRTransforms.h:39

Generated for libcdr by doxygen 1.8.6