#include "routesegment.h"
+/**
+ * @brief Container for a single route
+ *
+ * Contains all data for a single route including route geometry points (a.k.a track points) and
+ * route segments.
+ *
+ * @author Sami Rämö - sami.ramo@ixonos.com
+ */
+
class Route
{
public:
+ /**
+ * @brief Constructor
+ */
Route();
+
+ /**
+ * @brief Destructor
+ */
~Route();
+ /**
+ * @brief Append geometry point (a.k.a track point) of the route
+ *
+ * Appending must be done in order starting from the beginning of the route.
+ *
+ * @param geometryPoint Geometry point
+ */
void appendGeometryPoint(QPointF geometryPoint);
/**
* @brief Append a route segment to the route
*
* Takes the ownership of the segment object. Appending must be done in order starting from the
- * begin of the route.
+ * beginning of the route.
+ *
+ * @param segment Route segment object
*/
void appendSegment(RouteSegment *segment);
+ /**
+ * @brief Getter for route end point name
+ *
+ * @returns Name of the end point (or empty QString)
+ */
QString endPointName() const;
+
+ /**
+ * @brief Get list of geometry points
+ *
+ * @returns Reference to list of geometry points
+ */
const QList<QPointF>& geometryPoints() const;
+
+ /**
+ * @brief Get list of route segments
+ *
+ * @returns Reference to list of route segments
+ */
const QList<RouteSegment *>& segments() const;
+
+ /**
+ * @brief Set name of the route end point
+ *
+ * @param endPoint Name of the end point
+ */
void setEndPointName(QString endPoint);
+
+ /**
+ * @brief Set name of the route start point
+ *
+ * @param startPoint Name of the route start point
+ */
void setStartPointName(QString startPoint);
+
+ /**
+ * @brief Set total distance of the route
+ *
+ * @param meters Total distance of the route in meters
+ */
void setTotalDistance(int meters);
+
+ /**
+ * @brief Set estimated total travel time of the route
+ *
+ * @param seconds Estimated total travel time
+ */
void setTotalTime(int seconds);
+
+ /**
+ * @brief Getter for route start point name
+ *
+ * @returns Name of the start point (or empty QString)
+ */
QString startPointName() const;
+
+ /**
+ * @brief Getter for total route distance
+ *
+ * @returns Total route distance in meters
+ */
int totalDistance() const;
+
+ /**
+ * @brief Getter for estimated travel time
+ *
+ * @returns Estimated travel time in seconds
+ */
int totalTime() const;
private:
- int m_totalDistance; // route total distance in meters
- int m_totalTime; // estimated route total time in seconds
+ int m_totalDistance; ///< route total distance in meters
+ int m_totalTime; ///< estimated route total time in seconds
- QList<QPointF> m_geometryPoints; // lat/lon coordinates of the route points
- QList<RouteSegment *> m_segments; // route segments
+ QList<QPointF> m_geometryPoints; ///< lat/lon coordinates of the route points
+ QList<RouteSegment *> m_segments; ///< route segments
- QString m_endPointName; // name of the route end point
- QString m_startPointName; // name of the route starting point
+ QString m_endPointName; ///< name of the route end point
+ QString m_startPointName; ///< name of the route starting point
};
#endif // ROUTE_H
#include <QtGlobal>
#include <QString>
+/**
+ * @brief Container for a single route segment data
+ *
+ * Contains all data for a single route segment.
+ *
+ * @author Sami Rämö - sami.ramo@ixonos.com
+ */
+
class RouteSegment
{
public:
+ /**
+ * @brief Constructor
+ */
RouteSegment();
+ /**
+ * @brief Getter for azimuth
+ *
+ * @return Azimuth (in degrees)
+ */
qreal azimuth() const;
+
+ /**
+ * @brief Getter for earth direction code of the start of the segment
+ *
+ * @returns Earth direction (N, NE, E, SE, S, SW, W, NW)
+ */
QString earthDirection() const;
+
+ /**
+ * @brief Getter for text instruction
+ *
+ * e.g. Turn left at Oxford Street
+ *
+ * @returns Instruction text
+ */
QString instruction() const;
+
+ /**
+ * @brief Getter for segment length
+ *
+ * @returns Length of the segment in meters
+ */
qreal length() const;
+
+ /**
+ * @brief Getter for length caption text
+ *
+ * e.g. 22m, 23.4 km, 14.4 miles
+ *
+ * @returns Length of the segment text
+ */
QString lengthCaption() const;
+
+ /**
+ * @brief Getter for the route geometry position index of the segment
+ *
+ * @returns Index of the first point of the segment in route geometry
+ */
int positionIndex() const;
+ /**
+ * @brief Set azimuth
+ *
+ * @param azimuth Azimuth (in degrees)
+ */
void setAzimuth(qreal azimuth);
+
+ /**
+ * @brief Set earth direction code of the start of the segment
+ *
+ * @param direction Direction code
+ */
void setEarthDirection(QString direction);
+
+ /**
+ * @brief Set instruction text
+ *
+ * @param instruction Instructon text
+ */
void setInstruction(QString instruction);
+
+ /**
+ * @brief Set length
+ *
+ * @param meters Length in meters
+ */
void setLength(qreal meters);
+
+ /**
+ * @brief Set length caption text
+ *
+ * @param length Length caption text
+ */
void setLengthCaption(QString length);
+
+ /**
+ * @brief Set position index
+ *
+ * @param index Position index
+ */
void setPositionIndex(int index);
+
+ /**
+ * @brief Set estimated travel time of the segment
+ *
+ * @param seconds Estimated travel time in seconds
+ */
void setTime(int seconds);
+
+ /**
+ * @brief Set turn angle
+ *
+ * @param degrees Turn angle in degrees
+ */
void setTurnAngle(qreal degrees);
+
+ /**
+ * @brief Set turn type code
+ *
+ * @param type Turn type code
+ */
void setTurnType(QString type);
+ /**
+ * @brief Get street name/number parsed from the text instruction
+ *
+ * @returns Street name/number, or empty QString if value is missing
+ */
QString street() const;
+
+ /**
+ * @brief Getter for estimated travel time of the segment
+ *
+ * @returns Estimated travel time of the segment in seconds
+ */
int time() const;
+
+ /**
+ * @brief Getter for turn angle
+ *
+ * @returns Turn angle in degrees
+ */
qreal turnAngle() const;
- QString turnType() const;
+ /**
+ * @brief Getter for turn type code
+ *
+ * e.g.
+ * C continue (go straight)
+ * TL turn left
+ * TSLL turn slight left
+ * TSHL turn sharp left
+ * TR turn right
+ * TSLR turn slight right
+ * TSHR turn sharp right
+ * TU U-turn
+ *
+ * @returns Turn type code
+ */
+ QString turnType() const;
private:
- int m_timeSeconds; // estimated time required to travel the segment in seconds
- int m_positionIndex; // index of the first point of the segment in route geometry
+ int m_timeSeconds; ///< estimated time required to travel the segment in seconds
+ int m_positionIndex; ///< index of the first point of the segment in route geometry
- qreal m_azimuth; // azimuth
- qreal m_length; // length of the segment in meters
- qreal m_turnAngle; // angle in degress of the turn between two segments, 0 for straight
+ qreal m_azimuth; ///< azimuth
+ qreal m_length; ///< length of the segment in meters
+ qreal m_turnAngle; ///< angle in degress of the turn between two segments, 0 for straight
- QString m_earthDirection; // direction: N, NE, E, SE, S, SW, W, NW
- QString m_instruction; // text instruction, e.g. Turn left at Oxford Street
- QString m_lengthCaption; // length of the segment e.g. 22m, 23.4 km, 14.4 miles
- QString m_turnType; // code of the turn type, optional, absent for the first segment
+ QString m_earthDirection; ///< direction: N, NE, E, SE, S, SW, W, NW
+ QString m_instruction; ///< text instruction, e.g. Turn left at Oxford Street
+ QString m_lengthCaption; ///< length of the segment e.g. 22m, 23.4 km, 14.4 miles
+ QString m_turnType; ///< code of the turn type, optional, absent for the first segment
};