Skip to content

Commit

Permalink
Review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
oxidase committed Jan 23, 2018
1 parent dc23c1a commit 5a3dcd7
Show file tree
Hide file tree
Showing 24 changed files with 158 additions and 301 deletions.
15 changes: 8 additions & 7 deletions include/engine/datafacade/contiguous_internalmem_datafacade.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#include "extractor/profile_properties.hpp"
#include "extractor/segment_data_container.hpp"
#include "extractor/turn_lane_types.hpp"

#include "guidance/turn_bearing.hpp"
#include "guidance/turn_data_container.hpp"
#include "guidance/turn_instruction.hpp"

Expand All @@ -35,7 +37,6 @@
#include "util/filtered_graph.hpp"
#include "util/guidance/bearing_class.hpp"
#include "util/guidance/entry_class.hpp"
#include "util/guidance/turn_bearing.hpp"
#include "util/guidance/turn_lanes.hpp"
#include "util/log.hpp"
#include "util/name_table.hpp"
Expand Down Expand Up @@ -328,14 +329,14 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
util::vector_view<EntryClassID> entry_class_ids(
entry_class_id_list_ptr, layout.num_entries[storage::DataLayout::ENTRY_CLASSID]);

const auto pre_turn_bearing_ptr = layout.GetBlockPtr<util::guidance::TurnBearing>(
const auto pre_turn_bearing_ptr = layout.GetBlockPtr<guidance::TurnBearing>(
memory_ptr, storage::DataLayout::PRE_TURN_BEARING);
util::vector_view<util::guidance::TurnBearing> pre_turn_bearings(
util::vector_view<guidance::TurnBearing> pre_turn_bearings(
pre_turn_bearing_ptr, layout.num_entries[storage::DataLayout::PRE_TURN_BEARING]);

const auto post_turn_bearing_ptr = layout.GetBlockPtr<util::guidance::TurnBearing>(
const auto post_turn_bearing_ptr = layout.GetBlockPtr<guidance::TurnBearing>(
memory_ptr, storage::DataLayout::POST_TURN_BEARING);
util::vector_view<util::guidance::TurnBearing> post_turn_bearings(
util::vector_view<guidance::TurnBearing> post_turn_bearings(
post_turn_bearing_ptr, layout.num_entries[storage::DataLayout::POST_TURN_BEARING]);

turn_data = guidance::TurnDataView(std::move(turn_instructions),
Expand Down Expand Up @@ -844,11 +845,11 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
return intersection_bearings_view.GetBearingClass(node);
}

util::guidance::TurnBearing PreTurnBearing(const EdgeID eid) const override final
guidance::TurnBearing PreTurnBearing(const EdgeID eid) const override final
{
return turn_data.GetPreTurnBearing(eid);
}
util::guidance::TurnBearing PostTurnBearing(const EdgeID eid) const override final
guidance::TurnBearing PostTurnBearing(const EdgeID eid) const override final
{
return turn_data.GetPostTurnBearing(eid);
}
Expand Down
7 changes: 4 additions & 3 deletions include/engine/datafacade/datafacade_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@
#include "extractor/query_node.hpp"
#include "extractor/travel_mode.hpp"
#include "extractor/turn_lane_types.hpp"

#include "guidance/turn_bearing.hpp"
#include "guidance/turn_instruction.hpp"

#include "util/exception.hpp"
#include "util/guidance/bearing_class.hpp"
#include "util/guidance/entry_class.hpp"
#include "util/guidance/turn_bearing.hpp"
#include "util/guidance/turn_lanes.hpp"
#include "util/integer_range.hpp"
#include "util/string_util.hpp"
Expand Down Expand Up @@ -181,8 +182,8 @@ class BaseDataFacade

virtual double GetWeightMultiplier() const = 0;

virtual util::guidance::TurnBearing PreTurnBearing(const EdgeID eid) const = 0;
virtual util::guidance::TurnBearing PostTurnBearing(const EdgeID eid) const = 0;
virtual osrm::guidance::TurnBearing PreTurnBearing(const EdgeID eid) const = 0;
virtual osrm::guidance::TurnBearing PostTurnBearing(const EdgeID eid) const = 0;

virtual util::guidance::BearingClass GetBearingClass(const NodeID node) const = 0;

Expand Down
7 changes: 4 additions & 3 deletions include/engine/internal_route_result.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@

#include "extractor/class_data.hpp"
#include "extractor/travel_mode.hpp"

#include "guidance/turn_bearing.hpp"
#include "guidance/turn_instruction.hpp"

#include "engine/phantom_node.hpp"

#include "util/coordinate.hpp"
#include "util/guidance/entry_class.hpp"
#include "util/guidance/turn_bearing.hpp"
#include "util/guidance/turn_lanes.hpp"
#include "util/integer_range.hpp"
#include "util/typedefs.hpp"
Expand Down Expand Up @@ -56,9 +57,9 @@ struct PathData
DatasourceID datasource_id;

// bearing (as seen from the intersection) pre-turn
util::guidance::TurnBearing pre_turn_bearing;
osrm::guidance::TurnBearing pre_turn_bearing;
// bearing (as seen from the intersection) post-turn
util::guidance::TurnBearing post_turn_bearing;
osrm::guidance::TurnBearing post_turn_bearing;

// Driving side of the turn
bool is_left_hand_driving;
Expand Down
10 changes: 5 additions & 5 deletions include/engine/routing_algorithms/routing_base.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef OSRM_ENGINE_ROUTING_BASE_HPP
#define OSRM_ENGINE_ROUTING_BASE_HPP

#include "guidance/turn_bearing.hpp"
#include "guidance/turn_instruction.hpp"

#include "engine/algorithm.hpp"
Expand All @@ -10,7 +11,6 @@
#include "engine/search_engine_data.hpp"

#include "util/coordinate_calculation.hpp"
#include "util/guidance/turn_bearing.hpp"
#include "util/typedefs.hpp"

#include <boost/assert.hpp>
Expand Down Expand Up @@ -205,8 +205,8 @@ void annotatePath(const FacadeT &facade,
classes,
EMPTY_ENTRY_CLASS,
datasource_vector[segment_idx],
util::guidance::TurnBearing(0),
util::guidance::TurnBearing(0),
osrm::guidance::TurnBearing(0),
osrm::guidance::TurnBearing(0),
is_left_hand_driving});
}
BOOST_ASSERT(unpacked_path.size() > 0);
Expand Down Expand Up @@ -279,8 +279,8 @@ void annotatePath(const FacadeT &facade,
facade.GetClassData(target_node_id),
EMPTY_ENTRY_CLASS,
datasource_vector[segment_idx],
util::guidance::TurnBearing(0),
util::guidance::TurnBearing(0),
guidance::TurnBearing(0),
guidance::TurnBearing(0),
is_target_left_hand_driving});
}

Expand Down
2 changes: 1 addition & 1 deletion include/extractor/intersection/mergable_road_detector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ class MergableRoadDetector
const static double constexpr distance_to_extract = 120;
};

} // namespace guidance
} // namespace intersection
} // namespace extractor
} // namespace osrm

Expand Down
2 changes: 1 addition & 1 deletion include/extractor/intersection/node_based_graph_walker.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ struct DistanceToNextIntersectionAccumulator
double distance = 0.;
};

} // namespace guidance
} // namespace intersection
} // namespace extractor
} // namespace osrm

Expand Down
123 changes: 0 additions & 123 deletions include/extractor/turn_data_container.hpp.tbd

This file was deleted.

32 changes: 16 additions & 16 deletions include/guidance/guidance_processing.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,22 @@ using BearingClassesVector = std::vector<BearingClassID>;
using BearingClassesMap = util::ConcurrentIDMap<util::guidance::BearingClass, BearingClassID>;
using EntryClassesMap = util::ConcurrentIDMap<util::guidance::EntryClass, EntryClassID>;

void processGuidanceTurns(const util::NodeBasedDynamicGraph &node_based_graph,
const extractor::EdgeBasedNodeDataContainer &edge_based_node_container,
const std::vector<util::Coordinate> &node_coordinates,
const extractor::CompressedEdgeContainer &compressed_edge_container,
const std::unordered_set<NodeID> &barrier_nodes,
const extractor::RestrictionMap &node_restriction_map,
const extractor::WayRestrictionMap &way_restriction_map,
const util::NameTable &name_table,
const extractor::SuffixTable &suffix_table,
const extractor::TurnLanesIndexedArray &turn_lanes_data,
extractor::LaneDescriptionMap &lane_description_map,
util::guidance::LaneDataIdMap &lane_data_map,
guidance::TurnDataExternalContainer &turn_data_container,
BearingClassesVector &bearing_class_by_node_based_node,
BearingClassesMap &bearing_class_hash,
EntryClassesMap &entry_class_hash);
void annotateTurns(const util::NodeBasedDynamicGraph &node_based_graph,
const extractor::EdgeBasedNodeDataContainer &edge_based_node_container,
const std::vector<util::Coordinate> &node_coordinates,
const extractor::CompressedEdgeContainer &compressed_edge_container,
const std::unordered_set<NodeID> &barrier_nodes,
const extractor::RestrictionMap &node_restriction_map,
const extractor::WayRestrictionMap &way_restriction_map,
const util::NameTable &name_table,
const extractor::SuffixTable &suffix_table,
const extractor::TurnLanesIndexedArray &turn_lanes_data,
extractor::LaneDescriptionMap &lane_description_map,
util::guidance::LaneDataIdMap &lane_data_map,
guidance::TurnDataExternalContainer &turn_data_container,
BearingClassesVector &bearing_class_by_node_based_node,
BearingClassesMap &bearing_class_hash,
EntryClassesMap &entry_class_hash);

} // namespace customizer
} // namespace osrm
Expand Down
4 changes: 2 additions & 2 deletions include/guidance/segregated_intersection_classification.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class NameTable;
namespace extractor
{
class NodeBasedGraphFactory;
}

namespace guidance
{
Expand All @@ -20,8 +21,7 @@ namespace guidance
// - middle edges between two osm ways in one logic road (U-turn)
// - staggered intersections (X-cross)
// - square/circle intersections
std::unordered_set<EdgeID> findSegregatedNodes(const NodeBasedGraphFactory &factory,
std::unordered_set<EdgeID> findSegregatedNodes(const extractor::NodeBasedGraphFactory &factory,
const util::NameTable &names);
}
}
}
38 changes: 38 additions & 0 deletions include/guidance/turn_bearing.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#ifndef OSRM_INCLUDE_GUIDANCE_TURN_BEARING_HPP_
#define OSRM_INCLUDE_GUIDANCE_TURN_BEARING_HPP_

#include <cstdint>

#include <boost/assert.hpp>

namespace osrm
{
namespace guidance
{
namespace
{
const double bearing_scale = 360.0 / 256.0;
}

#pragma pack(push, 1)
class TurnBearing
{
public:
// discretizes a bearing into distinct units of 1.4 degrees
TurnBearing(const double value = 0) : bearing(value / bearing_scale)
{
BOOST_ASSERT_MSG(value >= 0 && value < 360.0,
"Bearing value needs to be between 0 and 360 (exclusive)");
}

double Get() const { return bearing * bearing_scale; }

private:
std::uint8_t bearing;
};
#pragma pack(pop)

} // namespace guidance
} // namespace osrm

#endif /* OSRM_INCLUDE_GUIDANCE_TURN_BEARING_HPP_ */
Loading

0 comments on commit 5a3dcd7

Please sign in to comment.