KEYPath.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /*
00003  * This file is part of the libetonyek project.
00004  *
00005  * This Source Code Form is subject to the terms of the Mozilla Public
00006  * License, v. 2.0. If a copy of the MPL was not distributed with this
00007  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
00008  */
00009 
00010 #ifndef KEYPATH_H_INCLUDED
00011 #define KEYPATH_H_INCLUDED
00012 
00013 #include <deque>
00014 #include <string>
00015 
00016 #include <libwpd/libwpd.h>
00017 
00018 #include "libetonyek_utils.h"
00019 #include "KEYObject.h"
00020 #include "KEYPath_fwd.h"
00021 
00022 namespace libetonyek
00023 {
00024 
00025 class KEYTransformation;
00026 
00027 class KEYPath
00028 {
00029   friend bool approxEqual(const KEYPath &left, const KEYPath &right, const double eps);
00030 
00031 public:
00032   class Element;
00033 
00034 public:
00035   KEYPath();
00036   explicit KEYPath(const std::string &path);
00037   KEYPath(const KEYPath &other);
00038   ~KEYPath();
00039   KEYPath &operator=(const KEYPath &other);
00040 
00041   void swap(KEYPath &other);
00042 
00043   void clear();
00044 
00045   void appendMoveTo(double x, double y);
00046   void appendLineTo(double x, double y);
00047   void appendCurveTo(double x1, double y1, double x2, double y2, double x, double y);
00048   void appendClose();
00049 
00054   void operator*=(const KEYTransformation &tr);
00055 
00058   WPXPropertyListVector toWPG() const;
00059 
00060 private:
00061   std::deque<Element *> m_elements;
00062   bool m_closed;
00063 };
00064 
00065 bool approxEqual(const KEYPath &left, const KEYPath &right, double eps = KEY_EPSILON);
00066 bool operator==(const KEYPath &left, const KEYPath &right);
00067 bool operator!=(const KEYPath &left, const KEYPath &right);
00068 
00075 KEYPath operator*(const KEYPath &path, const KEYTransformation &tr);
00076 
00077 }
00078 
00079 #endif //  KEYPATH_H_INCLUDED
00080 
00081 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */