[routing][traffic] Different routing options in navigation and decoder mode

Signed-off-by: mvglasow <michael -at- vonglasow.com>
This commit is contained in:
mvglasow
2025-10-18 16:34:32 +03:00
parent 38dbad0f7e
commit a3d1ed83c3
4 changed files with 26 additions and 1 deletions

View File

@@ -1091,10 +1091,15 @@ RouterResultCode IndexRouter::AdjustRoute(Checkpoints const & checkpoints, m2::P
return RouterResultCode::NoError; return RouterResultCode::NoError;
} }
RoutingOptions IndexRouter::GetRoutingOptions()
{
return RoutingOptions::LoadCarOptionsFromSettings();
}
unique_ptr<WorldGraph> IndexRouter::MakeWorldGraph() unique_ptr<WorldGraph> IndexRouter::MakeWorldGraph()
{ {
// Use saved routing options for all types (car, bicycle, pedestrian). // Use saved routing options for all types (car, bicycle, pedestrian).
RoutingOptions const routingOptions = RoutingOptions::LoadCarOptionsFromSettings(); RoutingOptions const routingOptions = GetRoutingOptions();
/// @DebugNote /// @DebugNote
// Add avoid roads here for debug purpose. // Add avoid roads here for debug purpose.
// routingOptions.Add(RoutingOptions::Road::Motorway); // routingOptions.Add(RoutingOptions::Road::Motorway);

View File

@@ -175,6 +175,14 @@ protected:
*/ */
virtual Mode GetMode() { return Mode::Navigation; } virtual Mode GetMode() { return Mode::Navigation; }
/**
* @brief Returns current routing options.
*
* In this class, the routing options are the one set in the GUI. Subclasses may override this
* method to provide different routing options.
*/
virtual RoutingOptions GetRoutingOptions();
private: private:
RouterResultCode CalculateSubrouteJointsMode(IndexGraphStarter & starter, RouterDelegate const & delegate, RouterResultCode CalculateSubrouteJointsMode(IndexGraphStarter & starter, RouterDelegate const & delegate,
std::shared_ptr<AStarProgress> const & progress, std::shared_ptr<AStarProgress> const & progress,

View File

@@ -674,6 +674,11 @@ RoutingTraffDecoder::DecoderRouter::DecoderRouter(CountryParentNameGetterFn cons
//, m_directionsEngine(CreateDirectionsEngine(m_vehicleType, m_numMwmIds, m_dataSource)) // TODO we dont need directions, can we disable that? //, m_directionsEngine(CreateDirectionsEngine(m_vehicleType, m_numMwmIds, m_dataSource)) // TODO we dont need directions, can we disable that?
{} {}
routing::RoutingOptions RoutingTraffDecoder::DecoderRouter::GetRoutingOptions()
{
return routing::RoutingOptions();
}
RoutingTraffDecoder::RoutingTraffDecoder(DataSource & dataSource, CountryInfoGetterFn countryInfoGetter, RoutingTraffDecoder::RoutingTraffDecoder(DataSource & dataSource, CountryInfoGetterFn countryInfoGetter,
const CountryParentNameGetterFn & countryParentNameGetter, const CountryParentNameGetterFn & countryParentNameGetter,
std::map<std::string, TraffMessage> & messageCache) std::map<std::string, TraffMessage> & messageCache)

View File

@@ -266,6 +266,13 @@ public:
*/ */
IndexRouter::Mode GetMode() { return IndexRouter::Mode::Decoding; } IndexRouter::Mode GetMode() { return IndexRouter::Mode::Decoding; }
/**
* @brief Returns current routing options.
*
* For traffic decoding purposes, all roads are allowed.
*/
routing::RoutingOptions GetRoutingOptions() override;
private: private:
}; };