CartoType C++ API 8.8-7-gb35e4dc71
for Windows, Linux, Qt and other platforms supporting C++ development
Public Member Functions | Public Attributes | List of all members
CartoTypeCore::RouteProfile Class Reference

#include <cartotype_navigation.h>

Public Member Functions

 RouteProfile (RouteProfileType aProfileType=RouteProfileType::Car)
 
 RouteProfile (InputStream &aInput)
 
Result ReadFromXml (InputStream &aInput)
 
Result WriteAsXml (OutputStream &aOutput) const
 
bool operator== (const RouteProfile &aOther) const
 
bool operator!= (const RouteProfile &aOther) const
 

Public Attributes

std::string Name
 
CartoTypeCore::VehicleType VehicleType
 
std::array< double, FeatureInfo::KRouteTypeCountSpeed = { }
 
std::array< double, FeatureInfo::KRouteTypeCountBonus = { }
 
std::array< uint32_t, FeatureInfo::KRouteTypeCountRestrictionOverride = { }
 
int32_t TurnTime = 4
 
int32_t UTurnTime = 300
 
int32_t CrossTrafficTurnTime = 12
 
int32_t TrafficLightTime = 10
 
bool Shortest = false
 
bool ShortestByTime = false
 
double TollPenalty = 0
 
std::array< double, FeatureInfo::KGradientCountGradientSpeed = { }
 
std::array< double, FeatureInfo::KGradientCountGradientBonus = { }
 
uint32_t GradientFlags = 0xFFFFFFFF & ~((1 << int(FeatureType::Steps)) | (1 << int(FeatureType::PassengerFerry)) | (1 << int(FeatureType::VehicularFerry)))
 

Detailed Description

A routing profile: parameters determining the type of route, including road speeds, bonuses and penalties, and vehicle type. A road type will not normally be used if its speed plus bonus is equal to or less than zero.

However, if the speed is positive and the bonus is negative, and their sum is zero, this type of road will be allowed at the beginning or end of a route, allowing travel over farm tracks, for instance, to leave or to arrive at a destination.

Similarly, restricted road types such as private roads are allowed at the beginning or end of a route.

Constructor & Destructor Documentation

◆ RouteProfile() [1/2]

CartoTypeCore::RouteProfile::RouteProfile ( RouteProfileType  aProfileType = RouteProfileType::Car)

Creates a route profile. If the profile type is not supplied the default value is the car profile type.

◆ RouteProfile() [2/2]

CartoTypeCore::RouteProfile::RouteProfile ( InputStream aInput)
explicit

Creates a route profile from XML format by reading a CartoTypeRouteProfile element. Throws an exception on error.

Member Function Documentation

◆ operator!=()

bool CartoTypeCore::RouteProfile::operator!= ( const RouteProfile aOther) const
inline

The inequality operator.

◆ operator==()

bool CartoTypeCore::RouteProfile::operator== ( const RouteProfile aOther) const

The equality operator.

◆ ReadFromXml()

Result CartoTypeCore::RouteProfile::ReadFromXml ( InputStream aInput)

Reads a route profile from XML format by reading a CartoTypeRouteProfile element..

◆ WriteAsXml()

Result CartoTypeCore::RouteProfile::WriteAsXml ( OutputStream aOutput) const

Writes the route profile in XML format as a CartoTypeRouteProfile element.

Member Data Documentation

◆ Bonus

std::array<double,FeatureInfo::KRouteTypeCount> CartoTypeCore::RouteProfile::Bonus = { }

Bonuses or penalties in notional km per hour to be added to road types to make them more or less likely to be used. For example, a penalty of 1kph is applied to walking routes along major roads because it is pleasanter to walk along quieter minor roads.

◆ CrossTrafficTurnTime

int32_t CartoTypeCore::RouteProfile::CrossTrafficTurnTime = 12

The estimated time in seconds taken for a turn across the traffic: that is, a left turn in drive-on-right countries, or a right turn in drive-on-left countries.

◆ GradientBonus

std::array<double,FeatureInfo::KGradientCount> CartoTypeCore::RouteProfile::GradientBonus = { }

Bonuses applied to roads with a particular gradient.

◆ GradientFlags

uint32_t CartoTypeCore::RouteProfile::GradientFlags = 0xFFFFFFFF & ~((1 << int(FeatureType::Steps)) | (1 << int(FeatureType::PassengerFerry)) | (1 << int(FeatureType::VehicularFerry)))

Flags indicating which roads are affected by gradient speeds and bonuses; normally steps, etc., are excluded. Each bit is (1 << route type).

◆ GradientSpeed

std::array<double,FeatureInfo::KGradientCount> CartoTypeCore::RouteProfile::GradientSpeed = { }

Speeds added to roads with a particular gradient. These values are intended for cycling, walking, hiking and running profiles, where speeds are generally the same for different types of road, but can change according to the gradient.

◆ Name

std::string CartoTypeCore::RouteProfile::Name

The optional name of the profile.

◆ RestrictionOverride

std::array<uint32_t,FeatureInfo::KRouteTypeCount> CartoTypeCore::RouteProfile::RestrictionOverride = { }

This array of bit masks allows restrictions to be overridden for certain types of road. For example, to allow routing of motor vehicles along tracks that are normally forbidden to motor vehicles, set iRestrictionOverride[size_t(FeatureType::Track)] to FeatureInfo::KRouteAccessMotorVehicle.

◆ Shortest

bool CartoTypeCore::RouteProfile::Shortest = false

Set this flag to true to get the shortest route by distance or time, ignoring weightings. Whether distance or time is used depends on the setting of iShortestByTime.

◆ ShortestByTime

bool CartoTypeCore::RouteProfile::ShortestByTime = false

Set this flag to true if iShortest should produce the shortest route by time rather than distance.

◆ Speed

std::array<double,FeatureInfo::KRouteTypeCount> CartoTypeCore::RouteProfile::Speed = { }

Speeds along roads in kilometres per hour.

◆ TollPenalty

double CartoTypeCore::RouteProfile::TollPenalty = 0

The penalty applied to toll roads as a number between zero and one. The value 1 means that no toll roads will be used, 0.5 makes toll roads half as desirable as non-toll roads of the same road type, and so on. The value 0 means that no penalty is applied to toll roads. Values outside the range 0...1 are clamped to that range.

◆ TrafficLightTime

int32_t CartoTypeCore::RouteProfile::TrafficLightTime = 10

The estimated delay in seconds caused by traffic lights.

◆ TurnTime

int32_t CartoTypeCore::RouteProfile::TurnTime = 4

The estimated time in seconds taken for any turn at a junction that is not a slight turn or simply going straight ahead.

◆ UTurnTime

int32_t CartoTypeCore::RouteProfile::UTurnTime = 300

The estimated time in seconds taken for a U-turn, defined as a turn very close to 180 degrees (within 1/32 of a circle = 11.75 degrees).

◆ VehicleType

CartoTypeCore::VehicleType CartoTypeCore::RouteProfile::VehicleType

The vehicle type, defined using access flags, dimensions, weight, etc.


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