KEYPath.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 KEYPATH_H_INCLUDED
11 #define KEYPATH_H_INCLUDED
12 
13 #include <deque>
14 #include <string>
15 
16 #include <libwpd/libwpd.h>
17 
18 #include "libetonyek_utils.h"
19 #include "KEYObject.h"
20 #include "KEYPath_fwd.h"
21 
22 namespace libetonyek
23 {
24 
25 class KEYTransformation;
26 
27 class KEYPath
28 {
29  friend bool approxEqual(const KEYPath &left, const KEYPath &right, const double eps);
30 
31 public:
32  class Element;
33 
34 public:
35  KEYPath();
36  explicit KEYPath(const std::string &path);
37  KEYPath(const KEYPath &other);
38  ~KEYPath();
39  KEYPath &operator=(const KEYPath &other);
40 
41  void swap(KEYPath &other);
42 
43  void clear();
44 
45  void appendMoveTo(double x, double y);
46  void appendLineTo(double x, double y);
47  void appendCurveTo(double x1, double y1, double x2, double y2, double x, double y);
48  void appendClose();
49 
54  void operator*=(const KEYTransformation &tr);
55 
58  WPXPropertyListVector toWPG() const;
59 
60 private:
61  std::deque<Element *> m_elements;
62  bool m_closed;
63 };
64 
65 bool approxEqual(const KEYPath &left, const KEYPath &right, double eps = KEY_EPSILON);
66 bool operator==(const KEYPath &left, const KEYPath &right);
67 bool operator!=(const KEYPath &left, const KEYPath &right);
68 
76 
77 }
78 
79 #endif // KEYPATH_H_INCLUDED
80 
81 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
bool approxEqual(const KEYPath &left, const KEYPath &right, const double eps)
Definition: KEYPath.cpp:385
KEYPath & operator=(const KEYPath &other)
Definition: KEYPath.cpp:322
WPXPropertyListVector toWPG() const
Create WPG representation of this path.
Definition: KEYPath.cpp:368
double y
Definition: KEYShape.cpp:99
bool operator==(const KEYPath &left, const KEYPath &right)
Definition: KEYPath.cpp:393
An element of path.
Definition: KEYPath.cpp:32
KEYPath()
Definition: KEYPath.cpp:263
~KEYPath()
Definition: KEYPath.cpp:317
bool operator!=(const KEYPath &left, const KEYPath &right)
Definition: KEYPath.cpp:398
void appendMoveTo(double x, double y)
Definition: KEYPath.cpp:342
void operator*=(const KEYTransformation &tr)
Transform all elements of the path.
Definition: KEYPath.cpp:363
void appendClose()
Definition: KEYPath.cpp:358
double x
Definition: KEYShape.cpp:98
KEYPath operator*(const KEYPath &path, const KEYTransformation &tr)
Create a transformed path.
Definition: KEYPath.cpp:403
friend bool approxEqual(const KEYPath &left, const KEYPath &right, const double eps)
Definition: KEYPath.cpp:385
#define KEY_EPSILON
Definition: libetonyek_utils.h:57
void appendLineTo(double x, double y)
Definition: KEYPath.cpp:348
bool m_closed
Definition: KEYPath.h:62
Definition: KEY2Token.h:1067
void swap(KEYPath &other)
Definition: KEYPath.cpp:329
Definition: KEY2Token.h:1013
std::deque< Element * > m_elements
Definition: KEYPath.h:61
void clear()
Definition: KEYPath.cpp:335
Definition: KEYPath.h:27
Represents an affine transformation.
Definition: KEYTransformation.h:29
Definition: KEY1Token.h:75
Definition: KEY2Token.h:357
void appendCurveTo(double x1, double y1, double x2, double y2, double x, double y)
Definition: KEYPath.cpp:353

Generated for libetonyek by doxygen 1.8.5