osrm-backend/include/extractor/guidance/turn_analysis.hpp

103 lines
3.7 KiB
C++
Raw Normal View History

#ifndef OSRM_EXTRACTOR_TURN_ANALYSIS
#define OSRM_EXTRACTOR_TURN_ANALYSIS
2016-03-23 08:04:23 -04:00
#include "extractor/compressed_edge_container.hpp"
2017-06-13 09:17:13 -04:00
#include "extractor/guidance/driveway_handler.hpp"
#include "extractor/guidance/intersection.hpp"
#include "extractor/guidance/intersection_generator.hpp"
#include "extractor/guidance/intersection_normalization_operation.hpp"
#include "extractor/guidance/intersection_normalizer.hpp"
2016-04-11 06:51:06 -04:00
#include "extractor/guidance/motorway_handler.hpp"
#include "extractor/guidance/roundabout_handler.hpp"
2016-07-04 06:19:49 -04:00
#include "extractor/guidance/sliproad_handler.hpp"
2016-12-07 14:26:34 -05:00
#include "extractor/guidance/suppress_mode_handler.hpp"
2016-03-23 08:04:23 -04:00
#include "extractor/guidance/turn_classification.hpp"
#include "extractor/guidance/turn_handler.hpp"
#include "extractor/query_node.hpp"
#include "extractor/restriction_index.hpp"
2016-04-22 05:31:46 -04:00
#include "extractor/suffix_table.hpp"
#include "util/attributes.hpp"
#include "util/name_table.hpp"
#include "util/node_based_graph.hpp"
#include <cstdint>
#include <memory>
2016-03-23 08:04:23 -04:00
#include <string>
#include <tuple>
#include <unordered_set>
2016-03-23 08:04:23 -04:00
#include <utility>
#include <vector>
namespace osrm
{
namespace extractor
{
2016-03-01 16:30:31 -05:00
namespace guidance
{
2016-03-08 06:40:45 -05:00
class TurnAnalysis
{
2016-03-08 06:40:45 -05:00
public:
TurnAnalysis(const util::NodeBasedDynamicGraph &node_based_graph,
const EdgeBasedNodeDataContainer &node_data_container,
const std::vector<util::Coordinate> &coordinates,
2016-03-08 06:40:45 -05:00
const RestrictionMap &restriction_map,
const std::unordered_set<NodeID> &barrier_nodes,
const CompressedEdgeContainer &compressed_edge_container,
2016-04-22 05:31:46 -04:00
const util::NameTable &name_table,
const SuffixTable &street_name_suffix_table);
2016-03-08 06:40:45 -05:00
/* Full Analysis Process for a single node/edge combination. Use with caution, as the process is
* relatively expensive */
OSRM_ATTR_WARN_UNUSED
Intersection operator()(const NodeID node_prior_to_intersection,
const EdgeID entering_via_edge) const;
/*
* Returns a normalized intersection without any assigned turn types.
* This intersection can be used as input for intersection classification, turn lane assignment
* and similar.
*/
struct ShapeResult
{
// the basic shape, containing all turns
IntersectionShape intersection_shape;
// normalized shape, merged some roads into others, adjusted bearings
// see intersection_normalizer for further explanations
IntersectionNormalizer::NormalizationResult annotated_normalized_shape;
};
OSRM_ATTR_WARN_UNUSED
ShapeResult ComputeIntersectionShapes(const NodeID node_at_center_of_intersection) const;
// Select turn types based on the intersection shape
OSRM_ATTR_WARN_UNUSED
Intersection AssignTurnTypes(const NodeID from_node,
const EdgeID via_eid,
const IntersectionView &intersection) const;
const IntersectionGenerator &GetIntersectionGenerator() const;
2016-03-08 06:40:45 -05:00
private:
const util::NodeBasedDynamicGraph &node_based_graph;
const IntersectionGenerator intersection_generator;
const IntersectionNormalizer intersection_normalizer;
const RoundaboutHandler roundabout_handler;
const MotorwayHandler motorway_handler;
const TurnHandler turn_handler;
2016-07-04 06:19:49 -04:00
const SliproadHandler sliproad_handler;
2016-12-07 14:26:34 -05:00
const SuppressModeHandler suppress_mode_handler;
2017-06-13 09:17:13 -04:00
const DrivewayHandler driveway_handler;
2016-03-08 06:40:45 -05:00
// Utility function, setting basic turn types. Prepares for normal turn handling.
Intersection
setTurnTypes(const NodeID from, const EdgeID via_edge, Intersection intersection) const;
2016-03-08 06:40:45 -05:00
}; // class TurnAnalysis
2016-02-26 11:33:18 -05:00
2016-03-01 16:30:31 -05:00
} // namespace guidance
} // namespace extractor
} // namespace osrm
#endif // OSRM_EXTRACTOR_TURN_ANALYSIS