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 <string>
16 
17 #include <glm/glm.hpp>
18 
19 #include <librevenge/librevenge.h>
20 
21 #include "libetonyek_utils.h"
22 
23 namespace libetonyek
24 {
25 
26 class IWORKPath
27 {
28  friend bool approxEqual(const IWORKPath &left, const IWORKPath &right, const double eps);
29 
30 public:
31  struct Impl;
32  struct InvalidException {};
33 
34 public:
35  IWORKPath();
36  explicit IWORKPath(const std::string &path);
37  IWORKPath(const IWORKPath &other);
38  IWORKPath &operator=(const IWORKPath &other);
39 
40  void swap(IWORKPath &other);
41 
42  void clear();
43 
44  void appendMoveTo(double x, double y);
45  void appendLineTo(double x, double y);
46  void appendCurveTo(double x1, double y1, double x2, double y2, double x, double y);
47  void appendClose();
48 
53  void operator*=(const glm::dmat3 &tr);
54 
55  /* Create a string representation of this path.
56  *
57  * @return an SVG path representing this.
58  */
59  const std::string str() const;
60 
63  void write(librevenge::RVNGPropertyListVector &vec) const;
64 
65 private:
66  std::shared_ptr<Impl> m_impl;
67 };
68 
69 bool approxEqual(const IWORKPath &left, const IWORKPath &right, double eps = ETONYEK_EPSILON);
70 bool operator==(const IWORKPath &left, const IWORKPath &right);
71 bool operator!=(const IWORKPath &left, const IWORKPath &right);
72 
79 IWORKPath operator*(const IWORKPath &path, const glm::dmat3 &tr);
80 
81 }
82 
83 #endif // IWORKPATH_H_INCLUDED
84 
85 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
Definition: IWORKBezierElement.cpp:18
Definition: IWORKToken.h:228
IWORKPath operator*(const IWORKPath &path, const glm::dmat3 &tr)
Create a transformed path.
double y
Definition: IWORKShape.cpp:43
void swap(IWORKPath &other)
void operator*=(const glm::dmat3 &tr)
Transform all elements of the path.
Definition: IWORKToken.h:338
double x
Definition: IWORKShape.cpp:42
void appendMoveTo(double x, double y)
const std::string str() const
Definition: IWORKPath.h:26
Definition: IWORKPath.h:32
Definition: IWORKToken.h:354
bool operator==(const IWORKPath &left, const IWORKPath &right)
std::shared_ptr< Impl > m_impl
Definition: IWORKPath.h:66
void appendLineTo(double x, double y)
bool operator!=(const IWORKPath &left, const IWORKPath &right)
void write(librevenge::RVNGPropertyListVector &vec) const
Create librevenge representation of this path.
Definition: IWORKToken.h:266
#define ETONYEK_EPSILON
Definition: libetonyek_utils.h:26
Definition: IWORKPath.cpp:62
friend bool approxEqual(const IWORKPath &left, const IWORKPath &right, const double eps)
void appendCurveTo(double x1, double y1, double x2, double y2, double x, double y)
IWORKPath & operator=(const IWORKPath &other)

Generated for libetonyek by doxygen 1.8.13