FHPath.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 libfreehand 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 __FHPATH_H__
00011 #define __FHPATH_H__
00012 
00013 #include <vector>
00014 #include <librevenge/librevenge.h>
00015 
00016 namespace libfreehand
00017 {
00018 
00019 class FHTransform;
00020 
00021 class FHPathElement
00022 {
00023 public:
00024   FHPathElement() {}
00025   virtual ~FHPathElement() {}
00026   virtual void writeOut(librevenge::RVNGPropertyListVector &vec) const = 0;
00027   virtual void transform(const FHTransform &trafo) = 0;
00028   virtual FHPathElement *clone() = 0;
00029 };
00030 
00031 
00032 class FHPath : public FHPathElement
00033 {
00034 public:
00035   FHPath() : m_elements(), m_isClosed(false) {}
00036   FHPath(const FHPath &path);
00037   ~FHPath();
00038 
00039   FHPath &operator=(const FHPath &path);
00040 
00041   void appendMoveTo(double x, double y);
00042   void appendLineTo(double x, double y);
00043   void appendCubicBezierTo(double x1, double y1, double x2, double y2, double x, double y);
00044   void appendQuadraticBezierTo(double x1, double y1, double x, double y);
00045   void appendArcTo(double rx, double ry, double rotation, bool longAngle, bool sweep, double x, double y);
00046   void appendClosePath();
00047   void appendPath(const FHPath &path);
00048 
00049   void writeOut(librevenge::RVNGPropertyListVector &vec) const;
00050   void transform(const FHTransform &trafo);
00051   FHPathElement *clone();
00052 
00053   void clear();
00054   bool empty() const;
00055   bool isClosed() const;
00056 
00057 private:
00058   std::vector<FHPathElement *> m_elements;
00059   bool m_isClosed;
00060 };
00061 
00062 } // namespace libfreehand
00063 
00064 #endif /* __FHPATH_H__ */
00065 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */