FHPath.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 libfreehand 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 __FHPATH_H__
11 #define __FHPATH_H__
12 
13 #include <memory>
14 #include <vector>
15 #include <ostream>
16 
17 #include <librevenge/librevenge.h>
18 
19 namespace libfreehand
20 {
21 
22 struct FHTransform;
23 
25 {
26 public:
28  virtual ~FHPathElement() {}
29  virtual void writeOut(librevenge::RVNGPropertyListVector &vec) const = 0;
30  virtual void writeOut(std::ostream &s) const = 0;
31  virtual void transform(const FHTransform &trafo) = 0;
32  virtual FHPathElement *clone() = 0;
33  virtual void getBoundingBox(double x0, double y0, double &px, double &py, double &qx, double &qy) const = 0;
34  virtual double getX() const = 0;
35  virtual double getY() const = 0;
36 };
37 
38 
39 class FHPath
40 {
41 public:
43  FHPath(const FHPath &path);
44  ~FHPath();
45 
46  FHPath &operator=(const FHPath &path);
47 
48  void appendMoveTo(double x, double y);
49  void appendLineTo(double x, double y);
50  void appendCubicBezierTo(double x1, double y1, double x2, double y2, double x, double y);
51  void appendQuadraticBezierTo(double x1, double y1, double x, double y);
52  void appendArcTo(double rx, double ry, double rotation, bool longAngle, bool sweep, double x, double y);
53  void appendClosePath();
54  void appendPath(const FHPath &path);
55  void setXFormId(unsigned xFormId);
56  void setGraphicStyleId(unsigned graphicStyleId);
57  void setEvenOdd(bool evenOdd);
58 
59  void writeOut(librevenge::RVNGPropertyListVector &vec) const;
60  std::string getPathString() const;
61  void transform(const FHTransform &trafo);
62  void getBoundingBox(double x0, double y0, double &xmin, double &ymin, double &xmax, double &ymax) const;
63  double getX() const;
64  double getY() const;
65 
66  void clear();
67  bool empty() const;
68  bool isClosed() const;
69  unsigned getXFormId() const;
70  unsigned getGraphicStyleId() const;
71  bool getEvenOdd() const;
72  void getBoundingBox(double &xmin, double &ymin, double &xmax, double &ymax) const;
73 
74 private:
75  std::vector<std::unique_ptr<FHPathElement>> m_elements;
76  bool m_isClosed;
77  unsigned m_xFormId;
78  unsigned m_graphicStyleId;
79  bool m_evenOdd;
80 };
81 
82 } // namespace libfreehand
83 
84 #endif /* __FHPATH_H__ */
85 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
void appendLineTo(double x, double y)
Definition: FHPath.cpp:623
virtual FHPathElement * clone()=0
std::string getPathString() const
Definition: FHPath.cpp:700
FHPath()
Definition: FHPath.h:42
virtual void writeOut(librevenge::RVNGPropertyListVector &vec) const =0
void setGraphicStyleId(unsigned graphicStyleId)
Definition: FHPath.cpp:684
virtual double getX() const =0
void writeOut(librevenge::RVNGPropertyListVector &vec) const
Definition: FHPath.cpp:694
unsigned getGraphicStyleId() const
Definition: FHPath.cpp:751
void setEvenOdd(bool evenOdd)
Definition: FHPath.cpp:689
std::vector< std::unique_ptr< FHPathElement > > m_elements
Definition: FHPath.h:75
double getY() const
Definition: FHPath.cpp:739
bool m_isClosed
Definition: FHPath.h:76
Definition: FHCollector.h:22
void appendMoveTo(double x, double y)
Definition: FHPath.cpp:618
unsigned m_xFormId
Definition: FHPath.h:77
void setXFormId(unsigned xFormId)
Definition: FHPath.cpp:679
bool isClosed() const
Definition: FHPath.cpp:727
void appendArcTo(double rx, double ry, double rotation, bool longAngle, bool sweep, double x, double y)
Definition: FHPath.cpp:638
void getBoundingBox(double x0, double y0, double &xmin, double &ymin, double &xmax, double &ymax) const
Definition: FHPath.cpp:761
void appendPath(const FHPath &path)
Definition: FHPath.cpp:669
bool empty() const
Definition: FHPath.cpp:722
FHPath & operator=(const FHPath &path)
Definition: FHPath.cpp:655
virtual double getY() const =0
void appendClosePath()
Definition: FHPath.cpp:643
FHPathElement()
Definition: FHPath.h:27
void clear()
Definition: FHPath.cpp:714
Definition: FHTransform.h:18
void transform(const FHTransform &trafo)
Definition: FHPath.cpp:708
virtual void getBoundingBox(double x0, double y0, double &px, double &py, double &qx, double &qy) const =0
Definition: FHPath.h:24
~FHPath()
Definition: FHPath.cpp:675
unsigned getXFormId() const
Definition: FHPath.cpp:746
virtual void transform(const FHTransform &trafo)=0
bool m_evenOdd
Definition: FHPath.h:79
bool getEvenOdd() const
Definition: FHPath.cpp:756
void appendCubicBezierTo(double x1, double y1, double x2, double y2, double x, double y)
Definition: FHPath.cpp:628
void appendQuadraticBezierTo(double x1, double y1, double x, double y)
Definition: FHPath.cpp:633
Definition: FHPath.h:39
unsigned m_graphicStyleId
Definition: FHPath.h:78
virtual ~FHPathElement()
Definition: FHPath.h:28
double getX() const
Definition: FHPath.cpp:732

Generated for libfreehand by doxygen 1.8.14