2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Jussi Laitinen - jussi.laitinen@ixonos.com
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.
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.
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,
24 #include "geopositioninfo.h"
25 #include "gpscommon.h"
27 GeoPositionInfo::GeoPositionInfo()
31 void GeoPositionInfo::setLatitude(qreal latitude)
33 m_latitude = latitude;
36 qreal GeoPositionInfo::latitude() const
40 void GeoPositionInfo::setLongitude(qreal longitude)
42 m_longitude = longitude;
45 qreal GeoPositionInfo::longitude() const
50 void GeoPositionInfo::setTimestamp(qreal time)
52 m_timestamp = QDateTime::fromTime_t(time);
55 QDateTime GeoPositionInfo::timestamp() const
60 bool GeoPositionInfo::isValid() const
62 if ((latitude >= MIN_LATITUDE) && (latitude < MAX_LATITUDE) &&
63 (longitude >= MIN_LONGITUDE) && (longitude < MAX_LONGITUDE))
70 void GeoPositionInfo::setAttribute(Attribute attribute, qreal value)
72 if (hasAttribute(attribute))
73 m_horizontalAccuracy = value;
76 qreal GeoPositionInfo::attribute(Attribute attribute)
78 if (attribute == HorizontalAccuracy)
79 return m_horizontalAccuracy;
81 return GPS_ACCURACY_UNDEFINED;
84 bool GeoPositionInfo::hasAttribute(Attribute attribute)
86 if (attribute == HorizontalAccuracy)