diff --git a/routing/geometry.hpp b/routing/geometry.hpp index c79ef3e8ba..f8557d6e4a 100644 --- a/routing/geometry.hpp +++ b/routing/geometry.hpp @@ -64,6 +64,7 @@ public: private: buffer_vector m_junctions; + // @TODO(bykoianko) Speed in city and outside should be kept. VehicleModelInterface::SpeedKMpH m_speed; bool m_isOneWay = false; bool m_valid = false; diff --git a/routing/index_graph_loader.cpp b/routing/index_graph_loader.cpp index 67ad451542..ebe12eac41 100644 --- a/routing/index_graph_loader.cpp +++ b/routing/index_graph_loader.cpp @@ -1,5 +1,6 @@ #include "routing/index_graph_loader.hpp" +#include "routing/city_roads.hpp" #include "routing/index_graph_serialization.hpp" #include "routing/restriction_loader.hpp" #include "routing/road_access_serialization.hpp" @@ -37,14 +38,15 @@ public: void Clear() override; private: - struct GeometryIndexGraph + struct GraphAttrs { shared_ptr m_geometry; + shared_ptr m_cityRoads; unique_ptr m_indexGraph; }; - GeometryIndexGraph & CreateGeometry(NumMwmId numMwmId); - GeometryIndexGraph & CreateIndexGraph(NumMwmId numMwmId, GeometryIndexGraph & graph); + GraphAttrs & CreateGeometry(NumMwmId numMwmId); + GraphAttrs & CreateIndexGraph(NumMwmId numMwmId, GraphAttrs & graph); VehicleType m_vehicleType; bool m_loadAltitudes; @@ -52,7 +54,8 @@ private: shared_ptr m_numMwmIds; shared_ptr m_vehicleModelFactory; shared_ptr m_estimator; - unordered_map m_graphs; + + unordered_map m_graphs; // TODO (@gmoryes) move this field to |GeometryIndexGraph| after @bykoianko PR unordered_map>> m_cachedCameras; @@ -93,6 +96,8 @@ IndexGraph & IndexGraphLoaderImpl::GetIndexGraph(NumMwmId numMwmId) : *CreateIndexGraph(numMwmId, it->second).m_indexGraph; } + // @TODO(bykoianko) shared_prt should be created and passed to CreateIndexGraph() to + // create IndexGraph. return *CreateIndexGraph(numMwmId, CreateGeometry(numMwmId)).m_indexGraph; } @@ -171,7 +176,7 @@ vector IndexGraphLoaderImpl::GetSpeedCameraInfo(Segme return cameras; } -IndexGraphLoaderImpl::GeometryIndexGraph & IndexGraphLoaderImpl::CreateGeometry(NumMwmId numMwmId) +IndexGraphLoaderImpl::GraphAttrs & IndexGraphLoaderImpl::CreateGeometry(NumMwmId numMwmId) { platform::CountryFile const & file = m_numMwmIds->GetFile(numMwmId); MwmSet::MwmHandle handle = m_dataSource.GetMwmHandleByCountryFile(file); @@ -182,13 +187,14 @@ IndexGraphLoaderImpl::GeometryIndexGraph & IndexGraphLoaderImpl::CreateGeometry( m_vehicleModelFactory->GetVehicleModelForCountry(file.GetName()); auto & graph = m_graphs[numMwmId]; + // @TODO(bykoianko) shared_ptr should be passed to GeomtryLoader. graph.m_geometry = make_shared(GeometryLoader::Create(m_dataSource, handle, vehicleModel, m_loadAltitudes)); return graph; } -IndexGraphLoaderImpl::GeometryIndexGraph & IndexGraphLoaderImpl::CreateIndexGraph( - NumMwmId numMwmId, GeometryIndexGraph & graph) +IndexGraphLoaderImpl::GraphAttrs & IndexGraphLoaderImpl::CreateIndexGraph( + NumMwmId numMwmId, GraphAttrs & graph) { CHECK(graph.m_geometry, ()); platform::CountryFile const & file = m_numMwmIds->GetFile(numMwmId); diff --git a/routing_common/vehicle_model.hpp b/routing_common/vehicle_model.hpp index f3ad6d7126..fbe0628d73 100644 --- a/routing_common/vehicle_model.hpp +++ b/routing_common/vehicle_model.hpp @@ -43,6 +43,9 @@ public: } }; + // @TODO(bykoianko) A struct for adding speed in city and out side should be added. + // This structure should contain to fields of SpeedKMpH type. + /// Factors which reduce weight and ETA speed on feature in case of bad pavement. /// Both should be in range [0.0, 1.0]. struct SpeedFactor @@ -57,6 +60,8 @@ public: /// 0 means that it's forbidden to move on this feature or it's not a road at all. virtual SpeedKMpH GetSpeed(FeatureType & f) const = 0; + // @TODO(bykoianko) Method for getting speed in city and outside should be added. + /// @returns Max weight and ETA speed in KMpH for this model virtual SpeedKMpH GetMaxSpeed() const = 0; @@ -217,6 +222,7 @@ private: } private: + // @TODO(bykoianko) Road limits should contain speed for roads inside a city and outside. SpeedKMpH const m_speed; bool const m_isPassThroughAllowed; };