libosmscout  0.1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules
osmscout::AbstractRoutingProfile Class Reference

#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. More...
 
void AddType (const TypeInfoRef &type, SpeedVariant speed)
 Setup speed for various grades of route type. More...
 
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. More...
 
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() More...
 
void SetCostLimitFactor (double costLimitFactor)
 The router tries to minimize the actual costs of the route. More...
 
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. More...
 
virtual double GetCosts (const Distance &distance) const =0
 Estimated cost for distance when are no limitations (max. More...
 
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. More...
 
virtual double GetCosts (const Way &way, const Distance &distance) const =0
 Estimated cost for specific way with given distance. More...
 
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< SpeedVariantspeeds
 maximum vehicle speed on route type and its grade More...
 
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()

osmscout::AbstractRoutingProfile::AbstractRoutingProfile ( const TypeConfigRef typeConfig)
explicit

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 osmscout::SpeedVariant::Fill().

Referenced by 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]

◆ 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

◆ 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

◆ GetTime() [2/2]

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

◆ GetTime2()

template<typename Obj >
Duration osmscout::AbstractRoutingProfile::GetTime2 ( const Obj &  obj,
const Distance distance 
) const
inlineprotected

◆ GetUTurnCost()

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

◆ GetVehicle()

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

◆ GetVehicleMaxSpeed()

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

◆ 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

Distance osmscout::AbstractRoutingProfile::costLimitDistance
protected

Referenced by SetCostLimitDistance().

◆ costLimitFactor

double osmscout::AbstractRoutingProfile::costLimitFactor
protected

Referenced by SetCostLimitFactor().

◆ gradeReader

GradeFeatureValueReader osmscout::AbstractRoutingProfile::gradeReader
protected

◆ maxSpeed

double osmscout::AbstractRoutingProfile::maxSpeed
protected

◆ maxSpeedReader

MaxSpeedFeatureValueReader osmscout::AbstractRoutingProfile::maxSpeedReader
protected

◆ minSpeed

double osmscout::AbstractRoutingProfile::minSpeed
protected

Referenced by AddType().

◆ speeds

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

maximum vehicle speed on route type and its grade

Referenced by AddType(), CanUse(), CanUseBackward(), CanUseForward(), ParametrizeForBicycle(), ParametrizeForCar(), and ParametrizeForFoot().

◆ typeConfig

TypeConfigRef osmscout::AbstractRoutingProfile::typeConfig
protected

◆ vehicle

Vehicle osmscout::AbstractRoutingProfile::vehicle
protected

◆ vehicleMaxSpeed

double osmscout::AbstractRoutingProfile::vehicleMaxSpeed
protected

Referenced by SetVehicleMaxSpeed().

◆ vehicleRouteNodeBit

uint8_t osmscout::AbstractRoutingProfile::vehicleRouteNodeBit
protected

Referenced by CanUse(), and SetVehicle().


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