diff options
author | Constantin Shalnev <c.shalnev@corp.mail.ru> | 2015-07-07 18:12:38 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:54:54 +0300 |
commit | 4fad80bf7a8c238673eee3993cf11df581f506a7 (patch) | |
tree | 0143f841e066c60014c518abb294718b32c83e94 /pedestrian_routing_benchmarks | |
parent | eea505c38f9bb6b3ed66874085d6e7437afd71e3 (diff) |
Added support for multiple pedestrian models
Diffstat (limited to 'pedestrian_routing_benchmarks')
-rw-r--r-- | pedestrian_routing_benchmarks/pedestrian_routing_benchmarks.cpp | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/pedestrian_routing_benchmarks/pedestrian_routing_benchmarks.cpp b/pedestrian_routing_benchmarks/pedestrian_routing_benchmarks.cpp index fe9e956d73..bddba3e8ba 100644 --- a/pedestrian_routing_benchmarks/pedestrian_routing_benchmarks.cpp +++ b/pedestrian_routing_benchmarks/pedestrian_routing_benchmarks.cpp @@ -7,7 +7,7 @@ #include "routing/nearest_edge_finder.hpp" #include "routing/road_graph_router.hpp" #include "routing/route.hpp" -#include "routing/vehicle_model.hpp" +#include "routing/pedestrian_model.hpp" #include "base/logging.hpp" #include "base/macros.hpp" @@ -43,19 +43,34 @@ public: } }; +class SimplifiedPedestrianModelFactory : public routing::IVehicleModelFactory +{ +public: + SimplifiedPedestrianModelFactory() + : m_model(make_shared<SimplifiedPedestrianModel>()) + {} + + // IVehicleModelFactory overrides: + shared_ptr<routing::IVehicleModel> GetVehicleModel() const override { return m_model; } + shared_ptr<routing::IVehicleModel> GetVehicleModelForCountry(string const & /*country*/) const override { return m_model; } + +private: + shared_ptr<routing::IVehicleModel> const m_model; +}; + unique_ptr<routing::IRouter> CreatePedestrianAStarTestRouter(Index const & index, routing::TMwmFileByPointFn const & countryFileFn) { - unique_ptr<routing::IVehicleModel> vehicleModel(new SimplifiedPedestrianModel()); + unique_ptr<routing::IVehicleModelFactory> vehicleModelFactory(new SimplifiedPedestrianModelFactory()); unique_ptr<routing::IRoutingAlgorithm> algorithm(new routing::AStarRoutingAlgorithm(nullptr)); - unique_ptr<routing::IRouter> router(new routing::RoadGraphRouter("test-astar-pedestrian", index, move(vehicleModel), move(algorithm), countryFileFn)); + unique_ptr<routing::IRouter> router(new routing::RoadGraphRouter("test-astar-pedestrian", index, move(vehicleModelFactory), move(algorithm), countryFileFn)); return router; } unique_ptr<routing::IRouter> CreatePedestrianAStarBidirectionalTestRouter(Index const & index, routing::TMwmFileByPointFn const & countryFileFn) { - unique_ptr<routing::IVehicleModel> vehicleModel(new SimplifiedPedestrianModel()); + unique_ptr<routing::IVehicleModelFactory> vehicleModelFactory(new SimplifiedPedestrianModelFactory()); unique_ptr<routing::IRoutingAlgorithm> algorithm(new routing::AStarBidirectionalRoutingAlgorithm(nullptr)); - unique_ptr<routing::IRouter> router(new routing::RoadGraphRouter("test-astar-bidirectional-pedestrian", index, move(vehicleModel), move(algorithm), countryFileFn)); + unique_ptr<routing::IRouter> router(new routing::RoadGraphRouter("test-astar-bidirectional-pedestrian", index, move(vehicleModelFactory), move(algorithm), countryFileFn)); return router; } |