libosmscout
0.1
|
#include <RoutingProfile.h>
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 ¤tNode, 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) |
![]() | |
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 ¤tNode, 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< SpeedVariant > | speeds |
maximum vehicle speed on route type and its grade More... | |
TypeConfigRef | typeConfig |
Vehicle | vehicle |
double | vehicleMaxSpeed |
uint8_t | vehicleRouteNodeBit |
Common base class for our concrete profile instantiations. Offers a number of profile type independent interface implementations and helper methods.
|
explicit |
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.
type | |
speed |
References osmscout::SpeedVariant::Fill().
Referenced by ParametrizeForBicycle(), ParametrizeForCar(), and ParametrizeForFoot().
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.
type | |
speed | table 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.
|
overridevirtual |
|
overridevirtual |
Implements osmscout::RoutingProfile.
References osmscout::RouteNode::objects, osmscout::RouteNode::paths, speeds, and vehicleRouteNodeBit.
|
overridevirtual |
Implements osmscout::RoutingProfile.
References accessReader, osmscout::AccessFeatureValue::CanRouteBicycle(), osmscout::AccessFeatureValue::CanRouteCar(), osmscout::AccessFeatureValue::CanRouteFoot(), osmscout::Way::GetFeatureValueBuffer(), osmscout::GradeFeatureValue::GetGrade(), osmscout::Way::GetType(), osmscout::FeatureValueReader< F, V >::GetValue(), gradeReader, osmscout::SolidGrade, speeds, vehicle, osmscout::vehicleBicycle, osmscout::vehicleCar, and osmscout::vehicleFoot.
|
overridevirtual |
Implements osmscout::RoutingProfile.
References accessReader, osmscout::AccessFeatureValue::CanRouteBicycleBackward(), osmscout::AccessFeatureValue::CanRouteCarBackward(), osmscout::AccessFeatureValue::CanRouteFootBackward(), osmscout::Way::GetFeatureValueBuffer(), osmscout::GradeFeatureValue::GetGrade(), osmscout::Way::GetType(), osmscout::FeatureValueReader< F, V >::GetValue(), gradeReader, osmscout::SolidGrade, speeds, vehicle, osmscout::vehicleBicycle, osmscout::vehicleCar, and osmscout::vehicleFoot.
|
overridevirtual |
Implements osmscout::RoutingProfile.
References accessReader, osmscout::AccessFeatureValue::CanRouteBicycleForward(), osmscout::AccessFeatureValue::CanRouteCarForward(), osmscout::AccessFeatureValue::CanRouteFootForward(), osmscout::Way::GetFeatureValueBuffer(), osmscout::GradeFeatureValue::GetGrade(), osmscout::Way::GetType(), osmscout::FeatureValueReader< F, V >::GetValue(), gradeReader, osmscout::SolidGrade, speeds, vehicle, osmscout::vehicleBicycle, osmscout::vehicleCar, and osmscout::vehicleFoot.
|
inlineoverridevirtual |
Implements osmscout::RoutingProfile.
|
inlineoverridevirtual |
Implements osmscout::RoutingProfile.
|
inlineoverridevirtual |
Textual representation of cost.
Implements osmscout::RoutingProfile.
Reimplemented in osmscout::FastestPathRoutingProfile, and osmscout::ShortestPathRoutingProfile.
|
inlineoverridevirtual |
Implements osmscout::RoutingProfile.
|
inlineoverridevirtual |
Implements osmscout::RoutingProfile.
|
overridevirtual |
Implements osmscout::RoutingProfile.
Reimplemented in osmscout::FastestPathRoutingProfile.
|
inlineoverridevirtual |
Implements osmscout::RoutingProfile.
|
inline |
|
virtual |
Reimplemented in osmscout::FastestPathRoutingProfile.
References AddType(), maxSpeed, SetVehicle(), SetVehicleMaxSpeed(), speeds, typeConfig, and osmscout::vehicleBicycle.
Referenced by osmscout::FastestPathRoutingProfile::ParametrizeForBicycle().
|
virtual |
Reimplemented in osmscout::FastestPathRoutingProfile.
References AddType(), osmscout::Log::Error(), osmscout::log, maxSpeed, SetVehicle(), SetVehicleMaxSpeed(), speeds, typeConfig, and osmscout::vehicleCar.
Referenced by osmscout::FastestPathRoutingProfile::ParametrizeForCar().
|
virtual |
Reimplemented in osmscout::FastestPathRoutingProfile.
References AddType(), maxSpeed, SetVehicle(), SetVehicleMaxSpeed(), speeds, typeConfig, and osmscout::vehicleFoot.
Referenced by osmscout::FastestPathRoutingProfile::ParametrizeForFoot().
void osmscout::AbstractRoutingProfile::SetCostLimitDistance | ( | const Distance & | costLimitDistance | ) |
seet SetCostLimitFactor()
costLimitDistance | static distance value added to the maximum cost |
References costLimitDistance.
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().
costLimitFactor | The new limit |
References costLimitFactor.
void osmscout::AbstractRoutingProfile::SetVehicle | ( | Vehicle | vehicle | ) |
References osmscout::RouteNode::usableByBicycle, osmscout::RouteNode::usableByCar, osmscout::RouteNode::usableByFoot, vehicle, osmscout::vehicleBicycle, osmscout::vehicleCar, osmscout::vehicleFoot, and vehicleRouteNodeBit.
Referenced by ParametrizeForBicycle(), ParametrizeForCar(), and ParametrizeForFoot().
void osmscout::AbstractRoutingProfile::SetVehicleMaxSpeed | ( | double | maxSpeed | ) |
References maxSpeed, and vehicleMaxSpeed.
Referenced by ParametrizeForBicycle(), ParametrizeForCar(), and ParametrizeForFoot().
|
protected |
Referenced by CanUse(), CanUseBackward(), and CanUseForward().
|
protected |
Referenced by SetCostLimitDistance().
|
protected |
Referenced by SetCostLimitFactor().
|
protected |
Referenced by CanUse(), CanUseBackward(), and CanUseForward().
|
protected |
Referenced by AddType(), ParametrizeForBicycle(), ParametrizeForCar(), ParametrizeForFoot(), and SetVehicleMaxSpeed().
|
protected |
|
protected |
Referenced by AddType().
|
protected |
maximum vehicle speed on route type and its grade
Referenced by AddType(), CanUse(), CanUseBackward(), CanUseForward(), ParametrizeForBicycle(), ParametrizeForCar(), and ParametrizeForFoot().
|
protected |
Referenced by ParametrizeForBicycle(), ParametrizeForCar(), and ParametrizeForFoot().
|
protected |
Referenced by CanUse(), CanUseBackward(), CanUseForward(), and SetVehicle().
|
protected |
Referenced by SetVehicleMaxSpeed().
|
protected |
Referenced by CanUse(), and SetVehicle().