Implemented Route class and unit tests for it
[situare] / src / routing / route.cpp
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 #include <QDebug>
23
24 #include "routingcommon.h"
25
26 #include "route.h"
27
28 Route::Route()
29     : m_totalDistance(ROUTING_VALUE_UNDEFINED),
30       m_totalTime(ROUTING_VALUE_UNDEFINED)
31 {
32     qDebug() << __PRETTY_FUNCTION__;
33 }
34
35 Route::~Route()
36 {
37     qDebug() << __PRETTY_FUNCTION__;
38
39     qDeleteAll(m_segments);
40 }
41
42 void Route::appendGeometryPoint(QPointF geometryPoint)
43 {
44     qDebug() << __PRETTY_FUNCTION__;
45
46     m_geometryPoints.append(geometryPoint);
47 }
48
49 void Route::appendSegment(RouteSegment *segment)
50 {
51     qDebug() << __PRETTY_FUNCTION__;
52
53     m_segments.append(segment);
54 }
55
56 QString Route::endPointName() const
57 {
58     qDebug() << __PRETTY_FUNCTION__;
59
60     return m_endPointName;
61 }
62
63 const QList<QPointF>& Route::geometryPoints() const
64 {
65     qDebug() << __PRETTY_FUNCTION__;
66
67     return m_geometryPoints;
68 }
69
70 const QList<RouteSegment *>& Route::segments() const
71 {
72     qDebug() << __PRETTY_FUNCTION__;
73
74     return m_segments;
75 }
76
77 void Route::setEndPointName(QString endPoint)
78 {
79     qDebug() << __PRETTY_FUNCTION__;
80
81     m_endPointName = endPoint;
82 }
83
84 void Route::setStartPointName(QString startPoint)
85 {
86     qDebug() << __PRETTY_FUNCTION__;
87
88     m_startPointName = startPoint;
89 }
90
91 void Route::setTotalDistance(int meters)
92 {
93     qDebug() << __PRETTY_FUNCTION__;
94
95     m_totalDistance = meters;
96 }
97
98 void Route::setTotalTime(int seconds)
99 {
100     qDebug() << __PRETTY_FUNCTION__;
101
102     m_totalTime = seconds;
103 }
104
105 QString Route::startPointName() const
106 {
107     qDebug() << __PRETTY_FUNCTION__;
108
109     return m_startPointName;
110 }
111
112 int Route::totalDistance() const
113 {
114     qDebug() << __PRETTY_FUNCTION__;
115
116     return m_totalDistance;
117 }
118
119 int Route::totalTime() const
120 {
121     qDebug() << __PRETTY_FUNCTION__;
122
123     return m_totalTime;
124 }