2015-01-27 06:35:29 -05:00
|
|
|
#ifndef DATAFACADE_BASE_HPP
|
|
|
|
#define DATAFACADE_BASE_HPP
|
|
|
|
|
|
|
|
// Exposes all data access interfaces to the algorithms via base class ptr
|
|
|
|
|
2017-06-27 18:01:05 -04:00
|
|
|
#include "engine/approach.hpp"
|
|
|
|
#include "engine/phantom_node.hpp"
|
|
|
|
|
2016-01-28 10:28:44 -05:00
|
|
|
#include "contractor/query_edge.hpp"
|
2017-06-27 18:01:05 -04:00
|
|
|
|
|
|
|
#include "extractor/class_data.hpp"
|
2017-05-16 13:22:41 -04:00
|
|
|
#include "extractor/edge_based_node_segment.hpp"
|
2018-02-09 13:32:09 -05:00
|
|
|
#include "extractor/maneuver_override.hpp"
|
2017-07-06 20:16:40 -04:00
|
|
|
#include "extractor/query_node.hpp"
|
2018-04-06 09:09:52 -04:00
|
|
|
#include "extractor/segment_data_container.hpp"
|
2017-06-27 18:01:05 -04:00
|
|
|
#include "extractor/travel_mode.hpp"
|
2018-01-05 08:33:53 -05:00
|
|
|
#include "extractor/turn_lane_types.hpp"
|
2018-01-08 13:12:06 -05:00
|
|
|
|
|
|
|
#include "guidance/turn_bearing.hpp"
|
2018-01-05 07:05:53 -05:00
|
|
|
#include "guidance/turn_instruction.hpp"
|
2017-06-27 18:01:05 -04:00
|
|
|
|
2016-01-28 08:27:05 -05:00
|
|
|
#include "util/exception.hpp"
|
2016-04-26 07:27:40 -04:00
|
|
|
#include "util/guidance/bearing_class.hpp"
|
|
|
|
#include "util/guidance/entry_class.hpp"
|
2016-08-17 03:49:19 -04:00
|
|
|
#include "util/guidance/turn_lanes.hpp"
|
2016-04-26 07:27:40 -04:00
|
|
|
#include "util/integer_range.hpp"
|
2018-04-06 09:09:52 -04:00
|
|
|
#include "util/packed_vector.hpp"
|
2016-01-02 11:13:44 -05:00
|
|
|
#include "util/string_util.hpp"
|
|
|
|
#include "util/typedefs.hpp"
|
|
|
|
|
|
|
|
#include "osrm/coordinate.hpp"
|
2015-01-27 06:35:29 -05:00
|
|
|
|
2018-04-06 09:09:52 -04:00
|
|
|
#include <boost/range/adaptor/reversed.hpp>
|
2018-03-19 14:41:02 -04:00
|
|
|
#include <boost/range/any_range.hpp>
|
2016-02-05 08:58:06 -05:00
|
|
|
#include <cstddef>
|
|
|
|
|
2022-08-27 06:36:20 -04:00
|
|
|
#include <engine/bearing.hpp>
|
2024-07-02 16:37:09 -04:00
|
|
|
#include <optional>
|
2015-01-27 06:35:29 -05:00
|
|
|
#include <string>
|
2022-10-30 15:01:46 -04:00
|
|
|
#include <string_view>
|
2016-04-26 07:27:40 -04:00
|
|
|
#include <utility>
|
|
|
|
#include <vector>
|
2015-01-27 06:35:29 -05:00
|
|
|
|
2022-12-11 04:10:26 -05:00
|
|
|
namespace osrm::engine::datafacade
|
2016-01-05 10:51:13 -05:00
|
|
|
{
|
|
|
|
|
2016-01-28 10:28:44 -05:00
|
|
|
class BaseDataFacade
|
2015-01-27 06:35:29 -05:00
|
|
|
{
|
|
|
|
public:
|
2017-05-16 13:22:41 -04:00
|
|
|
using RTreeLeaf = extractor::EdgeBasedNodeSegment;
|
2018-03-19 14:41:02 -04:00
|
|
|
|
2018-04-06 09:09:52 -04:00
|
|
|
using NodeForwardRange =
|
|
|
|
boost::iterator_range<extractor::SegmentDataView::SegmentNodeVector::const_iterator>;
|
|
|
|
using NodeReverseRange = boost::reversed_range<const NodeForwardRange>;
|
|
|
|
|
|
|
|
using WeightForwardRange =
|
|
|
|
boost::iterator_range<extractor::SegmentDataView::SegmentWeightVector::const_iterator>;
|
|
|
|
using WeightReverseRange = boost::reversed_range<const WeightForwardRange>;
|
|
|
|
|
|
|
|
using DurationForwardRange =
|
|
|
|
boost::iterator_range<extractor::SegmentDataView::SegmentDurationVector::const_iterator>;
|
|
|
|
using DurationReverseRange = boost::reversed_range<const DurationForwardRange>;
|
|
|
|
|
|
|
|
using DatasourceForwardRange =
|
|
|
|
boost::iterator_range<extractor::SegmentDataView::SegmentDatasourceVector::const_iterator>;
|
|
|
|
using DatasourceReverseRange = boost::reversed_range<const DatasourceForwardRange>;
|
2018-03-19 14:41:02 -04:00
|
|
|
|
2015-01-27 06:35:29 -05:00
|
|
|
BaseDataFacade() {}
|
|
|
|
virtual ~BaseDataFacade() {}
|
|
|
|
|
2018-03-28 19:18:09 -04:00
|
|
|
virtual std::uint32_t GetCheckSum() const = 0;
|
2016-08-23 02:26:48 -04:00
|
|
|
|
2019-01-15 05:18:20 -05:00
|
|
|
virtual std::string GetTimestamp() const = 0;
|
|
|
|
|
2015-01-27 06:35:29 -05:00
|
|
|
// node and edge information access
|
2021-06-01 15:48:12 -04:00
|
|
|
virtual util::Coordinate GetCoordinateOfNode(const NodeID node_based_node_id) const = 0;
|
2017-01-09 15:40:33 -05:00
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
virtual OSMNodeID GetOSMNodeIDOfNode(const NodeID node_based_node_id) const = 0;
|
2015-01-27 06:35:29 -05:00
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
virtual GeometryID GetGeometryIndex(const NodeID edge_based_node_id) const = 0;
|
2015-01-27 06:35:29 -05:00
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
virtual ComponentID GetComponentID(const NodeID edge_based_node_id) const = 0;
|
2017-05-15 06:15:00 -04:00
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
virtual NodeForwardRange GetUncompressedForwardGeometry(const PackedGeometryID id) const = 0;
|
|
|
|
virtual NodeReverseRange GetUncompressedReverseGeometry(const PackedGeometryID id) const = 0;
|
2016-01-29 20:52:20 -05:00
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
virtual TurnPenalty GetWeightPenaltyForEdgeID(const EdgeID edge_based_edge_id) const = 0;
|
2016-05-12 12:50:10 -04:00
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
virtual TurnPenalty GetDurationPenaltyForEdgeID(const EdgeID edge_based_edge_id) const = 0;
|
2016-05-12 12:50:10 -04:00
|
|
|
|
2016-01-29 20:52:20 -05:00
|
|
|
// Gets the weight values for each segment in an uncompressed geometry.
|
|
|
|
// Should always be 1 shorter than GetUncompressedGeometry
|
2021-06-01 15:48:12 -04:00
|
|
|
virtual WeightForwardRange GetUncompressedForwardWeights(const PackedGeometryID id) const = 0;
|
|
|
|
virtual WeightReverseRange GetUncompressedReverseWeights(const PackedGeometryID id) const = 0;
|
2015-01-27 06:35:29 -05:00
|
|
|
|
2016-05-12 12:50:10 -04:00
|
|
|
// Gets the duration values for each segment in an uncompressed geometry.
|
|
|
|
// Should always be 1 shorter than GetUncompressedGeometry
|
2021-06-01 15:48:12 -04:00
|
|
|
virtual DurationForwardRange
|
|
|
|
GetUncompressedForwardDurations(const PackedGeometryID id) const = 0;
|
|
|
|
virtual DurationReverseRange
|
|
|
|
GetUncompressedReverseDurations(const PackedGeometryID id) const = 0;
|
2016-05-12 12:50:10 -04:00
|
|
|
|
2016-03-15 02:03:19 -04:00
|
|
|
// 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.
|
2021-06-01 15:48:12 -04:00
|
|
|
virtual DatasourceForwardRange
|
|
|
|
GetUncompressedForwardDatasources(const PackedGeometryID id) const = 0;
|
|
|
|
virtual DatasourceReverseRange
|
|
|
|
GetUncompressedReverseDatasources(const PackedGeometryID id) const = 0;
|
2016-03-15 02:03:19 -04:00
|
|
|
|
|
|
|
// Gets the name of a datasource
|
2022-10-30 14:52:57 -04:00
|
|
|
virtual std::string_view GetDatasourceName(const DatasourceID id) const = 0;
|
2016-03-15 02:03:19 -04:00
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
virtual osrm::guidance::TurnInstruction
|
|
|
|
GetTurnInstructionForEdgeID(const EdgeID edge_based_edge_id) const = 0;
|
2015-01-27 06:35:29 -05:00
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
virtual extractor::TravelMode GetTravelMode(const NodeID edge_based_node_id) const = 0;
|
2015-01-27 06:35:29 -05:00
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
virtual extractor::ClassData GetClassData(const NodeID edge_based_node_id) const = 0;
|
2017-06-27 18:01:05 -04:00
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
virtual bool ExcludeNode(const NodeID edge_based_node_id) const = 0;
|
2017-07-21 17:55:19 -04:00
|
|
|
|
2017-06-27 18:01:05 -04:00
|
|
|
virtual std::vector<std::string> GetClasses(const extractor::ClassData class_data) const = 0;
|
|
|
|
|
2016-02-23 15:23:13 -05:00
|
|
|
virtual std::vector<RTreeLeaf> GetEdgesInBox(const util::Coordinate south_west,
|
2016-05-06 20:56:08 -04:00
|
|
|
const util::Coordinate north_east) const = 0;
|
2016-02-16 13:51:04 -05:00
|
|
|
|
2015-12-09 16:34:22 -05:00
|
|
|
virtual std::vector<PhantomNodeWithDistance>
|
2016-02-23 15:23:13 -05:00
|
|
|
NearestPhantomNodesInRange(const util::Coordinate input_coordinate,
|
2022-08-27 06:36:20 -04:00
|
|
|
const double max_distance,
|
2024-07-02 16:37:09 -04:00
|
|
|
const std::optional<Bearing> bearing,
|
2018-12-13 19:10:32 -05:00
|
|
|
const Approach approach,
|
|
|
|
const bool use_all_edges) const = 0;
|
2015-12-03 14:04:23 -05:00
|
|
|
|
2015-12-09 16:34:22 -05:00
|
|
|
virtual std::vector<PhantomNodeWithDistance>
|
2016-02-23 15:23:13 -05:00
|
|
|
NearestPhantomNodes(const util::Coordinate input_coordinate,
|
2022-08-27 06:36:20 -04:00
|
|
|
const size_t max_results,
|
2024-07-02 16:37:09 -04:00
|
|
|
const std::optional<double> max_distance,
|
|
|
|
const std::optional<Bearing> bearing,
|
2017-05-29 10:13:15 -04:00
|
|
|
const Approach approach) const = 0;
|
2016-02-23 15:23:13 -05:00
|
|
|
|
2022-08-27 06:36:20 -04:00
|
|
|
virtual PhantomCandidateAlternatives
|
|
|
|
NearestCandidatesWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
|
2024-07-02 16:37:09 -04:00
|
|
|
const std::optional<double> max_distance,
|
|
|
|
const std::optional<Bearing> bearing,
|
2022-08-27 06:36:20 -04:00
|
|
|
const Approach approach,
|
|
|
|
const bool use_all_edges) const = 0;
|
2014-09-23 12:46:14 -04:00
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
virtual bool HasLaneData(const EdgeID edge_based_edge_id) const = 0;
|
|
|
|
virtual util::guidance::LaneTupleIdPair GetLaneData(const EdgeID edge_based_edge_id) const = 0;
|
2018-01-05 08:33:53 -05:00
|
|
|
virtual extractor::TurnLaneDescription
|
2016-06-21 04:41:08 -04:00
|
|
|
GetTurnDescription(const LaneDescriptionID lane_description_id) const = 0;
|
2016-06-15 08:38:24 -04:00
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
virtual NameID GetNameIndex(const NodeID edge_based_node_id) const = 0;
|
2015-01-27 06:35:29 -05:00
|
|
|
|
2022-10-30 14:52:57 -04:00
|
|
|
virtual std::string_view GetNameForID(const NameID id) const = 0;
|
2015-01-27 06:35:29 -05:00
|
|
|
|
2022-10-30 14:52:57 -04:00
|
|
|
virtual std::string_view GetRefForID(const NameID id) const = 0;
|
2016-09-05 09:01:51 -04:00
|
|
|
|
2022-10-30 14:52:57 -04:00
|
|
|
virtual std::string_view GetPronunciationForID(const NameID id) const = 0;
|
2016-05-25 21:35:38 -04:00
|
|
|
|
2022-10-30 14:52:57 -04:00
|
|
|
virtual std::string_view GetDestinationsForID(const NameID id) const = 0;
|
2016-05-26 18:47:46 -04:00
|
|
|
|
2022-10-30 14:52:57 -04:00
|
|
|
virtual std::string_view GetExitsForID(const NameID id) const = 0;
|
2017-06-29 16:12:25 -04:00
|
|
|
|
2016-04-12 12:47:00 -04:00
|
|
|
virtual bool GetContinueStraightDefault() const = 0;
|
2016-04-26 07:27:40 -04:00
|
|
|
|
2016-11-01 17:13:10 -04:00
|
|
|
virtual double GetMapMatchingMaxSpeed() const = 0;
|
|
|
|
|
2016-05-12 12:50:10 -04:00
|
|
|
virtual const char *GetWeightName() const = 0;
|
|
|
|
|
|
|
|
virtual unsigned GetWeightPrecision() const = 0;
|
|
|
|
|
2017-01-17 03:24:52 -05:00
|
|
|
virtual double GetWeightMultiplier() const = 0;
|
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
virtual osrm::guidance::TurnBearing PreTurnBearing(const EdgeID edge_based_edge_id) const = 0;
|
|
|
|
virtual osrm::guidance::TurnBearing PostTurnBearing(const EdgeID edge_based_edge_id) const = 0;
|
2016-08-17 03:49:19 -04:00
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
virtual util::guidance::BearingClass GetBearingClass(const NodeID node_based_node_id) const = 0;
|
2016-04-26 07:27:40 -04:00
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
virtual util::guidance::EntryClass GetEntryClass(const EdgeID edge_based_edge_id) const = 0;
|
2017-05-22 10:09:53 -04:00
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
virtual bool IsLeftHandDriving(const NodeID edge_based_node_id) const = 0;
|
2017-10-13 09:20:46 -04:00
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
virtual bool IsSegregated(const NodeID edge_based_node_id) const = 0;
|
2018-02-09 13:32:09 -05:00
|
|
|
|
|
|
|
virtual std::vector<extractor::ManeuverOverride>
|
|
|
|
GetOverridesThatStartAt(const NodeID edge_based_node_id) const = 0;
|
2015-01-27 06:35:29 -05:00
|
|
|
};
|
2022-12-20 12:00:11 -05:00
|
|
|
} // namespace osrm::engine::datafacade
|
2016-01-05 10:51:13 -05:00
|
|
|
|
2015-01-27 06:35:29 -05:00
|
|
|
#endif // DATAFACADE_BASE_HPP
|