Line | Count | Source |
1 | | // This may look like C code, but it's really -*- C++ -*- |
2 | | /* |
3 | | * Copyright (C) 2008 Emweb bv, Herent, Belgium. |
4 | | * |
5 | | * See the LICENSE file for terms of use. |
6 | | */ |
7 | | #ifndef WLINEF_H_ |
8 | | #define WLINEF_H_ |
9 | | |
10 | | #include <Wt/WDllDefs.h> |
11 | | |
12 | | namespace Wt { |
13 | | |
14 | | class WPointF; |
15 | | |
16 | | /*! \class WLineF Wt/WLineF.h Wt/WLineF.h |
17 | | * \brief Utility class that defines a single line. |
18 | | * |
19 | | * \ingroup painting |
20 | | */ |
21 | | class WT_API WLineF |
22 | | { |
23 | | public: |
24 | | /*! \brief Default constructor. |
25 | | * |
26 | | * Constructs a line from (<i>x1=0</i>,<i>y1=0</i>) to (<i>x2=0</i>,\p y2=0). |
27 | | */ |
28 | | WLineF(); |
29 | | |
30 | | /*! \brief Construct a line connecting two points. |
31 | | * |
32 | | * Constructs a line from <i>p1</i> to \p p2. |
33 | | */ |
34 | | WLineF(const WPointF& p1, const WPointF& p2); |
35 | | |
36 | | /*! \brief Construct a line connecting two points. |
37 | | * |
38 | | * Constructs a line from (<i>x1</i>,<i>y1</i>) to (<i>x2</i>,\p y2). |
39 | | */ |
40 | | WLineF(double x1, double y1, double x2, double y2); |
41 | | |
42 | | /*! \brief Returns the X coordinate of the first point. |
43 | | * |
44 | | * \sa y1(), p1() |
45 | | */ |
46 | 0 | double x1() const { return x1_; } |
47 | | |
48 | | /*! \brief Returns the Y coordinate of the first point. |
49 | | * |
50 | | * \sa x1(), p1() |
51 | | */ |
52 | 0 | double y1() const { return y1_; } |
53 | | |
54 | | /*! \brief Returns the X coordinate of the second point. |
55 | | * |
56 | | * \sa y2(), p2() |
57 | | */ |
58 | 0 | double x2() const { return x2_; } |
59 | | |
60 | | /*! \brief Returns the Y coordinate of the second point. |
61 | | * |
62 | | * \sa x2(), p2() |
63 | | */ |
64 | 0 | double y2() const { return y2_; } |
65 | | |
66 | | /*! \brief Returns the first point. |
67 | | * |
68 | | * \sa x1(), y1() |
69 | | */ |
70 | | WPointF p1() const; |
71 | | |
72 | | /*! \brief Returns the second point. |
73 | | * |
74 | | * \sa x2(), y2() |
75 | | */ |
76 | | WPointF p2() const; |
77 | | |
78 | | bool operator==(const WLineF& other) const; |
79 | | |
80 | | bool operator!=(const WLineF& other) const; |
81 | | |
82 | | private: |
83 | | double x1_, y1_, x2_, y2_; |
84 | | }; |
85 | | |
86 | | } |
87 | | |
88 | | #endif // WLINEF_H_ |