dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
size.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 SIZE_H
28 #define SIZE_H
29 
30 #include "point.h"
31 #include <QString>
32 #include <QHash>
33 
39 namespace core {
40  struct Size
41  {
42  //Size must be kept in 64-bit signed integer format, or else the data type overflows at mid-twenties zoom levels
43  Size();
44  Size(Point pt){width=pt.X(); height=pt.Y();}
45  Size(qint64 Width, qint64 Height){width=Width; height=Height;}
46  friend quint64 qHash(Size const& size);
47  // friend bool operator==(Size const& lhs,Size const& rhs);
48  Size operator-(const Size &sz1){return Size(width-sz1.width,height-sz1.height);}
49  Size operator+(const Size &sz1){return Size(sz1.width+width,sz1.height+height);}
50 
51  int GetHashCode(){return width^height;}
52  quint64 qHash(Size const& /*rect*/){return width^height;}
53  QString ToString(){return "With="+QString::number(width)+" ,Height="+QString::number(height);}
54  qint64 Width()const {return width;}
55  qint64 Height()const {return height;}
56  void SetWidth(qint64 const& value){width=value;}
57  void SetHeight(qint64 const& value){height=value;}
58  private:
59  qint64 width;
60  qint64 height;
61  };
62 }
63 #endif // SIZE_H
int GetHashCode()
Definition: size.h:51
qint64 X() const
Definition: point.h:51
Size operator-(const Size &sz1)
Definition: size.h:48
quint64 qHash(Size const &)
Definition: size.h:52
qint64 Height() const
Definition: size.h:55
void SetHeight(qint64 const &value)
Definition: size.h:57
void SetWidth(qint64 const &value)
Definition: size.h:56
friend quint64 qHash(Size const &size)
qint64 Width() const
Definition: size.h:54
Size operator+(const Size &sz1)
Definition: size.h:49
Size()
Definition: size.cpp:31
Size(Point pt)
Definition: size.h:44
qint64 Y() const
Definition: point.h:52
QString ToString()
Definition: size.h:53
Size(qint64 Width, qint64 Height)
Definition: size.h:45