Clarify identifier types used in data facade
The data facade interface contains numerous methods for looking up datapoints by identifiers. Many of the parameters use the NodeID or EdgeID types. However, these two identifier types are used for representing three different contexts: 1. Node-based graph edges and nodes 2. Edge-based graph edges and nodes 3. Packed geometries Consider the use of identifier parameters in these examples: --- GetWeightPenaltyForEdgeID(const EdgeID id) <- edge-based edge GetUncompressedForwardWeights(const EdgeID id) <- packed geometry IsLeftHandDriving(const NodeID id) <- edge-based node GetBearingClass(const NodeID node) <- node-based node --- This mixing of contexts within the same interface makes it difficult to understand the relationships and dependencies between the OSRM datasets. For 1. and 2. we continue to use the NodeID and EdgeID types, but change the interface parameter names to identify them as edge-based or node-based graph properties. For 3. we define a new type definition, PackedGeometryID. These changes are to aid with readability. A next step would be to strongly type these definitions, leveraging the Alias template already used for OSM identifiers.
This commit is contained in:
parent
e872f1d6c3
commit
7f014bd616
@ -10,6 +10,7 @@
|
|||||||
- CHANGED: Pass osm_node_ids by reference in osrm::updater::Updater class. [#6298](https://github.com/Project-OSRM/osrm-backend/pull/6298)
|
- CHANGED: Pass osm_node_ids by reference in osrm::updater::Updater class. [#6298](https://github.com/Project-OSRM/osrm-backend/pull/6298)
|
||||||
- FIXED: Fix bug with reading Set values from Lua scripts. [#6285](https://github.com/Project-OSRM/osrm-backend/pull/6285)
|
- FIXED: Fix bug with reading Set values from Lua scripts. [#6285](https://github.com/Project-OSRM/osrm-backend/pull/6285)
|
||||||
- FIXED: Bug in bicycle profile that caused exceptions if there is a highway=bicycle in the data. [#6296](https://github.com/Project-OSRM/osrm-backend/pull/6296)
|
- FIXED: Bug in bicycle profile that caused exceptions if there is a highway=bicycle in the data. [#6296](https://github.com/Project-OSRM/osrm-backend/pull/6296)
|
||||||
|
- FIXED: Internal refactoring of identifier types used in data facade [#6044](https://github.com/Project-OSRM/osrm-backend/pull/6044)
|
||||||
- Build:
|
- Build:
|
||||||
- CHANGED: Use the latest node on CI. [#6317](https://github.com/Project-OSRM/osrm-backend/pull/6317)
|
- CHANGED: Use the latest node on CI. [#6317](https://github.com/Project-OSRM/osrm-backend/pull/6317)
|
||||||
- CHANGED: Migrate Windows CI to GitHub Actions. [#6312](https://github.com/Project-OSRM/osrm-backend/pull/6312)
|
- CHANGED: Migrate Windows CI to GitHub Actions. [#6312](https://github.com/Project-OSRM/osrm-backend/pull/6312)
|
||||||
|
@ -36,24 +36,27 @@ template <> class AlgorithmDataFacade<CH>
|
|||||||
|
|
||||||
virtual unsigned GetNumberOfEdges() const = 0;
|
virtual unsigned GetNumberOfEdges() const = 0;
|
||||||
|
|
||||||
virtual unsigned GetOutDegree(const NodeID n) const = 0;
|
virtual unsigned GetOutDegree(const NodeID edge_based_node_id) const = 0;
|
||||||
|
|
||||||
virtual NodeID GetTarget(const EdgeID e) const = 0;
|
virtual NodeID GetTarget(const EdgeID edge_based_edge_id) const = 0;
|
||||||
|
|
||||||
virtual const EdgeData &GetEdgeData(const EdgeID e) const = 0;
|
virtual const EdgeData &GetEdgeData(const EdgeID edge_based_edge_id) const = 0;
|
||||||
|
|
||||||
virtual EdgeRange GetAdjacentEdgeRange(const NodeID node) const = 0;
|
virtual EdgeRange GetAdjacentEdgeRange(const NodeID edge_based_node_id) const = 0;
|
||||||
|
|
||||||
// searches for a specific edge
|
// searches for a specific edge
|
||||||
virtual EdgeID FindEdge(const NodeID from, const NodeID to) const = 0;
|
virtual EdgeID FindEdge(const NodeID edge_based_node_from,
|
||||||
|
const NodeID edge_based_node_to) const = 0;
|
||||||
|
|
||||||
virtual EdgeID FindEdgeInEitherDirection(const NodeID from, const NodeID to) const = 0;
|
virtual EdgeID FindEdgeInEitherDirection(const NodeID edge_based_node_from,
|
||||||
|
const NodeID edge_based_node_to) const = 0;
|
||||||
|
|
||||||
virtual EdgeID
|
virtual EdgeID FindEdgeIndicateIfReverse(const NodeID edge_based_node_from,
|
||||||
FindEdgeIndicateIfReverse(const NodeID from, const NodeID to, bool &result) const = 0;
|
const NodeID edge_based_node_to,
|
||||||
|
bool &result) const = 0;
|
||||||
|
|
||||||
virtual EdgeID FindSmallestEdge(const NodeID from,
|
virtual EdgeID FindSmallestEdge(const NodeID edge_based_node_from,
|
||||||
const NodeID to,
|
const NodeID edge_based_node_to,
|
||||||
const std::function<bool(EdgeData)> filter) const = 0;
|
const std::function<bool(EdgeData)> filter) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -70,23 +73,24 @@ template <> class AlgorithmDataFacade<MLD>
|
|||||||
|
|
||||||
virtual unsigned GetNumberOfEdges() const = 0;
|
virtual unsigned GetNumberOfEdges() const = 0;
|
||||||
|
|
||||||
virtual unsigned GetOutDegree(const NodeID n) const = 0;
|
virtual unsigned GetOutDegree(const NodeID edge_based_node_id) const = 0;
|
||||||
|
|
||||||
virtual EdgeRange GetAdjacentEdgeRange(const NodeID node) const = 0;
|
virtual EdgeRange GetAdjacentEdgeRange(const NodeID edge_based_node_id) const = 0;
|
||||||
|
|
||||||
virtual EdgeWeight GetNodeWeight(const NodeID node) const = 0;
|
virtual EdgeWeight GetNodeWeight(const NodeID edge_based_node_id) const = 0;
|
||||||
|
|
||||||
virtual EdgeWeight GetNodeDuration(const NodeID node) const = 0; // TODO: to be removed
|
virtual EdgeWeight
|
||||||
|
GetNodeDuration(const NodeID edge_based_node_id) const = 0; // TODO: to be removed
|
||||||
|
|
||||||
virtual EdgeDistance GetNodeDistance(const NodeID node) const = 0;
|
virtual EdgeDistance GetNodeDistance(const NodeID edge_based_node_id) const = 0;
|
||||||
|
|
||||||
virtual bool IsForwardEdge(EdgeID edge) const = 0;
|
virtual bool IsForwardEdge(EdgeID edge_based_edge_id) const = 0;
|
||||||
|
|
||||||
virtual bool IsBackwardEdge(EdgeID edge) const = 0;
|
virtual bool IsBackwardEdge(EdgeID edge_based_edge_id) const = 0;
|
||||||
|
|
||||||
virtual NodeID GetTarget(const EdgeID e) const = 0;
|
virtual NodeID GetTarget(const EdgeID edge_based_edge_id) const = 0;
|
||||||
|
|
||||||
virtual const EdgeData &GetEdgeData(const EdgeID e) const = 0;
|
virtual const EdgeData &GetEdgeData(const EdgeID edge_based_edge_id) const = 0;
|
||||||
|
|
||||||
virtual const partitioner::MultiLevelPartitionView &GetMultiLevelPartition() const = 0;
|
virtual const partitioner::MultiLevelPartitionView &GetMultiLevelPartition() const = 0;
|
||||||
|
|
||||||
@ -94,10 +98,12 @@ template <> class AlgorithmDataFacade<MLD>
|
|||||||
|
|
||||||
virtual const customizer::CellMetricView &GetCellMetric() const = 0;
|
virtual const customizer::CellMetricView &GetCellMetric() const = 0;
|
||||||
|
|
||||||
virtual EdgeRange GetBorderEdgeRange(const LevelID level, const NodeID node) const = 0;
|
virtual EdgeRange GetBorderEdgeRange(const LevelID level,
|
||||||
|
const NodeID edge_based_node_id) const = 0;
|
||||||
|
|
||||||
// searches for a specific edge
|
// searches for a specific edge
|
||||||
virtual EdgeID FindEdge(const NodeID from, const NodeID to) const = 0;
|
virtual EdgeID FindEdge(const NodeID edge_based_node_from,
|
||||||
|
const NodeID edge_based_node_to) const = 0;
|
||||||
};
|
};
|
||||||
} // namespace datafacade
|
} // namespace datafacade
|
||||||
} // namespace engine
|
} // namespace engine
|
||||||
|
@ -73,45 +73,52 @@ class ContiguousInternalMemoryAlgorithmDataFacade<CH> : public datafacade::Algor
|
|||||||
|
|
||||||
unsigned GetNumberOfEdges() const override final { return m_query_graph.GetNumberOfEdges(); }
|
unsigned GetNumberOfEdges() const override final { return m_query_graph.GetNumberOfEdges(); }
|
||||||
|
|
||||||
unsigned GetOutDegree(const NodeID n) const override final
|
unsigned GetOutDegree(const NodeID edge_based_node_id) const override final
|
||||||
{
|
{
|
||||||
return m_query_graph.GetOutDegree(n);
|
return m_query_graph.GetOutDegree(edge_based_node_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeID GetTarget(const EdgeID e) const override final { return m_query_graph.GetTarget(e); }
|
NodeID GetTarget(const EdgeID edge_based_edge_id) const override final
|
||||||
|
|
||||||
const EdgeData &GetEdgeData(const EdgeID e) const override final
|
|
||||||
{
|
{
|
||||||
return m_query_graph.GetEdgeData(e);
|
return m_query_graph.GetTarget(edge_based_edge_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
EdgeRange GetAdjacentEdgeRange(const NodeID node) const override final
|
const EdgeData &GetEdgeData(const EdgeID edge_based_edge_id) const override final
|
||||||
{
|
{
|
||||||
return m_query_graph.GetAdjacentEdgeRange(node);
|
return m_query_graph.GetEdgeData(edge_based_edge_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
EdgeRange GetAdjacentEdgeRange(const NodeID edge_based_node_id) const override final
|
||||||
|
{
|
||||||
|
return m_query_graph.GetAdjacentEdgeRange(edge_based_node_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// searches for a specific edge
|
// searches for a specific edge
|
||||||
EdgeID FindEdge(const NodeID from, const NodeID to) const override final
|
EdgeID FindEdge(const NodeID edge_based_node_from,
|
||||||
|
const NodeID edge_based_node_to) const override final
|
||||||
{
|
{
|
||||||
return m_query_graph.FindEdge(from, to);
|
return m_query_graph.FindEdge(edge_based_node_from, edge_based_node_to);
|
||||||
}
|
}
|
||||||
|
|
||||||
EdgeID FindEdgeInEitherDirection(const NodeID from, const NodeID to) const override final
|
EdgeID FindEdgeInEitherDirection(const NodeID edge_based_node_from,
|
||||||
|
const NodeID edge_based_node_to) const override final
|
||||||
{
|
{
|
||||||
return m_query_graph.FindEdgeInEitherDirection(from, to);
|
return m_query_graph.FindEdgeInEitherDirection(edge_based_node_from, edge_based_node_to);
|
||||||
}
|
}
|
||||||
|
|
||||||
EdgeID
|
EdgeID FindEdgeIndicateIfReverse(const NodeID edge_based_node_from,
|
||||||
FindEdgeIndicateIfReverse(const NodeID from, const NodeID to, bool &result) const override final
|
const NodeID edge_based_node_to,
|
||||||
|
bool &result) const override final
|
||||||
{
|
{
|
||||||
return m_query_graph.FindEdgeIndicateIfReverse(from, to, result);
|
return m_query_graph.FindEdgeIndicateIfReverse(
|
||||||
|
edge_based_node_from, edge_based_node_to, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
EdgeID FindSmallestEdge(const NodeID from,
|
EdgeID FindSmallestEdge(const NodeID edge_based_node_from,
|
||||||
const NodeID to,
|
const NodeID edge_based_node_to,
|
||||||
std::function<bool(EdgeData)> filter) const override final
|
std::function<bool(EdgeData)> filter) const override final
|
||||||
{
|
{
|
||||||
return m_query_graph.FindSmallestEdge(from, to, filter);
|
return m_query_graph.FindSmallestEdge(edge_based_node_from, edge_based_node_to, filter);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -126,11 +133,9 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
using super = BaseDataFacade;
|
using super = BaseDataFacade;
|
||||||
using IndexBlock = util::RangeTable<16, storage::Ownership::View>::BlockT;
|
|
||||||
using RTreeLeaf = super::RTreeLeaf;
|
using RTreeLeaf = super::RTreeLeaf;
|
||||||
using SharedRTree = util::StaticRTree<RTreeLeaf, storage::Ownership::View>;
|
using SharedRTree = util::StaticRTree<RTreeLeaf, storage::Ownership::View>;
|
||||||
using SharedGeospatialQuery = GeospatialQuery<SharedRTree, BaseDataFacade>;
|
using SharedGeospatialQuery = GeospatialQuery<SharedRTree, BaseDataFacade>;
|
||||||
using RTreeNode = SharedRTree::TreeNode;
|
|
||||||
|
|
||||||
extractor::ClassData exclude_mask;
|
extractor::ClassData exclude_mask;
|
||||||
extractor::ProfileProperties *m_profile_properties;
|
extractor::ProfileProperties *m_profile_properties;
|
||||||
@ -231,76 +236,80 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
|||||||
}
|
}
|
||||||
|
|
||||||
// node and edge information access
|
// node and edge information access
|
||||||
util::Coordinate GetCoordinateOfNode(const NodeID id) const override final
|
util::Coordinate GetCoordinateOfNode(const NodeID node_based_node_id) const override final
|
||||||
{
|
{
|
||||||
return m_coordinate_list[id];
|
return m_coordinate_list[node_based_node_id];
|
||||||
}
|
}
|
||||||
|
|
||||||
OSMNodeID GetOSMNodeIDOfNode(const NodeID id) const override final
|
OSMNodeID GetOSMNodeIDOfNode(const NodeID node_based_node_id) const override final
|
||||||
{
|
{
|
||||||
return m_osmnodeid_list[id];
|
return m_osmnodeid_list[node_based_node_id];
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeForwardRange GetUncompressedForwardGeometry(const EdgeID id) const override final
|
NodeForwardRange GetUncompressedForwardGeometry(const PackedGeometryID id) const override final
|
||||||
{
|
{
|
||||||
return segment_data.GetForwardGeometry(id);
|
return segment_data.GetForwardGeometry(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeReverseRange GetUncompressedReverseGeometry(const EdgeID id) const override final
|
NodeReverseRange GetUncompressedReverseGeometry(const PackedGeometryID id) const override final
|
||||||
{
|
{
|
||||||
return segment_data.GetReverseGeometry(id);
|
return segment_data.GetReverseGeometry(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
DurationForwardRange GetUncompressedForwardDurations(const EdgeID id) const override final
|
DurationForwardRange
|
||||||
|
GetUncompressedForwardDurations(const PackedGeometryID id) const override final
|
||||||
{
|
{
|
||||||
return segment_data.GetForwardDurations(id);
|
return segment_data.GetForwardDurations(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
DurationReverseRange GetUncompressedReverseDurations(const EdgeID id) const override final
|
DurationReverseRange
|
||||||
|
GetUncompressedReverseDurations(const PackedGeometryID id) const override final
|
||||||
{
|
{
|
||||||
return segment_data.GetReverseDurations(id);
|
return segment_data.GetReverseDurations(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
WeightForwardRange GetUncompressedForwardWeights(const EdgeID id) const override final
|
WeightForwardRange GetUncompressedForwardWeights(const PackedGeometryID id) const override final
|
||||||
{
|
{
|
||||||
return segment_data.GetForwardWeights(id);
|
return segment_data.GetForwardWeights(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
WeightReverseRange GetUncompressedReverseWeights(const EdgeID id) const override final
|
WeightReverseRange GetUncompressedReverseWeights(const PackedGeometryID id) const override final
|
||||||
{
|
{
|
||||||
return segment_data.GetReverseWeights(id);
|
return segment_data.GetReverseWeights(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the data source ids that were used to supply the edge
|
// Returns the data source ids that were used to supply the edge
|
||||||
// weights.
|
// weights.
|
||||||
DatasourceForwardRange GetUncompressedForwardDatasources(const EdgeID id) const override final
|
DatasourceForwardRange
|
||||||
|
GetUncompressedForwardDatasources(const PackedGeometryID id) const override final
|
||||||
{
|
{
|
||||||
return segment_data.GetForwardDatasources(id);
|
return segment_data.GetForwardDatasources(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the data source ids that were used to supply the edge
|
// Returns the data source ids that were used to supply the edge
|
||||||
// weights.
|
// weights.
|
||||||
DatasourceReverseRange GetUncompressedReverseDatasources(const EdgeID id) const override final
|
DatasourceReverseRange
|
||||||
|
GetUncompressedReverseDatasources(const PackedGeometryID id) const override final
|
||||||
{
|
{
|
||||||
return segment_data.GetReverseDatasources(id);
|
return segment_data.GetReverseDatasources(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
TurnPenalty GetWeightPenaltyForEdgeID(const EdgeID id) const override final
|
TurnPenalty GetWeightPenaltyForEdgeID(const EdgeID edge_based_edge_id) const override final
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(m_turn_weight_penalties.size() > id);
|
BOOST_ASSERT(m_turn_weight_penalties.size() > edge_based_edge_id);
|
||||||
return m_turn_weight_penalties[id];
|
return m_turn_weight_penalties[edge_based_edge_id];
|
||||||
}
|
}
|
||||||
|
|
||||||
TurnPenalty GetDurationPenaltyForEdgeID(const EdgeID id) const override final
|
TurnPenalty GetDurationPenaltyForEdgeID(const EdgeID edge_based_edge_id) const override final
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(m_turn_duration_penalties.size() > id);
|
BOOST_ASSERT(m_turn_duration_penalties.size() > edge_based_edge_id);
|
||||||
return m_turn_duration_penalties[id];
|
return m_turn_duration_penalties[edge_based_edge_id];
|
||||||
}
|
}
|
||||||
|
|
||||||
osrm::guidance::TurnInstruction
|
osrm::guidance::TurnInstruction
|
||||||
GetTurnInstructionForEdgeID(const EdgeID id) const override final
|
GetTurnInstructionForEdgeID(const EdgeID edge_based_edge_id) const override final
|
||||||
{
|
{
|
||||||
return turn_data.GetTurnInstruction(id);
|
return turn_data.GetTurnInstruction(edge_based_edge_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<RTreeLeaf> GetEdgesInBox(const util::Coordinate south_west,
|
std::vector<RTreeLeaf> GetEdgesInBox(const util::Coordinate south_west,
|
||||||
@ -444,29 +453,29 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
|||||||
return std::string(m_data_timestamp.begin(), m_data_timestamp.end());
|
return std::string(m_data_timestamp.begin(), m_data_timestamp.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
GeometryID GetGeometryIndex(const NodeID id) const override final
|
GeometryID GetGeometryIndex(const NodeID edge_based_node_id) const override final
|
||||||
{
|
{
|
||||||
return edge_based_node_data.GetGeometryID(id);
|
return edge_based_node_data.GetGeometryID(edge_based_node_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
ComponentID GetComponentID(const NodeID id) const override final
|
ComponentID GetComponentID(const NodeID edge_based_node_id) const override final
|
||||||
{
|
{
|
||||||
return edge_based_node_data.GetComponentID(id);
|
return edge_based_node_data.GetComponentID(edge_based_node_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
extractor::TravelMode GetTravelMode(const NodeID id) const override final
|
extractor::TravelMode GetTravelMode(const NodeID edge_based_node_id) const override final
|
||||||
{
|
{
|
||||||
return edge_based_node_data.GetTravelMode(id);
|
return edge_based_node_data.GetTravelMode(edge_based_node_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
extractor::ClassData GetClassData(const NodeID id) const override final
|
extractor::ClassData GetClassData(const NodeID edge_based_node_id) const override final
|
||||||
{
|
{
|
||||||
return edge_based_node_data.GetClassData(id);
|
return edge_based_node_data.GetClassData(edge_based_node_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ExcludeNode(const NodeID id) const override final
|
bool ExcludeNode(const NodeID edge_based_node_id) const override final
|
||||||
{
|
{
|
||||||
return (edge_based_node_data.GetClassData(id) & exclude_mask) > 0;
|
return (edge_based_node_data.GetClassData(edge_based_node_id) & exclude_mask) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> GetClasses(const extractor::ClassData class_data) const override final
|
std::vector<std::string> GetClasses(const extractor::ClassData class_data) const override final
|
||||||
@ -480,9 +489,9 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
|||||||
return classes;
|
return classes;
|
||||||
}
|
}
|
||||||
|
|
||||||
NameID GetNameIndex(const NodeID id) const override final
|
NameID GetNameIndex(const NodeID edge_based_node_id) const override final
|
||||||
{
|
{
|
||||||
return edge_based_node_data.GetNameID(id);
|
return edge_based_node_data.GetNameID(edge_based_node_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
StringView GetNameForID(const NameID id) const override final
|
StringView GetNameForID(const NameID id) const override final
|
||||||
@ -537,32 +546,37 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
|||||||
return m_profile_properties->GetWeightMultiplier();
|
return m_profile_properties->GetWeightMultiplier();
|
||||||
}
|
}
|
||||||
|
|
||||||
util::guidance::BearingClass GetBearingClass(const NodeID node) const override final
|
util::guidance::BearingClass
|
||||||
|
GetBearingClass(const NodeID node_based_node_id) const override final
|
||||||
{
|
{
|
||||||
return intersection_bearings_view.GetBearingClass(node);
|
return intersection_bearings_view.GetBearingClass(node_based_node_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
guidance::TurnBearing PreTurnBearing(const EdgeID eid) const override final
|
guidance::TurnBearing PreTurnBearing(const EdgeID edge_based_edge_id) const override final
|
||||||
{
|
{
|
||||||
return turn_data.GetPreTurnBearing(eid);
|
return turn_data.GetPreTurnBearing(edge_based_edge_id);
|
||||||
}
|
}
|
||||||
guidance::TurnBearing PostTurnBearing(const EdgeID eid) const override final
|
guidance::TurnBearing PostTurnBearing(const EdgeID edge_based_edge_id) const override final
|
||||||
{
|
{
|
||||||
return turn_data.GetPostTurnBearing(eid);
|
return turn_data.GetPostTurnBearing(edge_based_edge_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
util::guidance::EntryClass GetEntryClass(const EdgeID turn_id) const override final
|
util::guidance::EntryClass GetEntryClass(const EdgeID edge_based_edge_id) const override final
|
||||||
{
|
{
|
||||||
auto entry_class_id = turn_data.GetEntryClassID(turn_id);
|
auto entry_class_id = turn_data.GetEntryClassID(edge_based_edge_id);
|
||||||
return m_entry_class_table.at(entry_class_id);
|
return m_entry_class_table.at(entry_class_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HasLaneData(const EdgeID id) const override final { return turn_data.HasLaneData(id); }
|
bool HasLaneData(const EdgeID edge_based_edge_id) const override final
|
||||||
|
|
||||||
util::guidance::LaneTupleIdPair GetLaneData(const EdgeID id) const override final
|
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(HasLaneData(id));
|
return turn_data.HasLaneData(edge_based_edge_id);
|
||||||
return m_lane_tupel_id_pairs.at(turn_data.GetLaneDataID(id));
|
}
|
||||||
|
|
||||||
|
util::guidance::LaneTupleIdPair
|
||||||
|
GetLaneData(const EdgeID edge_based_edge_id) const override final
|
||||||
|
{
|
||||||
|
BOOST_ASSERT(HasLaneData(edge_based_edge_id));
|
||||||
|
return m_lane_tupel_id_pairs.at(turn_data.GetLaneDataID(edge_based_edge_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
extractor::TurnLaneDescription
|
extractor::TurnLaneDescription
|
||||||
@ -577,15 +591,15 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
|||||||
m_lane_description_offsets[lane_description_id + 1]);
|
m_lane_description_offsets[lane_description_id + 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsLeftHandDriving(const NodeID id) const override final
|
bool IsLeftHandDriving(const NodeID edge_based_node_id) const override final
|
||||||
{
|
{
|
||||||
// TODO: can be moved to a data block indexed by GeometryID
|
// TODO: can be moved to a data block indexed by GeometryID
|
||||||
return edge_based_node_data.IsLeftHandDriving(id);
|
return edge_based_node_data.IsLeftHandDriving(edge_based_node_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsSegregated(const NodeID id) const override final
|
bool IsSegregated(const NodeID edge_based_node_id) const override final
|
||||||
{
|
{
|
||||||
return edge_based_node_data.IsSegregated(id);
|
return edge_based_node_data.IsSegregated(edge_based_node_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<extractor::ManeuverOverride>
|
std::vector<extractor::ManeuverOverride>
|
||||||
@ -691,57 +705,62 @@ template <> class ContiguousInternalMemoryAlgorithmDataFacade<MLD> : public Algo
|
|||||||
|
|
||||||
unsigned GetNumberOfEdges() const override final { return query_graph.GetNumberOfEdges(); }
|
unsigned GetNumberOfEdges() const override final { return query_graph.GetNumberOfEdges(); }
|
||||||
|
|
||||||
unsigned GetOutDegree(const NodeID n) const override final
|
unsigned GetOutDegree(const NodeID edge_based_node_id) const override final
|
||||||
{
|
{
|
||||||
return query_graph.GetOutDegree(n);
|
return query_graph.GetOutDegree(edge_based_node_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
EdgeRange GetAdjacentEdgeRange(const NodeID node) const override final
|
EdgeRange GetAdjacentEdgeRange(const NodeID edge_based_node_id) const override final
|
||||||
{
|
{
|
||||||
return query_graph.GetAdjacentEdgeRange(node);
|
return query_graph.GetAdjacentEdgeRange(edge_based_node_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
EdgeWeight GetNodeWeight(const NodeID node) const override final
|
EdgeWeight GetNodeWeight(const NodeID edge_based_node_id) const override final
|
||||||
{
|
{
|
||||||
return query_graph.GetNodeWeight(node);
|
return query_graph.GetNodeWeight(edge_based_node_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
EdgeDuration GetNodeDuration(const NodeID node) const override final
|
EdgeDuration GetNodeDuration(const NodeID edge_based_node_id) const override final
|
||||||
{
|
{
|
||||||
return query_graph.GetNodeDuration(node);
|
return query_graph.GetNodeDuration(edge_based_node_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
EdgeDistance GetNodeDistance(const NodeID node) const override final
|
EdgeDistance GetNodeDistance(const NodeID edge_based_node_id) const override final
|
||||||
{
|
{
|
||||||
return query_graph.GetNodeDistance(node);
|
return query_graph.GetNodeDistance(edge_based_node_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsForwardEdge(const NodeID node) const override final
|
bool IsForwardEdge(const NodeID edge_based_node_id) const override final
|
||||||
{
|
{
|
||||||
return query_graph.IsForwardEdge(node);
|
return query_graph.IsForwardEdge(edge_based_node_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsBackwardEdge(const NodeID node) const override final
|
bool IsBackwardEdge(const NodeID edge_based_node_id) const override final
|
||||||
{
|
{
|
||||||
return query_graph.IsBackwardEdge(node);
|
return query_graph.IsBackwardEdge(edge_based_node_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeID GetTarget(const EdgeID e) const override final { return query_graph.GetTarget(e); }
|
NodeID GetTarget(const EdgeID edge_based_edge_id) const override final
|
||||||
|
|
||||||
const EdgeData &GetEdgeData(const EdgeID e) const override final
|
|
||||||
{
|
{
|
||||||
return query_graph.GetEdgeData(e);
|
return query_graph.GetTarget(edge_based_edge_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
EdgeRange GetBorderEdgeRange(const LevelID level, const NodeID node) const override final
|
const EdgeData &GetEdgeData(const EdgeID edge_based_edge_id) const override final
|
||||||
{
|
{
|
||||||
return query_graph.GetBorderEdgeRange(level, node);
|
return query_graph.GetEdgeData(edge_based_edge_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
EdgeRange GetBorderEdgeRange(const LevelID level,
|
||||||
|
const NodeID edge_based_node_id) const override final
|
||||||
|
{
|
||||||
|
return query_graph.GetBorderEdgeRange(level, edge_based_node_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// searches for a specific edge
|
// searches for a specific edge
|
||||||
EdgeID FindEdge(const NodeID from, const NodeID to) const override final
|
EdgeID FindEdge(const NodeID edge_based_node_from,
|
||||||
|
const NodeID edge_based_node_to) const override final
|
||||||
{
|
{
|
||||||
return query_graph.FindEdge(from, to);
|
return query_graph.FindEdge(edge_based_node_from, edge_based_node_to);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -77,46 +77,51 @@ class BaseDataFacade
|
|||||||
virtual std::string GetTimestamp() const = 0;
|
virtual std::string GetTimestamp() const = 0;
|
||||||
|
|
||||||
// node and edge information access
|
// node and edge information access
|
||||||
virtual util::Coordinate GetCoordinateOfNode(const NodeID id) const = 0;
|
virtual util::Coordinate GetCoordinateOfNode(const NodeID node_based_node_id) const = 0;
|
||||||
|
|
||||||
virtual OSMNodeID GetOSMNodeIDOfNode(const NodeID id) const = 0;
|
virtual OSMNodeID GetOSMNodeIDOfNode(const NodeID node_based_node_id) const = 0;
|
||||||
|
|
||||||
virtual GeometryID GetGeometryIndex(const NodeID id) const = 0;
|
virtual GeometryID GetGeometryIndex(const NodeID edge_based_node_id) const = 0;
|
||||||
|
|
||||||
virtual ComponentID GetComponentID(const NodeID id) const = 0;
|
virtual ComponentID GetComponentID(const NodeID edge_based_node_id) const = 0;
|
||||||
|
|
||||||
virtual NodeForwardRange GetUncompressedForwardGeometry(const EdgeID id) const = 0;
|
virtual NodeForwardRange GetUncompressedForwardGeometry(const PackedGeometryID id) const = 0;
|
||||||
virtual NodeReverseRange GetUncompressedReverseGeometry(const EdgeID id) const = 0;
|
virtual NodeReverseRange GetUncompressedReverseGeometry(const PackedGeometryID id) const = 0;
|
||||||
|
|
||||||
virtual TurnPenalty GetWeightPenaltyForEdgeID(const EdgeID id) const = 0;
|
virtual TurnPenalty GetWeightPenaltyForEdgeID(const EdgeID edge_based_edge_id) const = 0;
|
||||||
|
|
||||||
virtual TurnPenalty GetDurationPenaltyForEdgeID(const EdgeID id) const = 0;
|
virtual TurnPenalty GetDurationPenaltyForEdgeID(const EdgeID edge_based_edge_id) const = 0;
|
||||||
|
|
||||||
// Gets the weight values for each segment in an uncompressed geometry.
|
// Gets the weight values for each segment in an uncompressed geometry.
|
||||||
// Should always be 1 shorter than GetUncompressedGeometry
|
// Should always be 1 shorter than GetUncompressedGeometry
|
||||||
virtual WeightForwardRange GetUncompressedForwardWeights(const EdgeID id) const = 0;
|
virtual WeightForwardRange GetUncompressedForwardWeights(const PackedGeometryID id) const = 0;
|
||||||
virtual WeightReverseRange GetUncompressedReverseWeights(const EdgeID id) const = 0;
|
virtual WeightReverseRange GetUncompressedReverseWeights(const PackedGeometryID id) const = 0;
|
||||||
|
|
||||||
// Gets the duration values for each segment in an uncompressed geometry.
|
// Gets the duration values for each segment in an uncompressed geometry.
|
||||||
// Should always be 1 shorter than GetUncompressedGeometry
|
// Should always be 1 shorter than GetUncompressedGeometry
|
||||||
virtual DurationForwardRange GetUncompressedForwardDurations(const EdgeID id) const = 0;
|
virtual DurationForwardRange
|
||||||
virtual DurationReverseRange GetUncompressedReverseDurations(const EdgeID id) const = 0;
|
GetUncompressedForwardDurations(const PackedGeometryID id) const = 0;
|
||||||
|
virtual DurationReverseRange
|
||||||
|
GetUncompressedReverseDurations(const PackedGeometryID id) const = 0;
|
||||||
|
|
||||||
// Returns the data source ids that were used to supply the edge
|
// Returns the data source ids that were used to supply the edge
|
||||||
// weights. Will return an empty array when only the base profile is used.
|
// weights. Will return an empty array when only the base profile is used.
|
||||||
virtual DatasourceForwardRange GetUncompressedForwardDatasources(const EdgeID id) const = 0;
|
virtual DatasourceForwardRange
|
||||||
virtual DatasourceReverseRange GetUncompressedReverseDatasources(const EdgeID id) const = 0;
|
GetUncompressedForwardDatasources(const PackedGeometryID id) const = 0;
|
||||||
|
virtual DatasourceReverseRange
|
||||||
|
GetUncompressedReverseDatasources(const PackedGeometryID id) const = 0;
|
||||||
|
|
||||||
// Gets the name of a datasource
|
// Gets the name of a datasource
|
||||||
virtual StringView GetDatasourceName(const DatasourceID id) const = 0;
|
virtual StringView GetDatasourceName(const DatasourceID id) const = 0;
|
||||||
|
|
||||||
virtual osrm::guidance::TurnInstruction GetTurnInstructionForEdgeID(const EdgeID id) const = 0;
|
virtual osrm::guidance::TurnInstruction
|
||||||
|
GetTurnInstructionForEdgeID(const EdgeID edge_based_edge_id) const = 0;
|
||||||
|
|
||||||
virtual extractor::TravelMode GetTravelMode(const NodeID id) const = 0;
|
virtual extractor::TravelMode GetTravelMode(const NodeID edge_based_node_id) const = 0;
|
||||||
|
|
||||||
virtual extractor::ClassData GetClassData(const NodeID id) const = 0;
|
virtual extractor::ClassData GetClassData(const NodeID edge_based_node_id) const = 0;
|
||||||
|
|
||||||
virtual bool ExcludeNode(const NodeID id) const = 0;
|
virtual bool ExcludeNode(const NodeID edge_based_node_id) const = 0;
|
||||||
|
|
||||||
virtual std::vector<std::string> GetClasses(const extractor::ClassData class_data) const = 0;
|
virtual std::vector<std::string> GetClasses(const extractor::ClassData class_data) const = 0;
|
||||||
|
|
||||||
@ -182,12 +187,12 @@ class BaseDataFacade
|
|||||||
const Approach approach,
|
const Approach approach,
|
||||||
const bool use_all_edges = false) const = 0;
|
const bool use_all_edges = false) const = 0;
|
||||||
|
|
||||||
virtual bool HasLaneData(const EdgeID id) const = 0;
|
virtual bool HasLaneData(const EdgeID edge_based_edge_id) const = 0;
|
||||||
virtual util::guidance::LaneTupleIdPair GetLaneData(const EdgeID id) const = 0;
|
virtual util::guidance::LaneTupleIdPair GetLaneData(const EdgeID edge_based_edge_id) const = 0;
|
||||||
virtual extractor::TurnLaneDescription
|
virtual extractor::TurnLaneDescription
|
||||||
GetTurnDescription(const LaneDescriptionID lane_description_id) const = 0;
|
GetTurnDescription(const LaneDescriptionID lane_description_id) const = 0;
|
||||||
|
|
||||||
virtual NameID GetNameIndex(const NodeID id) const = 0;
|
virtual NameID GetNameIndex(const NodeID edge_based_node_id) const = 0;
|
||||||
|
|
||||||
virtual StringView GetNameForID(const NameID id) const = 0;
|
virtual StringView GetNameForID(const NameID id) const = 0;
|
||||||
|
|
||||||
@ -209,16 +214,16 @@ class BaseDataFacade
|
|||||||
|
|
||||||
virtual double GetWeightMultiplier() const = 0;
|
virtual double GetWeightMultiplier() const = 0;
|
||||||
|
|
||||||
virtual osrm::guidance::TurnBearing PreTurnBearing(const EdgeID eid) const = 0;
|
virtual osrm::guidance::TurnBearing PreTurnBearing(const EdgeID edge_based_edge_id) const = 0;
|
||||||
virtual osrm::guidance::TurnBearing PostTurnBearing(const EdgeID eid) const = 0;
|
virtual osrm::guidance::TurnBearing PostTurnBearing(const EdgeID edge_based_edge_id) const = 0;
|
||||||
|
|
||||||
virtual util::guidance::BearingClass GetBearingClass(const NodeID node) const = 0;
|
virtual util::guidance::BearingClass GetBearingClass(const NodeID node_based_node_id) const = 0;
|
||||||
|
|
||||||
virtual util::guidance::EntryClass GetEntryClass(const EdgeID turn_id) const = 0;
|
virtual util::guidance::EntryClass GetEntryClass(const EdgeID edge_based_edge_id) const = 0;
|
||||||
|
|
||||||
virtual bool IsLeftHandDriving(const NodeID id) const = 0;
|
virtual bool IsLeftHandDriving(const NodeID edge_based_node_id) const = 0;
|
||||||
|
|
||||||
virtual bool IsSegregated(const NodeID) const = 0;
|
virtual bool IsSegregated(const NodeID edge_based_node_id) const = 0;
|
||||||
|
|
||||||
virtual std::vector<extractor::ManeuverOverride>
|
virtual std::vector<extractor::ManeuverOverride>
|
||||||
GetOverridesThatStartAt(const NodeID edge_based_node_id) const = 0;
|
GetOverridesThatStartAt(const NodeID edge_based_node_id) const = 0;
|
||||||
|
@ -76,13 +76,13 @@ using NodeID = std::uint32_t;
|
|||||||
using EdgeID = std::uint32_t;
|
using EdgeID = std::uint32_t;
|
||||||
using NameID = std::uint32_t;
|
using NameID = std::uint32_t;
|
||||||
using AnnotationID = std::uint32_t;
|
using AnnotationID = std::uint32_t;
|
||||||
|
using PackedGeometryID = std::uint32_t;
|
||||||
using EdgeWeight = std::int32_t;
|
using EdgeWeight = std::int32_t;
|
||||||
using EdgeDuration = std::int32_t;
|
using EdgeDuration = std::int32_t;
|
||||||
using EdgeDistance = float;
|
using EdgeDistance = float;
|
||||||
using SegmentWeight = std::uint32_t;
|
using SegmentWeight = std::uint32_t;
|
||||||
using SegmentDuration = std::uint32_t;
|
using SegmentDuration = std::uint32_t;
|
||||||
using TurnPenalty = std::int16_t; // turn penalty in 100ms units
|
using TurnPenalty = std::int16_t; // turn penalty in 100ms units
|
||||||
using DataTimestamp = std::string;
|
|
||||||
|
|
||||||
static const std::size_t INVALID_INDEX = std::numeric_limits<std::size_t>::max();
|
static const std::size_t INVALID_INDEX = std::numeric_limits<std::size_t>::max();
|
||||||
|
|
||||||
@ -95,16 +95,13 @@ static const LaneDescriptionID INVALID_LANE_DESCRIPTIONID =
|
|||||||
std::numeric_limits<LaneDescriptionID>::max();
|
std::numeric_limits<LaneDescriptionID>::max();
|
||||||
|
|
||||||
using BearingClassID = std::uint32_t;
|
using BearingClassID = std::uint32_t;
|
||||||
static const BearingClassID INVALID_BEARING_CLASSID = std::numeric_limits<BearingClassID>::max();
|
|
||||||
|
|
||||||
using DiscreteBearing = std::uint16_t;
|
using DiscreteBearing = std::uint16_t;
|
||||||
|
|
||||||
using EntryClassID = std::uint16_t;
|
using EntryClassID = std::uint16_t;
|
||||||
static const EntryClassID INVALID_ENTRY_CLASSID = std::numeric_limits<EntryClassID>::max();
|
|
||||||
|
|
||||||
static const NodeID SPECIAL_NODEID = std::numeric_limits<NodeID>::max();
|
static const NodeID SPECIAL_NODEID = std::numeric_limits<NodeID>::max();
|
||||||
static const NodeID SPECIAL_SEGMENTID = std::numeric_limits<NodeID>::max() >> 1;
|
static const NodeID SPECIAL_SEGMENTID = std::numeric_limits<NodeID>::max() >> 1;
|
||||||
static const NodeID SPECIAL_GEOMETRYID = std::numeric_limits<NodeID>::max() >> 1;
|
static const PackedGeometryID SPECIAL_GEOMETRYID =
|
||||||
|
std::numeric_limits<PackedGeometryID>::max() >> 1;
|
||||||
static const EdgeID SPECIAL_EDGEID = std::numeric_limits<EdgeID>::max();
|
static const EdgeID SPECIAL_EDGEID = std::numeric_limits<EdgeID>::max();
|
||||||
static const RestrictionID SPECIAL_RESTRICTIONID = std::numeric_limits<RestrictionID>::max();
|
static const RestrictionID SPECIAL_RESTRICTIONID = std::numeric_limits<RestrictionID>::max();
|
||||||
static const NameID INVALID_NAMEID = std::numeric_limits<NameID>::max();
|
static const NameID INVALID_NAMEID = std::numeric_limits<NameID>::max();
|
||||||
@ -123,13 +120,6 @@ static const TurnPenalty INVALID_TURN_PENALTY = std::numeric_limits<TurnPenalty>
|
|||||||
static const EdgeDistance INVALID_EDGE_DISTANCE = std::numeric_limits<EdgeDistance>::max();
|
static const EdgeDistance INVALID_EDGE_DISTANCE = std::numeric_limits<EdgeDistance>::max();
|
||||||
static const EdgeDistance INVALID_FALLBACK_SPEED = std::numeric_limits<double>::max();
|
static const EdgeDistance INVALID_FALLBACK_SPEED = std::numeric_limits<double>::max();
|
||||||
|
|
||||||
// FIXME the bitfields we use require a reduced maximal duration, this should be kept consistent
|
|
||||||
// within the code base. For now we have to ensure that we don't case 30 bit to -1 and break any
|
|
||||||
// min() / operator< checks due to the invalid truncation. In addition, using signed and unsigned
|
|
||||||
// weights produces problems. As a result we can only store 1 << 29 since the MSB is still reserved
|
|
||||||
// for the sign bit. See https://github.com/Project-OSRM/osrm-backend/issues/3677
|
|
||||||
static const EdgeWeight MAXIMAL_EDGE_DURATION_INT_30 = (1 << 29) - 1;
|
|
||||||
|
|
||||||
using DatasourceID = std::uint8_t;
|
using DatasourceID = std::uint8_t;
|
||||||
|
|
||||||
using BisectionID = std::uint32_t;
|
using BisectionID = std::uint32_t;
|
||||||
@ -158,11 +148,11 @@ struct SegmentID
|
|||||||
*/
|
*/
|
||||||
struct GeometryID
|
struct GeometryID
|
||||||
{
|
{
|
||||||
GeometryID(const NodeID id_, const bool forward_) : id{id_}, forward{forward_} {}
|
GeometryID(const PackedGeometryID id_, const bool forward_) : id{id_}, forward{forward_} {}
|
||||||
|
|
||||||
GeometryID() : id(std::numeric_limits<unsigned>::max() >> 1), forward(false) {}
|
GeometryID() : id(std::numeric_limits<unsigned>::max() >> 1), forward(false) {}
|
||||||
|
|
||||||
NodeID id : 31;
|
PackedGeometryID id : 31;
|
||||||
std::uint32_t forward : 1;
|
std::uint32_t forward : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user