IWORKPath.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 IWORKPATH_H_INCLUDED
00011 #define IWORKPATH_H_INCLUDED
00012 
00013 #include "IWORKPath_fwd.h"
00014 
00015 #include <string>
00016 
00017 #include <glm/glm.hpp>
00018 
00019 #include <librevenge/librevenge.h>
00020 
00021 #include "libetonyek_utils.h"
00022 
00023 namespace libetonyek
00024 {
00025 
00026 class IWORKPath
00027 {
00028   friend bool approxEqual(const IWORKPath &left, const IWORKPath &right, const double eps);
00029 
00030 public:
00031   struct Impl;
00032   struct InvalidException {};
00033 
00034 public:
00035   IWORKPath();
00036   explicit IWORKPath(const std::string &path);
00037   IWORKPath(const IWORKPath &other);
00038   IWORKPath &operator=(const IWORKPath &other);
00039 
00040   void swap(IWORKPath &other);
00041 
00042   void clear();
00043 
00044   void appendMoveTo(double x, double y);
00045   void appendLineTo(double x, double y);
00046   void appendCurveTo(double x1, double y1, double x2, double y2, double x, double y);
00047   void appendClose();
00048 
00053   void operator*=(const glm::dmat3 &tr);
00054 
00055   /* Create a string representation of this path.
00056    *
00057    * @return an SVG path representing this.
00058    */
00059   const std::string str() const;
00060 
00063   void write(librevenge::RVNGPropertyListVector &vec) const;
00064 
00065 private:
00066   boost::shared_ptr<Impl> m_impl;
00067 };
00068 
00069 bool approxEqual(const IWORKPath &left, const IWORKPath &right, double eps = ETONYEK_EPSILON);
00070 bool operator==(const IWORKPath &left, const IWORKPath &right);
00071 bool operator!=(const IWORKPath &left, const IWORKPath &right);
00072 
00079 IWORKPath operator*(const IWORKPath &path, const glm::dmat3 &tr);
00080 
00081 }
00082 
00083 #endif //  IWORKPATH_H_INCLUDED
00084 
00085 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */