structural changes, motorway handling
This commit is contained in:
		
							parent
							
								
									3cdd282e0f
								
							
						
					
					
						commit
						0ba70bcbf9
					
				| @ -59,6 +59,7 @@ std::vector<RouteStep> assembleSteps(const DataFacadeT &facade, | ||||
|                                      boost::optional<util::Coordinate> source_location, | ||||
|                                      boost::optional<util::Coordinate> target_location) | ||||
| { | ||||
|     (void) source_location; | ||||
|     const auto source_duration = | ||||
|         (source_traversed_in_reverse ? source_node.GetReverseWeightPlusOffset() | ||||
|                                      : source_node.GetForwardWeightPlusOffset()) / | ||||
| @ -80,19 +81,15 @@ std::vector<RouteStep> assembleSteps(const DataFacadeT &facade, | ||||
| 
 | ||||
|     // TODO do computation based on distance and choose better next vertex
 | ||||
|     BOOST_ASSERT(leg_geometry.locations.size() >= 4); // source, phantom, closest positions on way
 | ||||
|     const auto initial_modifier = | ||||
|         source_location | ||||
|             ? angleToDirectionModifier(util::coordinate_calculation::computeAngle( | ||||
|                   source_location.get(), leg_geometry.locations[0], leg_geometry.locations[1])) | ||||
|             : DirectionModifier::UTurn; | ||||
| 
 | ||||
|     auto segment_index = 0; | ||||
|     if (leg_data.size() > 0) | ||||
|     { | ||||
| 
 | ||||
|         StepManeuver maneuver = | ||||
|             detail::stepManeuverFromGeometry(TurnInstruction{TurnType::Location, initial_modifier}, | ||||
|                                              leg_geometry, segment_index, INVALID_EXIT_NR); | ||||
|         StepManeuver maneuver = detail::stepManeuverFromGeometry( | ||||
|             TurnInstruction{TurnType::Location, DirectionModifier::UTurn}, leg_geometry, | ||||
|             segment_index, INVALID_EXIT_NR); | ||||
|         maneuver.instruction.direction_modifier = bearingToDirectionModifier(maneuver.bearing_before); | ||||
| 
 | ||||
|         // TODO fix this: it makes no sense
 | ||||
|         // PathData saves the information we need of the segment _before_ the turn,
 | ||||
| @ -129,8 +126,9 @@ std::vector<RouteStep> assembleSteps(const DataFacadeT &facade, | ||||
|         // x---*---*---*---z compressed edge
 | ||||
|         //       |-------| duration
 | ||||
|         StepManeuver maneuver = {source_node.location, 0., 0., | ||||
|                                  TurnInstruction{TurnType::Location, initial_modifier}, | ||||
|                                  TurnInstruction{TurnType::Location, DirectionModifier::UTurn}, | ||||
|                                  INVALID_EXIT_NR}; | ||||
|         maneuver.instruction.direction_modifier = bearingToDirectionModifier(maneuver.bearing_before); | ||||
| 
 | ||||
|         steps.push_back(RouteStep{source_node.name_id, facade.get_name_for_id(source_node.name_id), | ||||
|                                   target_duration - source_duration, | ||||
|  | ||||
| @ -107,6 +107,11 @@ struct RoadClassificationData | ||||
|     }; | ||||
| }; | ||||
| 
 | ||||
| inline bool operator==( const RoadClassificationData lhs, const RoadClassificationData rhs ) | ||||
| { | ||||
|   return lhs.road_class == rhs.road_class; | ||||
| } | ||||
| 
 | ||||
| } // namespace guidance
 | ||||
| } // namespace engine
 | ||||
| } // namespace osrm
 | ||||
|  | ||||
| @ -66,8 +66,16 @@ getTurnCandidates(const NodeID from_node, | ||||
|                   const std::unordered_set<NodeID> &barrier_nodes, | ||||
|                   const CompressedEdgeContainer &compressed_edge_container); | ||||
| 
 | ||||
| // merge segregated roads to omit invalid turns in favor of treating segregated roads as one
 | ||||
| std::vector<TurnCandidate> | ||||
| mergeSegregatedRoads(const NodeID from_node, | ||||
|                      const EdgeID via_eid, | ||||
|                      std::vector<TurnCandidate> turn_candidates, | ||||
|                      const std::shared_ptr<const util::NodeBasedDynamicGraph> node_based_graph); | ||||
| 
 | ||||
| // handle roundabouts
 | ||||
| // TODO distinguish roundabouts and rotaries
 | ||||
| // TODO handle bike/walk cases that allow crossing a roundabout!
 | ||||
| std::vector<TurnCandidate> | ||||
| handleRoundabouts(const NodeID from, | ||||
|                   const EdgeID via_edge, | ||||
| @ -77,7 +85,72 @@ handleRoundabouts(const NodeID from, | ||||
|                   std::vector<TurnCandidate> turn_candidates, | ||||
|                   const std::shared_ptr<const util::NodeBasedDynamicGraph> node_based_graph); | ||||
| 
 | ||||
| // handle intersections
 | ||||
| bool isBasicJunction(const NodeID from, | ||||
|                      const EdgeID via_edge, | ||||
|                      const std::vector<TurnCandidate> &turn_candidates, | ||||
|                      const std::shared_ptr<const util::NodeBasedDynamicGraph> node_based_graph); | ||||
| 
 | ||||
| bool isMotorwayJunction(const NodeID from, | ||||
|                         const EdgeID via_edge, | ||||
|                         const std::vector<TurnCandidate> &turn_candidates, | ||||
|                         const std::shared_ptr<const util::NodeBasedDynamicGraph> node_based_graph); | ||||
| 
 | ||||
| // Decide whether a turn is a turn or a ramp access
 | ||||
| engine::guidance::TurnType | ||||
| turnOrRamp(const NodeID from, | ||||
|            const EdgeID via_edge, | ||||
|            const TurnCandidate &candidate, | ||||
|            const std::shared_ptr<const util::NodeBasedDynamicGraph> node_based_graph); | ||||
| 
 | ||||
| // Get the Instruction for an obvious turn
 | ||||
| engine::guidance::TurnInstruction | ||||
| getInstructionForObvious(const NodeID from, | ||||
|                          const EdgeID via_edge, | ||||
|                          const TurnCandidate &candidate, | ||||
|                          const std::shared_ptr<const util::NodeBasedDynamicGraph> node_based_graph); | ||||
| 
 | ||||
| engine::guidance::TurnInstruction | ||||
| noTurnOrNewName(const NodeID from, | ||||
|                 const EdgeID via_edge, | ||||
|                 const TurnCandidate &candidate, | ||||
|                 const std::shared_ptr<const util::NodeBasedDynamicGraph> node_based_graph); | ||||
| 
 | ||||
| // handle basic intersections
 | ||||
| std::vector<TurnCandidate> | ||||
| handleOneWayTurn(const NodeID from, | ||||
|                  const EdgeID via_edge, | ||||
|                  std::vector<TurnCandidate> turn_candidates, | ||||
|                  const std::shared_ptr<const util::NodeBasedDynamicGraph> node_based_graph); | ||||
| 
 | ||||
| std::vector<TurnCandidate> | ||||
| handleTwoWayTurn(const NodeID from, | ||||
|                  const EdgeID via_edge, | ||||
|                  std::vector<TurnCandidate> turn_candidates, | ||||
|                  const std::shared_ptr<const util::NodeBasedDynamicGraph> node_based_graph); | ||||
| 
 | ||||
| std::vector<TurnCandidate> | ||||
| handleThreeWayTurn(const NodeID from, | ||||
|                    const EdgeID via_edge, | ||||
|                    std::vector<TurnCandidate> turn_candidates, | ||||
|                    const std::shared_ptr<const util::NodeBasedDynamicGraph> node_based_graph); | ||||
| 
 | ||||
| std::vector<TurnCandidate> | ||||
| handleFourWayTurn(const NodeID from, | ||||
|                   const EdgeID via_edge, | ||||
|                   std::vector<TurnCandidate> turn_candidates, | ||||
|                   const std::shared_ptr<const util::NodeBasedDynamicGraph> node_based_graph); | ||||
| 
 | ||||
| std::vector<TurnCandidate> | ||||
| handleComplexTurn(const NodeID from, | ||||
|                   const EdgeID via_edge, | ||||
|                   std::vector<TurnCandidate> turn_candidates, | ||||
|                   const std::shared_ptr<const util::NodeBasedDynamicGraph> node_based_graph); | ||||
| 
 | ||||
| std::vector<TurnCandidate> | ||||
| handleMotorwayJunction(const NodeID from, | ||||
|                        const EdgeID via_edge, | ||||
|                        std::vector<TurnCandidate> turn_candidates, | ||||
|                        const std::shared_ptr<const util::NodeBasedDynamicGraph> node_based_graph); | ||||
| 
 | ||||
| std::vector<TurnCandidate> | ||||
| setTurnTypes(const NodeID from, | ||||
| @ -90,13 +163,6 @@ optimizeRamps(const EdgeID via_edge, | ||||
|               std::vector<TurnCandidate> turn_candidates, | ||||
|               const std::shared_ptr<const util::NodeBasedDynamicGraph> node_based_graph); | ||||
| 
 | ||||
| engine::guidance::TurnType | ||||
| checkForkAndEnd(const EdgeID via_eid, | ||||
|                 const std::vector<TurnCandidate> &turn_candidates, | ||||
|                 const std::shared_ptr<const util::NodeBasedDynamicGraph> node_based_graph); | ||||
| 
 | ||||
| std::vector<TurnCandidate> handleForkAndEnd(const engine::guidance::TurnType type, | ||||
|                                             std::vector<TurnCandidate> turn_candidates); | ||||
| std::vector<TurnCandidate> | ||||
| optimizeCandidates(const EdgeID via_eid, | ||||
|                    std::vector<TurnCandidate> turn_candidates, | ||||
|  | ||||
| @ -51,7 +51,7 @@ struct NodeBasedEdgeData | ||||
|     bool IsCompatibleTo(const NodeBasedEdgeData &other) const | ||||
|     { | ||||
|         return (reversed == other.reversed) && (name_id == other.name_id) && | ||||
|                (travel_mode == other.travel_mode); | ||||
|                (travel_mode == other.travel_mode && road_classification == other.road_classification); | ||||
|     } | ||||
| }; | ||||
| 
 | ||||
|  | ||||
| @ -2,6 +2,8 @@ | ||||
| 
 | ||||
| #include <osmium/osm.hpp> | ||||
| 
 | ||||
| #include <iostream> | ||||
| 
 | ||||
| namespace osrm | ||||
| { | ||||
| namespace engine | ||||
|  | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Loading…
	
		Reference in New Issue
	
	Block a user