[routing] Extended route class

This commit is contained in:
Alex Zolotarev 2014-07-07 21:16:34 +02:00 committed by Alex Zolotarev
parent 97653cc959
commit 76744a8246
3 changed files with 13 additions and 3 deletions

View file

@ -1,6 +1,7 @@
#include "helicopter_router.hpp"
#include "route.hpp"
#include "../base/timer.hpp"
#include "../base/macros.hpp"
namespace routing
@ -14,7 +15,7 @@ void HelicopterRouter::SetFinalPoint(m2::PointD const & finalPt)
void HelicopterRouter::CalculateRoute(m2::PointD const & startingPt, ReadyCallback const & callback)
{
m2::PointD points[] = {startingPt, m_finalPt};
Route route(vector<m2::PointD>(&points[0], &points[0] + ARRAY_SIZE(points)));
Route route(GetName(), vector<m2::PointD>(&points[0], &points[0] + ARRAY_SIZE(points)), my::FormatCurrentTime());
callback(route);
}

View file

@ -3,7 +3,8 @@
namespace routing
{
Route::Route(vector<m2::PointD> const & points) : m_poly(points)
Route::Route(string const & router, vector<m2::PointD> const & points, string const & name)
: m_router(router), m_poly(points), m_name(name)
{
}

View file

@ -4,6 +4,7 @@
#include "../geometry/point2d.hpp"
#include "../std/vector.hpp"
#include "../std/string.hpp"
namespace routing
{
@ -11,12 +12,19 @@ namespace routing
class Route
{
public:
Route(vector<m2::PointD> const & points);
Route(string const & router, vector<m2::PointD> const & points, string const & name = "");
string const & GetRouterId() const { return m_router; }
m2::PolylineD const & GetPoly() const { return m_poly; }
string const & GetName() const { return m_name; }
bool IsValid() const { return m_poly.GetSize(); }
private:
/// The source which created the route
string m_router;
m2::PolylineD m_poly;
string m_name;
};
} // namespace routing