Implemented GeoCoordinate class and unit tests
[situare] / src / coordinates / geocoordinate.h
1 /*
2     Situare - A location system for Facebook
3     Copyright (C) 2010  Ixonos Plc. Authors:
4
5         Sami Rämö - sami.ramo@ixonos.com
6
7     Situare is free software; you can redistribute it and/or
8     modify it under the terms of the GNU General Public License
9     version 2 as published by the Free Software Foundation.
10
11     Situare is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with Situare; if not, write to the Free Software
18     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
19     USA.
20 */
21
22
23 #ifndef GEOCOORDINATE_H
24 #define GEOCOORDINATE_H
25
26 #include <QDebug>
27
28 /**
29 * @brief Geographic coordinate
30 *
31 * @author Sami Rämö - sami.ramo@ixonos.com
32 */
33 class GeoCoordinate
34 {
35 public:
36     /**
37     * @brief Constructs a null coordinate
38     */
39     GeoCoordinate();
40
41     /**
42     * @brief Contsructs a coordinate with given latitude and longitude values
43     *
44     * @param latitude Latitude value
45     * @param longitude Longitude value
46     */
47     GeoCoordinate(double latitude, double longitude);
48
49     /**
50     * @brief Check if coordinate is (0.0, 0.0)
51     *
52     * @returns True if both latitude and longitude are 0.0, otherwise false
53     */
54     bool isNull() const;
55
56     /**
57     * @brief Returns the latitude value
58     *
59     * @returns latitude
60     */
61     double latitude() const;
62
63     /**
64     * @brief Returns the longitude value
65     *
66     * @returns longitude
67     */
68     double longitude() const;
69
70     /**
71     * @brief Sets the latitude
72     *
73     * @param latitude Latitude value
74     */
75     void setLatitude(double latitude);
76
77     /**
78     * @brief Sets the longitude
79     *
80     * @param longitude Longitude value
81     */
82     void setLongitude(double longitude);
83
84 private:
85     double m_latitude;      ///< Latitude value
86     double m_longitude;     ///< Longitude value
87 };
88
89 QDebug operator<<(QDebug dbg, const GeoCoordinate &c);
90
91 #endif // GEOCOORDINATE_H