dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
point.h
Go to the documentation of this file.
1 
13 /*
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 3 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful, but
20 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
21 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 * for more details.
23 *
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, see <http://www.gnu.org/licenses/>
26 */
27 #ifndef OPOINT_H
28 #define OPOINT_H
29 
30 
31 #include <QString>
32 
38 namespace core {
39  struct Size;
40  struct Point
41  {
42  friend quint64 qHash(Point const& point);
43  friend bool operator==(Point const& lhs,Point const& rhs);
44  friend bool operator!=(Point const& lhs,Point const& rhs);
45  public:
46 
47  Point();
48  Point(qint64 x, qint64 y);
49  Point(Size sz);
50  bool IsEmpty(){return empty;}
51  qint64 X()const{return this->x;}
52  qint64 Y()const{return this->y;}
53  void SetX(const qint64 &value){x=value;empty=false;}
54  void SetY(const qint64 &value){y=value;empty=false;}
55  QString ToString()const{return "{"+QString::number(x)+","+QString::number(y)+"}";}
56 
57  static Point Empty;
58  void Offset(const qint64 &dx,const qint64 &dy)
59  {
60  x += dx;
61  y += dy;
62  }
63  void Offset(Point p)
64  {
65  Offset(p.x, p.y);
66  }
67 
68  private:
69  qint64 x;
70  qint64 y;
71  bool empty;
72  };
73 }
74 #endif // POINT_H
friend bool operator==(Point const &lhs, Point const &rhs)
Definition: point.cpp:49
qint64 X() const
Definition: point.h:51
void SetX(const qint64 &value)
Definition: point.h:53
bool IsEmpty()
Definition: point.h:50
void SetY(const qint64 &value)
Definition: point.h:54
void Offset(Point p)
Definition: point.h:63
friend quint64 qHash(Point const &point)
Definition: point.cpp:45
friend bool operator!=(Point const &lhs, Point const &rhs)
Definition: point.cpp:53
QString ToString() const
Definition: point.h:55
static Point Empty
Definition: point.h:57
qint64 Y() const
Definition: point.h:52
void Offset(const qint64 &dx, const qint64 &dy)
Definition: point.h:58