File indexing completed on 2024-04-28 03:49:28

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2011 Dennis Nienhüser <nienhueser@kde.org>
0004 //
0005 
0006 #ifndef MARBLE_ROUTE_H
0007 #define MARBLE_ROUTE_H
0008 
0009 #include "RouteSegment.h"
0010 #include "GeoDataLatLonBox.h"
0011 
0012 namespace Marble
0013 {
0014 
0015 class MARBLE_EXPORT Route
0016 {
0017 public:
0018     Route();
0019 
0020     void addRouteSegment( const RouteSegment &segment );
0021 
0022     GeoDataLatLonBox bounds() const;
0023 
0024     qreal distance() const;
0025 
0026     const RouteSegment & at( int index ) const;
0027 
0028     int indexOf(const RouteSegment &segment) const;
0029 
0030     int size() const;
0031 
0032     const GeoDataLineString & path() const;
0033 
0034     int travelTime() const;
0035 
0036     const GeoDataLineString & turnPoints() const;
0037 
0038     const GeoDataLineString & waypoints() const;
0039 
0040     void setPosition( const GeoDataCoordinates &position );
0041 
0042     GeoDataCoordinates position() const;
0043 
0044     const RouteSegment & currentSegment() const;
0045 
0046     GeoDataCoordinates currentWaypoint() const;
0047 
0048     GeoDataCoordinates positionOnRoute() const;
0049 
0050 private:
0051     void updatePosition() const;
0052 
0053     GeoDataLatLonBox m_bounds;
0054 
0055     qreal m_distance;
0056 
0057     QVector<RouteSegment> m_segments;
0058 
0059     GeoDataLineString m_path;
0060 
0061     GeoDataLineString m_turnPoints;
0062 
0063     GeoDataLineString m_waypoints;
0064 
0065     int m_travelTime;
0066 
0067     mutable bool m_positionDirty;
0068 
0069     mutable int m_closestSegmentIndex;
0070 
0071     mutable GeoDataCoordinates m_positionOnRoute;
0072 
0073     mutable GeoDataCoordinates m_currentWaypoint;
0074 
0075     GeoDataCoordinates m_position;
0076 };
0077 
0078 }
0079 
0080 #endif