libosmscout 0.1
Loading...
Searching...
No Matches
osmscout::AbstractRoutingProfile Class Reference

Common base class for our concrete profile instantiations. More...

#include <RoutingProfile.h>

Inheritance diagram for osmscout::AbstractRoutingProfile:

Public Member Functions

 AbstractRoutingProfile (const TypeConfigRef &typeConfig)
void AddType (const TypeInfoRef &type, double speed)
 Setup same speed for all grades of route type.
void AddType (const TypeInfoRef &type, SpeedVariant speed)
 Setup speed for various grades of route type.
bool CanUse (const Area &area) const override
bool CanUse (const RouteNode &currentNode, const std::vector< ObjectVariantData > &objectVariantData, size_t pathIndex) const override
bool CanUse (const Way &way) const override
bool CanUseBackward (const Way &way) const override
bool CanUseForward (const Way &way) const override
Distance GetCostLimitDistance () const override
double GetCostLimitFactor () const override
std::string GetCostString (double cost) const override
 Textual representation of cost.
Duration GetTime (const Area &area, const Distance &distance) const override
Duration GetTime (const Way &way, const Distance &distance) const override
double GetUTurnCost () const override
Vehicle GetVehicle () const override
double GetVehicleMaxSpeed () const
virtual void ParametrizeForBicycle (const TypeConfig &typeConfig, double maxSpeed)
virtual bool ParametrizeForCar (const TypeConfig &typeConfig, const std::map< std::string, double > &speedMap, double maxSpeed)
virtual void ParametrizeForFoot (const TypeConfig &typeConfig, double maxSpeed)
void SetCostLimitDistance (const Distance &costLimitDistance)
 seet SetCostLimitFactor()
void SetCostLimitFactor (double costLimitFactor)
 The router tries to minimize the actual costs of the route.
void SetVehicle (Vehicle vehicle)
void SetVehicleMaxSpeed (double maxSpeed)
Public Member Functions inherited from osmscout::RoutingProfile
virtual double GetCosts (const Area &area, const Distance &distance) const =0
 Estimated cost for specific area with given distance.
virtual double GetCosts (const Distance &distance) const =0
 Estimated cost for distance when are no limitations (max.
virtual double GetCosts (const RouteNode &currentNode, const std::vector< ObjectVariantData > &objectVariantData, size_t inPathIndex, size_t outPathIndex) const =0
 Estimated cost for outgoing path (outPathIndex) from currentNode when currentNode is entered from inPathIndex.
virtual double GetCosts (const Way &way, const Distance &distance) const =0
 Estimated cost for specific way with given distance.
virtual ~RoutingProfile ()=default

Protected Member Functions

template<typename Obj>
Duration GetTime2 (const Obj &obj, const Distance &distance) const

Protected Attributes

AccessFeatureValueReader accessReader
Distance costLimitDistance
double costLimitFactor
GradeFeatureValueReader gradeReader
double maxSpeed
MaxSpeedFeatureValueReader maxSpeedReader
double minSpeed
std::vector< SpeedVariant > speeds
 maximum vehicle speed on route type and its grade
TypeConfigRef typeConfig
Vehicle vehicle
double vehicleMaxSpeed
uint8_t vehicleRouteNodeBit

Detailed Description

Common base class for our concrete profile instantiations.

Offers a number of profile type independent interface implementations and helper methods.

Constructor & Destructor Documentation

◆ AbstractRoutingProfile()

Member Function Documentation

◆ AddType() [1/2]

void osmscout::AbstractRoutingProfile::AddType ( const TypeInfoRef & type,
double speed )

Setup same speed for all grades of route type.

Type may be forbidden for routing by setting speed to zero.

Parameters
type
speed

References AddType(), and osmscout::SpeedVariant::Fill().

Referenced by AddType(), ParametrizeForBicycle(), ParametrizeForCar(), and ParametrizeForFoot().

◆ AddType() [2/2]

void osmscout::AbstractRoutingProfile::AddType ( const TypeInfoRef & type,
SpeedVariant speed )

Setup speed for various grades of route type.

Setup zero speed to forbid some grade for routing.

Parameters
type
speedtable of speeds for various grades. (copy in intentional) SetupValues() is called to fill all values.

References osmscout::SpeedVariant::Fill(), osmscout::SpeedVariant::Max(), maxSpeed, osmscout::SpeedVariant::Min(), minSpeed, osmscout::SpeedVariant::SetupValues(), and speeds.

◆ CanUse() [1/3]

bool osmscout::AbstractRoutingProfile::CanUse ( const Area & area) const
overridevirtual

◆ CanUse() [2/3]

bool osmscout::AbstractRoutingProfile::CanUse ( const RouteNode & currentNode,
const std::vector< ObjectVariantData > & objectVariantData,
size_t pathIndex ) const
overridevirtual

◆ CanUse() [3/3]

◆ CanUseBackward()

◆ CanUseForward()

◆ GetCostLimitDistance()

Distance osmscout::AbstractRoutingProfile::GetCostLimitDistance ( ) const
inlineoverridevirtual

◆ GetCostLimitFactor()

double osmscout::AbstractRoutingProfile::GetCostLimitFactor ( ) const
inlineoverridevirtual

Implements osmscout::RoutingProfile.

References costLimitFactor.

◆ GetCostString()

std::string osmscout::AbstractRoutingProfile::GetCostString ( double cost) const
inlineoverridevirtual

Textual representation of cost.

Implements osmscout::RoutingProfile.

Reimplemented in osmscout::FastestPathRoutingProfile, and osmscout::ShortestPathRoutingProfile.

◆ GetTime() [1/2]

Duration osmscout::AbstractRoutingProfile::GetTime ( const Area & area,
const Distance & distance ) const
inlineoverridevirtual

Implements osmscout::RoutingProfile.

References GetTime2().

◆ GetTime() [2/2]

Duration osmscout::AbstractRoutingProfile::GetTime ( const Way & way,
const Distance & distance ) const
inlineoverridevirtual

Implements osmscout::RoutingProfile.

References GetTime2().

◆ GetTime2()

◆ GetUTurnCost()

double osmscout::AbstractRoutingProfile::GetUTurnCost ( ) const
overridevirtual

◆ GetVehicle()

Vehicle osmscout::AbstractRoutingProfile::GetVehicle ( ) const
inlineoverridevirtual

Implements osmscout::RoutingProfile.

References vehicle.

◆ GetVehicleMaxSpeed()

double osmscout::AbstractRoutingProfile::GetVehicleMaxSpeed ( ) const
inline

References vehicleMaxSpeed.

◆ ParametrizeForBicycle()

void osmscout::AbstractRoutingProfile::ParametrizeForBicycle ( const TypeConfig & typeConfig,
double maxSpeed )
virtual

◆ ParametrizeForCar()

bool osmscout::AbstractRoutingProfile::ParametrizeForCar ( const TypeConfig & typeConfig,
const std::map< std::string, double > & speedMap,
double maxSpeed )
virtual

◆ ParametrizeForFoot()

void osmscout::AbstractRoutingProfile::ParametrizeForFoot ( const TypeConfig & typeConfig,
double maxSpeed )
virtual

◆ SetCostLimitDistance()

void osmscout::AbstractRoutingProfile::SetCostLimitDistance ( const Distance & costLimitDistance)

seet SetCostLimitFactor()

Parameters
costLimitDistancestatic distance value added to the maximum cost

References costLimitDistance.

◆ SetCostLimitFactor()

void osmscout::AbstractRoutingProfile::SetCostLimitFactor ( double costLimitFactor)

The router tries to minimize the actual costs of the route.

There is a lower limit defined by GetCosts(double distance). Applying the given factor to the minimal cost results in a upper limit for the costs.

Increasing the factor results in the router trying harder to find a route by looking for bigger and even bigger detours, decreasing the factor result in the router either finding a rather direct route or none. Setting the factor below 1.0 should result in the router not finding any route at all.

If there is a router the current router will find it and the router will look for the optimal route first. So, if there is a route the limit could be set to std::limits<double>::max(). If there is no route though the limit will stop the router to search for all possible detours, walking the whole graph in the end. Since this might take for ever the limit should be reasonable high.

The actual maximum cost limit is calculated based on a constant limit distance (default 10.0 Km) and a cost factor applied to the minimum costs default 5.0).

So the resulting maximum cost are profile.GetCosts(profile.GetCostLimitDistance())+ profile.GetCosts(distance)*profile.GetCostLimitFactor().

Parameters
costLimitFactorThe new limit

References costLimitFactor.

◆ SetVehicle()

◆ SetVehicleMaxSpeed()

void osmscout::AbstractRoutingProfile::SetVehicleMaxSpeed ( double maxSpeed)

Member Data Documentation

◆ accessReader

AccessFeatureValueReader osmscout::AbstractRoutingProfile::accessReader
protected

◆ costLimitDistance

◆ costLimitFactor

◆ gradeReader

GradeFeatureValueReader osmscout::AbstractRoutingProfile::gradeReader
protected

◆ maxSpeed

◆ maxSpeedReader

MaxSpeedFeatureValueReader osmscout::AbstractRoutingProfile::maxSpeedReader
protected

Referenced by AbstractRoutingProfile(), and GetTime2().

◆ minSpeed

double osmscout::AbstractRoutingProfile::minSpeed
protected

◆ speeds

std::vector<SpeedVariant> osmscout::AbstractRoutingProfile::speeds
protected

◆ typeConfig

◆ vehicle

◆ vehicleMaxSpeed

◆ vehicleRouteNodeBit

uint8_t osmscout::AbstractRoutingProfile::vehicleRouteNodeBit
protected

The documentation for this class was generated from the following files: