libosmscout
0.1
|
#include <AbstractRoutingService.h>
Public Member Functions | |
AbstractRoutingService (const RouterParameter ¶meter) | |
RoutingResult | CalculateRoute (RoutingState &state, const RoutePosition &start, const RoutePosition &target, const std::optional< osmscout::Bearing > &bearing, const RoutingParameter ¶meter) |
Calculate a route. More... | |
virtual std::map< DatabaseId, std::string > | GetDatabaseMapping () const =0 |
Get current mapping of DatabaseId to db path than be used later for lookup objects in description. More... | |
RoutePointsResult | TransformRouteDataToPoints (const RouteData &data) |
Transforms the route into a list of points. More... | |
RouteDescriptionResult | TransformRouteDataToRouteDescription (const RouteData &data) |
Transform the route into a RouteDescription. More... | |
RouteWayResult | TransformRouteDataToWay (const RouteData &data) |
Transforms the route into a Way (with empty type) More... | |
~AbstractRoutingService () override | |
![]() | |
RoutingService () | |
virtual | ~RoutingService () |
Protected Member Functions | |
void | AddNodes (RouteData &route, DatabaseId database, Id startNodeId, size_t startNodeIndex, const ObjectFileRef &object, size_t idCount, bool oneway, size_t targetNodeIndex) |
virtual bool | CanUse (const RoutingState &state, DatabaseId database, const RouteNode &routeNode, size_t pathIndex)=0 |
virtual bool | CanUseBackward (const RoutingState &state, const DatabaseId &database, const WayRef &way)=0 |
virtual bool | CanUseForward (const RoutingState &state, const DatabaseId &database, const WayRef &way)=0 |
virtual bool | GetAreaByOffset (const DBFileOffset &offset, AreaRef &area)=0 |
virtual bool | GetAreasByOffset (const std::set< DBFileOffset > &areaOffsets, std::unordered_map< DBFileOffset, AreaRef > &areaMap)=0 |
virtual double | GetCostLimit (const RoutingState &state, DatabaseId database, const Distance &targetDistance)=0 |
virtual double | GetCosts (const RoutingState &state, DatabaseId database, const RouteNode &routeNode, size_t inPathIndex, size_t outPathIndex)=0 |
virtual double | GetCosts (const RoutingState &state, DatabaseId database, const WayRef &way, const Distance &wayLength)=0 |
virtual std::string | GetCostString (const RoutingState &state, DatabaseId database, double cost) const =0 |
virtual double | GetEstimateCosts (const RoutingState &state, DatabaseId database, const Distance &targetDistance)=0 |
virtual std::vector< DBId > | GetNodeTwins (const RoutingState &state, DatabaseId database, Id id)=0 |
bool | GetRNode (const RoutingState &state, const RoutePosition &position, const WayRef &way, size_t routeNodeIndex, const RouteNodeRef &routeNode, const GeoCoord &startCoord, const GeoCoord &targetCoord, RNodeRef &node) |
virtual bool | GetRouteNode (const DBId &id, RouteNodeRef &node)=0 |
Return the route node for the given db offset. More... | |
virtual bool | GetRouteNodes (const std::set< DBId > &routeNodeIds, std::unordered_map< DBId, RouteNodeRef > &routeNodeMap)=0 |
void | GetStartBackwardRouteNode (const RoutingState &state, const DatabaseId &database, const WayRef &way, size_t nodeIndex, RouteNodeRef &routeNode, size_t &routeNodeIndex) |
void | GetStartForwardRouteNode (const RoutingState &state, const DatabaseId &database, const WayRef &way, size_t nodeIndex, RouteNodeRef &routeNode, size_t &routeNodeIndex) |
bool | GetStartNodes (const RoutingState &state, const RoutePosition &position, GeoCoord &startCoord, const GeoCoord &targetCoord, RouteNodeRef &forwardRouteNode, RouteNodeRef &backwardRouteNode, RNodeRef &forwardRNode, RNodeRef &backwardRNode) |
The start position is at the given position defined by an object and the index of the node within the object. More... | |
void | GetTargetBackwardRouteNode (const RoutingState &state, const DatabaseId &database, const WayRef &way, size_t nodeIndex, RouteNodeRef &routeNode) |
Return the route node that allows navigating to the given node in backward direction. More... | |
void | GetTargetForwardRouteNode (const RoutingState &state, const DatabaseId &database, const WayRef &way, size_t nodeIndex, RouteNodeRef &routeNode) |
Return the route node that allows navigating to the given node in forward direction. More... | |
bool | GetTargetNodes (const RoutingState &state, const RoutePosition &position, GeoCoord &targetCoord, RouteNodeRef &forwardNode, RouteNodeRef &backwardNode) |
The target position is at the given position defined by an object and the index of the node within the object. More... | |
virtual double | GetUTurnCost (const RoutingState &state, const DatabaseId databaseId)=0 |
virtual Vehicle | GetVehicle (const RoutingState &state)=0 |
virtual bool | GetWayByOffset (const DBFileOffset &offset, WayRef &way)=0 |
virtual bool | GetWaysByOffset (const std::set< DBFileOffset > &wayOffsets, std::unordered_map< DBFileOffset, WayRef > &wayMap)=0 |
bool | GetWayStartNodes (const RoutingState &state, const RoutePosition &position, GeoCoord &startCoord, const GeoCoord &targetCoord, RouteNodeRef &forwardRouteNode, RouteNodeRef &backwardRouteNode, RNodeRef &forwardRNode, RNodeRef &backwardRNode) |
The start position is at the given way and the index of the node within the object. More... | |
bool | GetWayTargetNodes (const RoutingState &state, const RoutePosition &position, GeoCoord &targetCoord, RouteNodeRef &forwardNode, RouteNodeRef &backwardNode) |
The target position is at the given position defined by an object and the index of the node within the object. More... | |
void | ResolveRNodeChainToList (const RNode &finalRouteNode, const ClosedSet &closedSet, std::list< VNode > &nodes) |
bool | ResolveRNodesToRouteData (const RoutingState &state, const std::list< VNode > &nodes, const RoutePosition &start, const RoutePosition &target, RouteData &route) |
virtual bool | ResolveRouteDataJunctions (RouteData &route)=0 |
bool | RestrictInitialUTurn (const RoutingState &state, const Bearing &vehicleBearing, const RoutePosition &start, RNodeRef startForwardNode, RNodeRef startBackwardNode) |
virtual bool | WalkPaths (const RoutingState &state, RNodeRef ¤t, RouteNodeRef ¤tRouteNode, OpenList &openList, OpenMap &openMap, ClosedSet &closedSet, RoutingResult &result, const RoutingParameter ¶meter, const GeoCoord &targetCoord, const Vehicle &vehicle, size_t &nodesIgnoredCount, Distance ¤tMaxDistance, const Distance &overallDistance, const double &costLimit) |
virtual bool | WalkToOtherDatabases (const RoutingState &state, RNodeRef ¤t, RouteNodeRef ¤tRouteNode, OpenList &openList, OpenMap &openMap, const ClosedSet &closedSet) |
Protected Attributes | |
bool | debugPerformance |
Additional Inherited Members | |
![]() | |
static std::string | GetData2Filename (const std::string &filenamebase) |
static std::string | GetDataFilename (const std::string &filenamebase) |
static std::string | GetIndexFilename (const std::string &filenamebase) |
![]() | |
static const char *const | DEFAULT_FILENAME_BASE = "router" |
Relative filebase name for touting data as generated by default by the importer. More... | |
static const char *const | FILENAME_INTERSECTIONS_DAT = "intersections.dat" |
Relative filename of the intersection data file. More... | |
static const char *const | FILENAME_INTERSECTIONS_IDX = "intersections.idx" |
Relative filename of the intersection index file. More... | |
![]() | |
using | ClosedSet = std::unordered_set< VNode, ClosedNodeHasher > |
using | OpenList = std::set< RNodeRef, RNodeCostCompare > |
using | OpenListRef = std::set< RNodeRef, RNodeCostCompare >::iterator |
using | OpenMap = std::unordered_map< DBId, OpenListRef > |
using | RNodeRef = std::shared_ptr< RNode > |
Abstract algorithms for routing
|
explicit |
|
override |
|
protected |
RoutingResult osmscout::AbstractRoutingService< RoutingState >::CalculateRoute | ( | RoutingState & | state, |
const RoutePosition & | start, | ||
const RoutePosition & | target, | ||
const std::optional< osmscout::Bearing > & | bearing, | ||
const RoutingParameter & | parameter | ||
) |
Calculate a route.
state | State to use |
start | Start of the route |
target | Target of teh route |
bearing | Initial vehicle bearing, route will start by the way in specified direction. When possible. |
progress | Optional callback for handling routing progress |
route | The route object holding the resulting route on success |
Referenced by osmscout::MultiDBRoutingService::CalculateRoute().
|
protectedpure virtual |
Implemented in osmscout::SimpleRoutingService.
|
protectedpure virtual |
Implemented in osmscout::SimpleRoutingService.
|
protectedpure virtual |
Implemented in osmscout::SimpleRoutingService.
|
protectedpure virtual |
Implemented in osmscout::SimpleRoutingService.
|
protectedpure virtual |
Implemented in osmscout::SimpleRoutingService.
|
protectedpure virtual |
Implemented in osmscout::SimpleRoutingService.
|
protectedpure virtual |
Implemented in osmscout::SimpleRoutingService.
|
protectedpure virtual |
Implemented in osmscout::SimpleRoutingService.
|
protectedpure virtual |
Implemented in osmscout::SimpleRoutingService.
|
pure virtual |
Get current mapping of DatabaseId to db path than be used later for lookup objects in description.
|
protectedpure virtual |
Implemented in osmscout::SimpleRoutingService.
|
protectedpure virtual |
Implemented in osmscout::SimpleRoutingService.
|
protected |
|
protectedpure virtual |
Return the route node for the given db offset.
Implemented in osmscout::SimpleRoutingService.
|
protectedpure virtual |
Implemented in osmscout::SimpleRoutingService.
|
protected |
|
protected |
|
protected |
The start position is at the given position defined by an object and the index of the node within the object.
Return the closest route node and routing node either in the forward or backward direction or both.
state | The routing state |
position | The start position |
startCoord | The coordinate of the start position |
targetCoord | The coordinate of the target position |
forwardRouteNode | Optional route node in the forward direction |
backwardRouteNode | Optional route node in the backward direction |
forwardRNode | Optional prefilled routing node for the forward direction to be used as part of the routing process |
backwardRNode | Optional prefilled routing node for the backward direction to be used as part of the routing process |
|
protected |
Return the route node that allows navigating to the given node in backward direction.
In result the returned routing node will have a bigger or equal index then the given node index.
|
protected |
Return the route node that allows navigating to the given node in forward direction.
In result the returned routing node will have a smaller index then the given node index.
|
protected |
The target position is at the given position defined by an object and the index of the node within the object.
Return the closest route node and routing node either in the forward or backward direction or both.
state | The routing state |
position | The start position |
targetCoord | The coordinate of the target position |
forwardRouteNode | Optional route node in the forward direction |
backwardRouteNode | Optional route node in the backward direction |
|
protectedpure virtual |
Implemented in osmscout::SimpleRoutingService.
|
protectedpure virtual |
Implemented in osmscout::SimpleRoutingService.
|
protectedpure virtual |
Implemented in osmscout::SimpleRoutingService.
|
protectedpure virtual |
Implemented in osmscout::SimpleRoutingService.
|
protected |
The start position is at the given way and the index of the node within the object.
Return the closest route node and routing node either in the forward or backward direction or both.
state | The routing state |
position | The start position |
startCoord | The coordinate of the start position |
targetCoord | The coordinate of the target position |
forwardRouteNode | Optional route node in the forward direction |
backwardRouteNode | Optional route node in the backward direction |
forwardRNode | Optional prefilled routing node for the forward direction to be used as part of the routing process |
backwardRNode | Optional prefilled routing node for the backward direction to be used as part of the routing process |
|
protected |
The target position is at the given position defined by an object and the index of the node within the object.
Return the closest route node and routing node either in the forward or backward direction or both.
state | The routing state |
position | The start position |
targetCoord | The coordinate of the target position |
forwardRouteNode | Optional route node in the forward direction |
backwardRouteNode | Optional route node in the backward direction |
|
protected |
|
protected |
|
protectedpure virtual |
Implemented in osmscout::SimpleRoutingService.
|
protected |
RoutePointsResult osmscout::AbstractRoutingService< RoutingState >::TransformRouteDataToPoints | ( | const RouteData & | data | ) |
Transforms the route into a list of points.
data | Route data |
points | A list of the points holding route nodes |
Referenced by osmscout::MultiDBRoutingService::TransformRouteDataToPoints().
RouteDescriptionResult osmscout::AbstractRoutingService< RoutingState >::TransformRouteDataToRouteDescription | ( | const RouteData & | data | ) |
Transform the route into a RouteDescription.
The RouteDescription can be further transformed to enhanced textual and/or visual description of the route containing additional information.
data | Route data |
description | An initialized description on success |
Referenced by osmscout::MultiDBRoutingService::TransformRouteDataToRouteDescription().
RouteWayResult osmscout::AbstractRoutingService< RoutingState >::TransformRouteDataToWay | ( | const RouteData & | data | ) |
Transforms the route into a Way (with empty type)
Referenced by osmscout::MultiDBRoutingService::TransformRouteDataToWay().
|
protectedvirtual |
|
protectedvirtual |
|
protected |