IWORKPath.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 libetonyek 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 IWORKPATH_H_INCLUDED
11 #define IWORKPATH_H_INCLUDED
12 
13 #include "IWORKPath_fwd.h"
14 
15 #include <deque>
16 #include <string>
17 
18 #include <glm/glm.hpp>
19 
20 #include <librevenge/librevenge.h>
21 
22 #include "libetonyek_utils.h"
23 
24 namespace libetonyek
25 {
26 
27 class IWORKPath
28 {
29  friend bool approxEqual(const IWORKPath &left, const IWORKPath &right, const double eps);
30 
31 public:
32  class Element;
33 
34  struct InvalidException {};
35 
36 public:
37  IWORKPath();
38  explicit IWORKPath(const std::string &path);
39  IWORKPath(const IWORKPath &other);
40  ~IWORKPath();
41  IWORKPath &operator=(const IWORKPath &other);
42 
43  void swap(IWORKPath &other);
44 
45  void clear();
46 
47  void appendMoveTo(double x, double y);
48  void appendLineTo(double x, double y);
49  void appendCurveTo(double x1, double y1, double x2, double y2, double x, double y);
50  void appendClose();
51 
56  void operator*=(const glm::dmat3 &tr);
57 
60  void write(librevenge::RVNGPropertyListVector &vec) const;
61 
62 private:
63  std::deque<Element *> m_elements;
64  bool m_closed;
65 };
66 
67 bool approxEqual(const IWORKPath &left, const IWORKPath &right, double eps = ETONYEK_EPSILON);
68 bool operator==(const IWORKPath &left, const IWORKPath &right);
69 bool operator!=(const IWORKPath &left, const IWORKPath &right);
70 
77 IWORKPath operator*(const IWORKPath &path, const glm::dmat3 &tr);
78 
79 }
80 
81 #endif // IWORKPATH_H_INCLUDED
82 
83 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
IWORKPath & operator=(const IWORKPath &other)
Definition: IWORKPath.cpp:342
Definition: IWORKBezierElement.cpp:18
IWORKPath operator*(const IWORKPath &path, const glm::dmat3 &tr)
Create a transformed path.
Definition: IWORKPath.cpp:423
double y
Definition: IWORKShape.cpp:43
bool m_closed
Definition: IWORKPath.h:64
void swap(IWORKPath &other)
Definition: IWORKPath.cpp:349
void appendClose()
Definition: IWORKPath.cpp:378
void operator*=(const glm::dmat3 &tr)
Transform all elements of the path.
Definition: IWORKPath.cpp:383
Definition: IWORKToken.h:177
void clear()
Definition: IWORKPath.cpp:355
double x
Definition: IWORKShape.cpp:42
void appendMoveTo(double x, double y)
Definition: IWORKPath.cpp:362
Definition: IWORKToken.h:237
Definition: IWORKPath.h:27
An element of path.
Definition: IWORKPath.cpp:35
Definition: IWORKPath.h:34
bool operator==(const IWORKPath &left, const IWORKPath &right)
Definition: IWORKPath.cpp:413
void appendLineTo(double x, double y)
Definition: IWORKPath.cpp:368
Definition: IWORKToken.h:148
Definition: IWORKToken.h:246
bool operator!=(const IWORKPath &left, const IWORKPath &right)
Definition: IWORKPath.cpp:418
~IWORKPath()
Definition: IWORKPath.cpp:337
void write(librevenge::RVNGPropertyListVector &vec) const
Create librevenge representation of this path.
Definition: IWORKPath.cpp:388
IWORKPath()
Definition: IWORKPath.cpp:285
#define ETONYEK_EPSILON
Definition: libetonyek_utils.h:57
std::deque< Element * > m_elements
Definition: IWORKPath.h:63
friend bool approxEqual(const IWORKPath &left, const IWORKPath &right, const double eps)
Definition: IWORKPath.cpp:405
bool approxEqual(const IWORKPath &left, const IWORKPath &right, const double eps)
Definition: IWORKPath.cpp:405
void appendCurveTo(double x1, double y1, double x2, double y2, double x, double y)
Definition: IWORKPath.cpp:373

Generated for libetonyek by doxygen 1.8.10