Apply clang-format again

This commit is contained in:
Patrick Niklaus 2016-07-26 15:00:58 +02:00
parent aebf6fa0b1
commit c7a1576100
No known key found for this signature in database
GPG Key ID: E426891B5F978B1B
42 changed files with 150 additions and 137 deletions

View File

@ -360,7 +360,7 @@ class InternalDataFacade final : public BaseDataFacade
std::vector<util::guidance::BearingClass> bearing_classes; std::vector<util::guidance::BearingClass> bearing_classes;
// and the actual bearing values // and the actual bearing values
std::uint64_t num_bearings; std::uint64_t num_bearings;
intersection_stream.read(reinterpret_cast<char*>(&num_bearings),sizeof(num_bearings)); intersection_stream.read(reinterpret_cast<char *>(&num_bearings), sizeof(num_bearings));
m_bearing_values_table.resize(num_bearings); m_bearing_values_table.resize(num_bearings);
intersection_stream.read(reinterpret_cast<char *>(&m_bearing_values_table[0]), intersection_stream.read(reinterpret_cast<char *>(&m_bearing_values_table[0]),
sizeof(m_bearing_values_table[0]) * num_bearings); sizeof(m_bearing_values_table[0]) * num_bearings);

View File

@ -840,7 +840,8 @@ class SharedDataFacade final : public BaseDataFacade
else else
return extractor::guidance::TurnLaneDescription( return extractor::guidance::TurnLaneDescription(
m_lane_description_masks.begin() + m_lane_description_offsets[lane_description_id], m_lane_description_masks.begin() + m_lane_description_offsets[lane_description_id],
m_lane_description_masks.begin() + m_lane_description_offsets[lane_description_id + 1]); m_lane_description_masks.begin() +
m_lane_description_offsets[lane_description_id + 1]);
} }
}; };
} }

View File

@ -247,7 +247,8 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
BOOST_ASSERT(steps.back().intersections.front().entry.size() == 1); BOOST_ASSERT(steps.back().intersections.front().entry.size() == 1);
BOOST_ASSERT(steps.back().maneuver.waypoint_type == WaypointType::Arrive); BOOST_ASSERT(steps.back().maneuver.waypoint_type == WaypointType::Arrive);
BOOST_ASSERT(steps.back().intersections.front().lanes.lanes_in_turn == 0); BOOST_ASSERT(steps.back().intersections.front().lanes.lanes_in_turn == 0);
BOOST_ASSERT(steps.back().intersections.front().lanes.first_lane_from_the_right == INVALID_LANEID); BOOST_ASSERT(steps.back().intersections.front().lanes.first_lane_from_the_right ==
INVALID_LANEID);
BOOST_ASSERT(steps.back().intersections.front().lane_description.empty()); BOOST_ASSERT(steps.back().intersections.front().lane_description.empty());
return steps; return steps;
} }

View File

@ -107,12 +107,11 @@ trimLaneString(std::string lane_string, std::int32_t count_left, std::int32_t co
return extractor::guidance::trimLaneString(std::move(lane_string), count_left, count_right); return extractor::guidance::trimLaneString(std::move(lane_string), count_left, count_right);
} }
inline std::string inline std::string applyAccessTokens(const std::string &lane_string,
applyAccessTokens(const std::string &lane_string, const std::string &access_tokens) const std::string &access_tokens)
{ {
return extractor::guidance::applyAccessTokens(lane_string, access_tokens); return extractor::guidance::applyAccessTokens(lane_string, access_tokens);
} }
} }
} }

View File

@ -1,8 +1,8 @@
#ifndef EXTRACTION_WAY_HPP #ifndef EXTRACTION_WAY_HPP
#define EXTRACTION_WAY_HPP #define EXTRACTION_WAY_HPP
#include "extractor/travel_mode.hpp"
#include "extractor/guidance/road_classification.hpp" #include "extractor/guidance/road_classification.hpp"
#include "extractor/travel_mode.hpp"
#include "util/guidance/turn_lanes.hpp" #include "util/guidance/turn_lanes.hpp"
#include "util/typedefs.hpp" #include "util/typedefs.hpp"

View File

@ -1,8 +1,8 @@
#ifndef EXTRACTOR_CALLBACKS_HPP #ifndef EXTRACTOR_CALLBACKS_HPP
#define EXTRACTOR_CALLBACKS_HPP #define EXTRACTOR_CALLBACKS_HPP
#include "util/typedefs.hpp"
#include "extractor/guidance/turn_lane_types.hpp" #include "extractor/guidance/turn_lane_types.hpp"
#include "util/typedefs.hpp"
#include <boost/functional/hash.hpp> #include <boost/functional/hash.hpp>
#include <boost/optional/optional_fwd.hpp> #include <boost/optional/optional_fwd.hpp>
@ -40,7 +40,10 @@ class ExtractorCallbacks
using MapKey = std::pair<std::string, std::string>; using MapKey = std::pair<std::string, std::string>;
using MapVal = unsigned; using MapVal = unsigned;
std::unordered_map<MapKey, MapVal, boost::hash<MapKey>> string_map; std::unordered_map<MapKey, MapVal, boost::hash<MapKey>> string_map;
std::unordered_map<guidance::TurnLaneDescription,LaneDescriptionID,guidance::TurnLaneDescription_hash> lane_description_map; std::unordered_map<guidance::TurnLaneDescription,
LaneDescriptionID,
guidance::TurnLaneDescription_hash>
lane_description_map;
ExtractionContainers &external_memory; ExtractionContainers &external_memory;
public: public:

View File

@ -84,16 +84,10 @@ class RoadClassification
bool IsLowPriorityRoadClass() const { return (0 != may_be_ignored); } bool IsLowPriorityRoadClass() const { return (0 != may_be_ignored); }
void SetLowPriorityFlag(const bool new_value) { may_be_ignored = new_value; } void SetLowPriorityFlag(const bool new_value) { may_be_ignored = new_value; }
std::uint32_t GetPriority() const std::uint32_t GetPriority() const { return static_cast<std::uint32_t>(road_priority_class); }
{
return static_cast<std::uint32_t>(road_priority_class);
}
RoadPriorityClass::Enum GetClass() const { return road_priority_class; } RoadPriorityClass::Enum GetClass() const { return road_priority_class; }
void SetClass(const RoadPriorityClass::Enum new_value) void SetClass(const RoadPriorityClass::Enum new_value) { road_priority_class = new_value; }
{
road_priority_class = new_value;
}
bool operator==(const RoadClassification &other) const bool operator==(const RoadClassification &other) const
{ {
@ -102,10 +96,7 @@ class RoadClassification
road_priority_class == other.road_priority_class; road_priority_class == other.road_priority_class;
} }
bool operator!=(const RoadClassification &other ) const bool operator!=(const RoadClassification &other) const { return !(*this == other); }
{
return !(*this == other);
}
std::string ToString() const std::string ToString() const
{ {
@ -116,7 +107,9 @@ class RoadClassification
}; };
#pragma pack(pop) #pragma pack(pop)
static_assert(sizeof(RoadClassification) == 1,"Road Classification should fit a byte. Increasing this has a severe impact on memory."); static_assert(
sizeof(RoadClassification) == 1,
"Road Classification should fit a byte. Increasing this has a severe impact on memory.");
inline bool canBeSeenAsFork(const RoadClassification first, const RoadClassification second) inline bool canBeSeenAsFork(const RoadClassification first, const RoadClassification second)
{ {

View File

@ -2,8 +2,8 @@
#define OSRM_EXTRACTOR_GUIDANCE_SLIPROAD_HANDLER_HPP_ #define OSRM_EXTRACTOR_GUIDANCE_SLIPROAD_HANDLER_HPP_
#include "extractor/guidance/intersection.hpp" #include "extractor/guidance/intersection.hpp"
#include "extractor/guidance/intersection_handler.hpp"
#include "extractor/guidance/intersection_generator.hpp" #include "extractor/guidance/intersection_generator.hpp"
#include "extractor/guidance/intersection_handler.hpp"
#include "extractor/query_node.hpp" #include "extractor/query_node.hpp"
#include "util/name_table.hpp" #include "util/name_table.hpp"
@ -42,6 +42,7 @@ class SliproadHandler : public IntersectionHandler
Intersection operator()(const NodeID nid, Intersection operator()(const NodeID nid,
const EdgeID via_eid, const EdgeID via_eid,
Intersection intersection) const override final; Intersection intersection) const override final;
private: private:
const IntersectionGenerator &intersection_generator; const IntersectionGenerator &intersection_generator;
}; };

View File

@ -61,7 +61,8 @@ class TurnHandler : public IntersectionHandler
handleDistinctConflict(const EdgeID via_edge, ConnectedRoad &left, ConnectedRoad &right) const; handleDistinctConflict(const EdgeID via_edge, ConnectedRoad &left, ConnectedRoad &right) const;
// Classification // Classification
std::pair<std::size_t, std::size_t> findFork(const EdgeID via_edge, const Intersection &intersection) const; std::pair<std::size_t, std::size_t> findFork(const EdgeID via_edge,
const Intersection &intersection) const;
Intersection assignLeftTurns(const EdgeID via_edge, Intersection assignLeftTurns(const EdgeID via_edge,
Intersection intersection, Intersection intersection,

View File

@ -1,8 +1,8 @@
#ifndef OSRM_EXTRACTOR_GUIDANCE_TURN_LANE_DATA_HPP_ #ifndef OSRM_EXTRACTOR_GUIDANCE_TURN_LANE_DATA_HPP_
#define OSRM_EXTRACTOR_GUIDANCE_TURN_LANE_DATA_HPP_ #define OSRM_EXTRACTOR_GUIDANCE_TURN_LANE_DATA_HPP_
#include "util/typedefs.hpp"
#include "extractor/guidance/turn_lane_types.hpp" #include "extractor/guidance/turn_lane_types.hpp"
#include "util/typedefs.hpp"
#include <string> #include <string>
#include <vector> #include <vector>

View File

@ -10,9 +10,9 @@
#include <boost/assert.hpp> #include <boost/assert.hpp>
#include <boost/functional/hash_fwd.hpp> #include <boost/functional/hash_fwd.hpp>
#include "util/json_container.hpp"
#include "util/simple_logger.hpp" #include "util/simple_logger.hpp"
#include "util/typedefs.hpp" #include "util/typedefs.hpp"
#include "util/json_container.hpp"
namespace osrm namespace osrm
{ {

View File

@ -141,7 +141,6 @@ struct InternalExtractorEdge
return v; return v;
} }
}; };
} }
} }

View File

@ -112,20 +112,19 @@ inline bool NodeBasedEdge::operator<(const NodeBasedEdge &other) const
return source < other.source; return source < other.source;
} }
inline NodeBasedEdgeWithOSM::NodeBasedEdgeWithOSM( inline NodeBasedEdgeWithOSM::NodeBasedEdgeWithOSM(OSMNodeID source,
OSMNodeID source, OSMNodeID target,
OSMNodeID target, NodeID name_id,
NodeID name_id, EdgeWeight weight,
EdgeWeight weight, bool forward,
bool forward, bool backward,
bool backward, bool roundabout,
bool roundabout, bool access_restricted,
bool access_restricted, bool startpoint,
bool startpoint, TravelMode travel_mode,
TravelMode travel_mode, bool is_split,
bool is_split, const LaneDescriptionID lane_description_id,
const LaneDescriptionID lane_description_id, guidance::RoadClassification road_classification)
guidance::RoadClassification road_classification)
: NodeBasedEdge(SPECIAL_NODEID, : NodeBasedEdge(SPECIAL_NODEID,
SPECIAL_NODEID, SPECIAL_NODEID,
name_id, name_id,

View File

@ -5,8 +5,8 @@
#include "util/coordinate.hpp" #include "util/coordinate.hpp"
#include <limits>
#include <cstdint> #include <cstdint>
#include <limits>
namespace osrm namespace osrm
{ {
@ -15,8 +15,8 @@ namespace extractor
struct QueryNode struct QueryNode
{ {
using key_type = OSMNodeID; // type of NodeID using key_type = OSMNodeID; // type of NodeID
using value_type = std::int32_t; // type of lat,lons using value_type = std::int32_t; // type of lat,lons
explicit QueryNode(const util::FixedLongitude lon_, explicit QueryNode(const util::FixedLongitude lon_,
const util::FixedLatitude lat_, const util::FixedLatitude lat_,

View File

@ -48,7 +48,7 @@ class LuaScriptingEnvironment final : public ScriptingEnvironment
explicit LuaScriptingEnvironment(const std::string &file_name); explicit LuaScriptingEnvironment(const std::string &file_name);
~LuaScriptingEnvironment() override = default; ~LuaScriptingEnvironment() override = default;
const ProfileProperties& GetProfileProperties() override; const ProfileProperties &GetProfileProperties() override;
LuaScriptingContext &GetLuaContext(); LuaScriptingContext &GetLuaContext();

View File

@ -54,7 +54,7 @@ inline void print(const std::vector<engine::guidance::RouteStep> &steps)
} }
} }
inline void print( const extractor::guidance::Intersection & intersection ) inline void print(const extractor::guidance::Intersection &intersection)
{ {
std::cout << " Intersection:\n"; std::cout << " Intersection:\n";
for (const auto &road : intersection) for (const auto &road : intersection)
@ -62,7 +62,6 @@ inline void print( const extractor::guidance::Intersection & intersection )
std::cout << std::flush; std::cout << std::flush;
} }
inline void print(const extractor::guidance::lanes::LaneDataVector &turn_lane_data) inline void print(const extractor::guidance::lanes::LaneDataVector &turn_lane_data)
{ {
std::cout << " Tags:\n"; std::cout << " Tags:\n";

View File

@ -151,7 +151,7 @@ bool serializeVector(std::ofstream &out_stream, const stxxl::vector<simple_type>
template <typename simple_type> template <typename simple_type>
bool deserializeAdjacencyArray(const std::string &filename, bool deserializeAdjacencyArray(const std::string &filename,
std::vector<std::uint32_t> &offsets, std::vector<std::uint32_t> &offsets,
std::vector<simple_type>& data) std::vector<simple_type> &data)
{ {
std::ifstream in_stream(filename, std::ios::binary); std::ifstream in_stream(filename, std::ios::binary);

View File

@ -192,9 +192,9 @@ class StaticRTree
Coordinate current_centroid = coordinate_calculation::centroid( Coordinate current_centroid = coordinate_calculation::centroid(
m_coordinate_list[current_element.u], m_coordinate_list[current_element.v]); m_coordinate_list[current_element.u], m_coordinate_list[current_element.v]);
current_centroid.lat = current_centroid.lat = FixedLatitude{static_cast<std::int32_t>(
FixedLatitude{static_cast<std::int32_t>(COORDINATE_PRECISION * COORDINATE_PRECISION *
web_mercator::latToY(toFloating(current_centroid.lat)))}; web_mercator::latToY(toFloating(current_centroid.lat)))};
current_wrapper.m_hilbert_value = hilbertCode(current_centroid); current_wrapper.m_hilbert_value = hilbertCode(current_centroid);
} }

View File

@ -40,32 +40,32 @@ namespace osrm
* etc. Also clarifies what this random "int" value is * etc. Also clarifies what this random "int" value is
* being used for. * being used for.
*/ */
#define OSRM_STRONG_TYPEDEF(From, To) \ #define OSRM_STRONG_TYPEDEF(From, To) \
struct To final \ struct To final \
{ \ { \
static_assert(std::is_arithmetic<From>(), ""); \ static_assert(std::is_arithmetic<From>(), ""); \
From __value; \ From __value; \
friend std::ostream &operator<<(std::ostream &stream, const To &inst); \ friend std::ostream &operator<<(std::ostream &stream, const To &inst); \
\ \
explicit operator From &() { return __value; } \ explicit operator From &() { return __value; } \
explicit operator From() const { return __value; } \ explicit operator From() const { return __value; } \
To operator+(const To rhs_) const { return To{__value + static_cast<const From>(rhs_)}; } \ To operator+(const To rhs_) const { return To{__value + static_cast<const From>(rhs_)}; } \
To operator-(const To rhs_) const { return To{__value - static_cast<const From>(rhs_)}; } \ To operator-(const To rhs_) const { return To{__value - static_cast<const From>(rhs_)}; } \
To operator*(const To rhs_) const { return To{__value * static_cast<const From>(rhs_)}; } \ To operator*(const To rhs_) const { return To{__value * static_cast<const From>(rhs_)}; } \
To operator/(const To rhs_) const { return To{__value / static_cast<const From>(rhs_)}; } \ To operator/(const To rhs_) const { return To{__value / static_cast<const From>(rhs_)}; } \
bool operator<(const To z_) const { return __value < static_cast<const From>(z_); } \ bool operator<(const To z_) const { return __value < static_cast<const From>(z_); } \
bool operator>(const To z_) const { return __value > static_cast<const From>(z_); } \ bool operator>(const To z_) const { return __value > static_cast<const From>(z_); } \
bool operator<=(const To z_) const { return __value <= static_cast<const From>(z_); } \ bool operator<=(const To z_) const { return __value <= static_cast<const From>(z_); } \
bool operator>=(const To z_) const { return __value >= static_cast<const From>(z_); } \ bool operator>=(const To z_) const { return __value >= static_cast<const From>(z_); } \
bool operator==(const To z_) const { return __value == static_cast<const From>(z_); } \ bool operator==(const To z_) const { return __value == static_cast<const From>(z_); } \
bool operator!=(const To z_) const { return __value != static_cast<const From>(z_); } \ bool operator!=(const To z_) const { return __value != static_cast<const From>(z_); } \
}; \ }; \
static_assert(std::is_trivial<To>(), #To " is not a trivial type"); \ static_assert(std::is_trivial<To>(), #To " is not a trivial type"); \
static_assert(std::is_standard_layout<To>(), #To " is not a standart layout"); \ static_assert(std::is_standard_layout<To>(), #To " is not a standart layout"); \
static_assert(std::is_pod<To>(), #To " is not a POD layout"); \ static_assert(std::is_pod<To>(), #To " is not a POD layout"); \
inline std::ostream &operator<<(std::ostream &stream, const To &inst) \ inline std::ostream &operator<<(std::ostream &stream, const To &inst) \
{ \ { \
return stream << inst.__value; \ return stream << inst.__value; \
} }
#define OSRM_STRONG_TYPEDEF_HASHABLE(From, To) \ #define OSRM_STRONG_TYPEDEF_HASHABLE(From, To) \

View File

@ -64,7 +64,8 @@ static const LaneID INVALID_LANEID = std::numeric_limits<LaneID>::max();
using LaneDataID = std::uint16_t; using LaneDataID = std::uint16_t;
static const LaneDataID INVALID_LANE_DATAID = std::numeric_limits<LaneDataID>::max(); static const LaneDataID INVALID_LANE_DATAID = std::numeric_limits<LaneDataID>::max();
using LaneDescriptionID = std::uint16_t; using LaneDescriptionID = std::uint16_t;
static const LaneDescriptionID INVALID_LANE_DESCRIPTIONID = std::numeric_limits<LaneDescriptionID>::max(); static const LaneDescriptionID INVALID_LANE_DESCRIPTIONID =
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(); static const BearingClassID INVALID_BEARING_CLASSID = std::numeric_limits<BearingClassID>::max();

View File

@ -261,9 +261,8 @@ parse_segment_lookup_from_csv_files(const std::vector<std::string> &segment_spee
if (!ok || it != last) if (!ok || it != last)
throw util::exception{"Segment speed file " + filename + " malformed"}; throw util::exception{"Segment speed file " + filename + " malformed"};
SegmentSpeedSource val{ SegmentSpeedSource val{{OSMNodeID{from_node_id}, OSMNodeID{to_node_id}},
{OSMNodeID{from_node_id}, OSMNodeID{to_node_id}}, {speed, static_cast<std::uint8_t>(file_id)}};
{speed, static_cast<std::uint8_t>(file_id)}};
local.push_back(std::move(val)); local.push_back(std::move(val));
} }
@ -382,7 +381,7 @@ EdgeID Contractor::LoadEdgeExpandedGraph(
using boost::interprocess::mapped_region; using boost::interprocess::mapped_region;
using boost::interprocess::read_only; using boost::interprocess::read_only;
const file_mapping mapping{ filename.c_str(), read_only }; const file_mapping mapping{filename.c_str(), read_only};
mapped_region region{mapping, read_only}; mapped_region region{mapping, read_only};
region.advise(mapped_region::advice_sequential); region.advise(mapped_region::advice_sequential);
return region; return region;
@ -409,19 +408,21 @@ EdgeID Contractor::LoadEdgeExpandedGraph(
return boost::interprocess::mapped_region(); return boost::interprocess::mapped_region();
}(); }();
// Set the struct packing to 1 byte word sizes. This prevents any padding. We only use // Set the struct packing to 1 byte word sizes. This prevents any padding. We only use
// this struct once, so any alignment penalty is trivial. If this is *not* done, then // this struct once, so any alignment penalty is trivial. If this is *not* done, then
// the struct will be padded out by an extra 4 bytes, and sizeof() will mean we read // the struct will be padded out by an extra 4 bytes, and sizeof() will mean we read
// too much data from the original file. // too much data from the original file.
#pragma pack(push, r1, 1) #pragma pack(push, r1, 1)
struct EdgeBasedGraphHeader { struct EdgeBasedGraphHeader
{
util::FingerPrint fingerprint; util::FingerPrint fingerprint;
std::uint64_t number_of_edges; std::uint64_t number_of_edges;
EdgeID max_edge_id; EdgeID max_edge_id;
}; };
#pragma pack(pop, r1) #pragma pack(pop, r1)
const EdgeBasedGraphHeader graph_header = *(reinterpret_cast<const EdgeBasedGraphHeader *>(edge_based_graph_region.get_address())); const EdgeBasedGraphHeader graph_header =
*(reinterpret_cast<const EdgeBasedGraphHeader *>(edge_based_graph_region.get_address()));
const util::FingerPrint fingerprint_valid = util::FingerPrint::GetValid(); const util::FingerPrint fingerprint_valid = util::FingerPrint::GetValid();
graph_header.fingerprint.TestContractor(fingerprint_valid); graph_header.fingerprint.TestContractor(fingerprint_valid);
@ -737,14 +738,17 @@ EdgeID Contractor::LoadEdgeExpandedGraph(
tbb::parallel_invoke(maybe_save_geometries, save_datasource_indexes, save_datastore_names); tbb::parallel_invoke(maybe_save_geometries, save_datasource_indexes, save_datastore_names);
auto penaltyblock = auto penaltyblock = reinterpret_cast<const extractor::lookup::PenaltyBlock *>(
reinterpret_cast<const extractor::lookup::PenaltyBlock *>(edge_penalty_region.get_address()); edge_penalty_region.get_address());
auto edge_segment_byte_ptr = reinterpret_cast<const char *>(edge_segment_region.get_address()); auto edge_segment_byte_ptr = reinterpret_cast<const char *>(edge_segment_region.get_address());
auto edge_based_edge_ptr = reinterpret_cast<extractor::EdgeBasedEdge *>( auto edge_based_edge_ptr = reinterpret_cast<extractor::EdgeBasedEdge *>(
reinterpret_cast<char *>(edge_based_graph_region.get_address()) + sizeof(EdgeBasedGraphHeader)); reinterpret_cast<char *>(edge_based_graph_region.get_address()) +
sizeof(EdgeBasedGraphHeader));
const auto edge_based_edge_last = reinterpret_cast<extractor::EdgeBasedEdge *>( const auto edge_based_edge_last = reinterpret_cast<extractor::EdgeBasedEdge *>(
reinterpret_cast<char *>(edge_based_graph_region.get_address()) + sizeof(EdgeBasedGraphHeader) + sizeof(extractor::EdgeBasedEdge) * graph_header.number_of_edges); reinterpret_cast<char *>(edge_based_graph_region.get_address()) +
sizeof(EdgeBasedGraphHeader) +
sizeof(extractor::EdgeBasedEdge) * graph_header.number_of_edges);
while (edge_based_edge_ptr != edge_based_edge_last) while (edge_based_edge_ptr != edge_based_edge_last)
{ {
@ -777,7 +781,8 @@ EdgeID Contractor::LoadEdgeExpandedGraph(
{ {
if (speed_iter->speed_source.speed > 0) if (speed_iter->speed_source.speed > 0)
{ {
auto new_segment_weight = distanceAndSpeedToWeight(segmentblocks[i].segment_length, speed_iter->speed_source.speed); auto new_segment_weight = distanceAndSpeedToWeight(
segmentblocks[i].segment_length, speed_iter->speed_source.speed);
new_weight += new_segment_weight; new_weight += new_segment_weight;
} }
else else

View File

@ -83,7 +83,8 @@ util::json::Array lanesFromIntersection(const guidance::Intersection &intersecti
util::json::Object lane; util::json::Object lane;
lane.values["indications"] = extractor::guidance::TurnLaneType::toJsonArray(lane_desc); lane.values["indications"] = extractor::guidance::TurnLaneType::toJsonArray(lane_desc);
if (lane_id >= intersection.lanes.first_lane_from_the_right && if (lane_id >= intersection.lanes.first_lane_from_the_right &&
lane_id < intersection.lanes.first_lane_from_the_right + intersection.lanes.lanes_in_turn) lane_id <
intersection.lanes.first_lane_from_the_right + intersection.lanes.lanes_in_turn)
lane.values["valid"] = util::json::True(); lane.values["valid"] = util::json::True();
else else
lane.values["valid"] = util::json::False(); lane.values["valid"] = util::json::False();

View File

@ -1,5 +1,5 @@
#include "extractor/guidance/turn_instruction.hpp"
#include "engine/guidance/post_processing.hpp" #include "engine/guidance/post_processing.hpp"
#include "extractor/guidance/turn_instruction.hpp"
#include "engine/guidance/assemble_steps.hpp" #include "engine/guidance/assemble_steps.hpp"
#include "engine/guidance/lane_processing.hpp" #include "engine/guidance/lane_processing.hpp"
@ -1161,7 +1161,7 @@ std::vector<RouteStep> collapseUseLane(std::vector<RouteStep> steps)
{ {
const auto previous = getPreviousIndex(step_index); const auto previous = getPreviousIndex(step_index);
steps[previous] = elongate(steps[previous], steps[step_index]); steps[previous] = elongate(steps[previous], steps[step_index]);
//elongate(steps[step_index-1], steps[step_index]); // elongate(steps[step_index-1], steps[step_index]);
invalidateStep(steps[step_index]); invalidateStep(steps[step_index]);
} }
} }

View File

@ -116,8 +116,10 @@ std::vector<util::Coordinate> decodePolyline(const std::string &geometry_string)
lng += dlng; lng += dlng;
util::Coordinate p; util::Coordinate p;
p.lat = util::FixedLatitude{static_cast<std::int32_t>(lat * detail::POLYLINE_TO_COORDINATE)}; p.lat =
p.lon = util::FixedLongitude{static_cast<std::int32_t>(lng * detail::POLYLINE_TO_COORDINATE)}; util::FixedLatitude{static_cast<std::int32_t>(lat * detail::POLYLINE_TO_COORDINATE)};
p.lon =
util::FixedLongitude{static_cast<std::int32_t>(lng * detail::POLYLINE_TO_COORDINATE)};
new_coordinates.push_back(p); new_coordinates.push_back(p);
} }

View File

@ -1,5 +1,5 @@
#include "extractor/edge_based_edge.hpp"
#include "extractor/edge_based_graph_factory.hpp" #include "extractor/edge_based_graph_factory.hpp"
#include "extractor/edge_based_edge.hpp"
#include "util/coordinate.hpp" #include "util/coordinate.hpp"
#include "util/coordinate_calculation.hpp" #include "util/coordinate_calculation.hpp"
#include "util/exception.hpp" #include "util/exception.hpp"
@ -422,7 +422,8 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
distance += profile_properties.traffic_signal_penalty; distance += profile_properties.traffic_signal_penalty;
} }
const int32_t turn_penalty = scripting_environment.GetTurnPenalty(180. - turn.angle); const int32_t turn_penalty =
scripting_environment.GetTurnPenalty(180. - turn.angle);
const auto turn_instruction = turn.instruction; const auto turn_instruction = turn.instruction;
if (turn_instruction.direction_modifier == guidance::DirectionModifier::UTurn) if (turn_instruction.direction_modifier == guidance::DirectionModifier::UTurn)

View File

@ -83,7 +83,8 @@ int Extractor::run(ScriptingEnvironment &scripting_environment)
tbb::task_scheduler_init init(number_of_threads); tbb::task_scheduler_init init(number_of_threads);
util::SimpleLogger().Write() << "Input file: " << config.input_path.filename().string(); util::SimpleLogger().Write() << "Input file: " << config.input_path.filename().string();
if (!config.profile_path.empty()) { if (!config.profile_path.empty())
{
util::SimpleLogger().Write() << "Profile: " << config.profile_path.filename().string(); util::SimpleLogger().Write() << "Profile: " << config.profile_path.filename().string();
} }
util::SimpleLogger().Write() << "Threads: " << number_of_threads; util::SimpleLogger().Write() << "Threads: " << number_of_threads;
@ -151,7 +152,6 @@ int Extractor::run(ScriptingEnvironment &scripting_environment)
resulting_ways, resulting_ways,
resulting_restrictions); resulting_restrictions);
number_of_nodes += resulting_nodes.size(); number_of_nodes += resulting_nodes.size();
// put parsed objects thru extractor callbacks // put parsed objects thru extractor callbacks
for (const auto &result : resulting_nodes) for (const auto &result : resulting_nodes)

View File

@ -1,8 +1,8 @@
#include "extractor/extractor_callbacks.hpp"
#include "extractor/external_memory_node.hpp" #include "extractor/external_memory_node.hpp"
#include "extractor/extraction_containers.hpp" #include "extractor/extraction_containers.hpp"
#include "extractor/extraction_node.hpp" #include "extractor/extraction_node.hpp"
#include "extractor/extraction_way.hpp" #include "extractor/extraction_way.hpp"
#include "extractor/extractor_callbacks.hpp"
#include "extractor/guidance/road_classification.hpp" #include "extractor/guidance/road_classification.hpp"
#include "extractor/restriction.hpp" #include "extractor/restriction.hpp"

View File

@ -160,7 +160,8 @@ void GraphCompressor::Compress(const std::unordered_set<NodeID> &barrier_nodes,
* turn-lanes. Without this,we would have to treat any turn-lane beginning/ending just * turn-lanes. Without this,we would have to treat any turn-lane beginning/ending just
* like a barrier. * like a barrier.
*/ */
const auto selectLaneID = [](const LaneDescriptionID front, const LaneDescriptionID back) { const auto selectLaneID = [](const LaneDescriptionID front,
const LaneDescriptionID back) {
// A lane has tags: u - (front) - v - (back) - w // A lane has tags: u - (front) - v - (back) - w
// During contraction, we keep only one of the tags. Usually the one closer to the // During contraction, we keep only one of the tags. Usually the one closer to the
// intersection is preferred. If its empty, however, we keep the non-empty one // intersection is preferred. If its empty, however, we keep the non-empty one
@ -168,10 +169,12 @@ void GraphCompressor::Compress(const std::unordered_set<NodeID> &barrier_nodes,
return front; return front;
return back; return back;
}; };
graph.GetEdgeData(forward_e1).lane_description_id = selectLaneID( graph.GetEdgeData(forward_e1).lane_description_id =
graph.GetEdgeData(forward_e1).lane_description_id, fwd_edge_data2.lane_description_id); selectLaneID(graph.GetEdgeData(forward_e1).lane_description_id,
graph.GetEdgeData(reverse_e1).lane_description_id = selectLaneID( fwd_edge_data2.lane_description_id);
graph.GetEdgeData(reverse_e1).lane_description_id, rev_edge_data2.lane_description_id); graph.GetEdgeData(reverse_e1).lane_description_id =
selectLaneID(graph.GetEdgeData(reverse_e1).lane_description_id,
rev_edge_data2.lane_description_id);
// remove e2's (if bidir, otherwise only one) // remove e2's (if bidir, otherwise only one)
graph.DeleteEdge(node_v, forward_e2); graph.DeleteEdge(node_v, forward_e2);

View File

@ -1,5 +1,5 @@
#include "extractor/guidance/constants.hpp"
#include "extractor/guidance/intersection_handler.hpp" #include "extractor/guidance/intersection_handler.hpp"
#include "extractor/guidance/constants.hpp"
#include "extractor/guidance/toolkit.hpp" #include "extractor/guidance/toolkit.hpp"
#include "util/guidance/toolkit.hpp" #include "util/guidance/toolkit.hpp"

View File

@ -1,5 +1,5 @@
#include "extractor/guidance/constants.hpp"
#include "extractor/guidance/motorway_handler.hpp" #include "extractor/guidance/motorway_handler.hpp"
#include "extractor/guidance/constants.hpp"
#include "extractor/guidance/road_classification.hpp" #include "extractor/guidance/road_classification.hpp"
#include "extractor/guidance/toolkit.hpp" #include "extractor/guidance/toolkit.hpp"

View File

@ -1,6 +1,6 @@
#include "extractor/guidance/sliproad_handler.hpp"
#include "extractor/guidance/constants.hpp" #include "extractor/guidance/constants.hpp"
#include "extractor/guidance/intersection_scenario_three_way.hpp" #include "extractor/guidance/intersection_scenario_three_way.hpp"
#include "extractor/guidance/sliproad_handler.hpp"
#include "extractor/guidance/toolkit.hpp" #include "extractor/guidance/toolkit.hpp"
#include "util/guidance/toolkit.hpp" #include "util/guidance/toolkit.hpp"
@ -74,8 +74,7 @@ operator()(const NodeID, const EdgeID source_edge_id, Intersection intersection)
const auto check_valid = [this, source_edge_data](const ConnectedRoad &road) { const auto check_valid = [this, source_edge_data](const ConnectedRoad &road) {
const auto road_edge_data = node_based_graph.GetEdgeData(road.turn.eid); const auto road_edge_data = node_based_graph.GetEdgeData(road.turn.eid);
// Test to see if the source edge and the one we're looking at are the same road // Test to see if the source edge and the one we're looking at are the same road
return road_edge_data.road_classification == return road_edge_data.road_classification == source_edge_data.road_classification &&
source_edge_data.road_classification &&
road_edge_data.name_id != EMPTY_NAMEID && road_edge_data.name_id != EMPTY_NAMEID &&
road_edge_data.name_id == source_edge_data.name_id && road.entry_allowed; road_edge_data.name_id == source_edge_data.name_id && road.entry_allowed;
}; };
@ -143,8 +142,8 @@ operator()(const NodeID, const EdgeID source_edge_id, Intersection intersection)
} }
else else
{ {
const auto skip_traffic_light_intersection = const auto skip_traffic_light_intersection = intersection_generator(
intersection_generator(node_based_graph.GetTarget(candidate_in), candidate_road.turn.eid); node_based_graph.GetTarget(candidate_in), candidate_road.turn.eid);
if (skip_traffic_light_intersection.size() == 2 && if (skip_traffic_light_intersection.size() == 2 &&
node_based_graph.GetTarget( node_based_graph.GetTarget(
skip_traffic_light_intersection[1].turn.eid) == skip_traffic_light_intersection[1].turn.eid) ==

View File

@ -1,6 +1,6 @@
#include "extractor/guidance/road_classification.hpp"
#include "extractor/guidance/constants.hpp"
#include "extractor/guidance/turn_analysis.hpp" #include "extractor/guidance/turn_analysis.hpp"
#include "extractor/guidance/constants.hpp"
#include "extractor/guidance/road_classification.hpp"
#include "util/coordinate.hpp" #include "util/coordinate.hpp"
#include "util/coordinate_calculation.hpp" #include "util/coordinate_calculation.hpp"
@ -86,8 +86,7 @@ Intersection TurnAnalysis::assignTurnTypes(const NodeID from_nid,
intersection = sliproad_handler(from_nid, via_eid, std::move(intersection)); intersection = sliproad_handler(from_nid, via_eid, std::move(intersection));
// Turn On Ramps Into Off Ramps, if we come from a motorway-like road // Turn On Ramps Into Off Ramps, if we come from a motorway-like road
if (node_based_graph.GetEdgeData(via_eid) if (node_based_graph.GetEdgeData(via_eid).road_classification.IsMotorwayClass())
.road_classification.IsMotorwayClass())
{ {
std::for_each(intersection.begin(), intersection.end(), [](ConnectedRoad &road) { std::for_each(intersection.begin(), intersection.end(), [](ConnectedRoad &road) {
if (road.turn.instruction.type == TurnType::OnRamp) if (road.turn.instruction.type == TurnType::OnRamp)

View File

@ -1,7 +1,7 @@
#include "extractor/guidance/turn_handler.hpp"
#include "extractor/guidance/constants.hpp" #include "extractor/guidance/constants.hpp"
#include "extractor/guidance/intersection_scenario_three_way.hpp" #include "extractor/guidance/intersection_scenario_three_way.hpp"
#include "extractor/guidance/toolkit.hpp" #include "extractor/guidance/toolkit.hpp"
#include "extractor/guidance/turn_handler.hpp"
#include "util/guidance/toolkit.hpp" #include "util/guidance/toolkit.hpp"

View File

@ -268,7 +268,8 @@ LaneDataVector handleNoneValueAtSimpleTurn(LaneDataVector lane_data,
((intersection[0].entry_allowed && lane_data.back().tag != TurnLaneType::uturn) ? 1 : 0); ((intersection[0].entry_allowed && lane_data.back().tag != TurnLaneType::uturn) ? 1 : 0);
// TODO check for impossible turns to see whether the turn lane is at the correct place // TODO check for impossible turns to see whether the turn lane is at the correct place
const std::size_t none_index = std::distance(lane_data.begin(), findTag(TurnLaneType::none, lane_data)); const std::size_t none_index =
std::distance(lane_data.begin(), findTag(TurnLaneType::none, lane_data));
BOOST_ASSERT(none_index != lane_data.size()); BOOST_ASSERT(none_index != lane_data.size());
// we have to create multiple turns // we have to create multiple turns
if (connection_count > lane_data.size()) if (connection_count > lane_data.size())

View File

@ -1,7 +1,7 @@
#include "extractor/guidance/turn_lane_handler.hpp"
#include "extractor/guidance/constants.hpp" #include "extractor/guidance/constants.hpp"
#include "extractor/guidance/turn_discovery.hpp" #include "extractor/guidance/turn_discovery.hpp"
#include "extractor/guidance/turn_lane_augmentation.hpp" #include "extractor/guidance/turn_lane_augmentation.hpp"
#include "extractor/guidance/turn_lane_handler.hpp"
#include "extractor/guidance/turn_lane_matcher.hpp" #include "extractor/guidance/turn_lane_matcher.hpp"
#include "util/simple_logger.hpp" #include "util/simple_logger.hpp"
#include "util/typedefs.hpp" #include "util/typedefs.hpp"
@ -63,8 +63,8 @@ Intersection TurnLaneHandler::assignTurnLanes(const NodeID at,
Intersection intersection, Intersection intersection,
LaneDataIdMap &id_map) const LaneDataIdMap &id_map) const
{ {
//if only a uturn exists, there is nothing we can do // if only a uturn exists, there is nothing we can do
if( intersection.size() == 1 ) if (intersection.size() == 1)
return intersection; return intersection;
const auto &data = node_based_graph.GetEdgeData(via_edge); const auto &data = node_based_graph.GetEdgeData(via_edge);
@ -77,7 +77,9 @@ Intersection TurnLaneHandler::assignTurnLanes(const NodeID at,
turn_lane_masks.begin() + turn_lane_offsets[data.lane_description_id + 1]) turn_lane_masks.begin() + turn_lane_offsets[data.lane_description_id + 1])
: TurnLaneDescription(); : TurnLaneDescription();
BOOST_ASSERT( turn_lane_description.empty() || turn_lane_description.size() == (turn_lane_offsets[data.lane_description_id+1] - turn_lane_offsets[data.lane_description_id])); BOOST_ASSERT(turn_lane_description.empty() ||
turn_lane_description.size() == (turn_lane_offsets[data.lane_description_id + 1] -
turn_lane_offsets[data.lane_description_id]));
// going straight, due to traffic signals, we can have uncompressed geometry // going straight, due to traffic signals, we can have uncompressed geometry
if (intersection.size() == 2 && if (intersection.size() == 2 &&

View File

@ -1,5 +1,5 @@
#include "extractor/guidance/toolkit.hpp"
#include "extractor/guidance/turn_lane_matcher.hpp" #include "extractor/guidance/turn_lane_matcher.hpp"
#include "extractor/guidance/toolkit.hpp"
#include "util/guidance/toolkit.hpp" #include "util/guidance/toolkit.hpp"
#include <boost/assert.hpp> #include <boost/assert.hpp>

View File

@ -154,8 +154,9 @@ SourceContainer::GetRasterInterpolateFromSource(unsigned int source_id, double l
BOOST_ASSERT(lon > -180); BOOST_ASSERT(lon > -180);
const auto &found = LoadedSources[source_id]; const auto &found = LoadedSources[source_id];
return found.GetRasterInterpolate(static_cast<std::int32_t>(util::toFixed(util::FloatLongitude{lon})), return found.GetRasterInterpolate(
static_cast<std::int32_t>(util::toFixed(util::FloatLatitude{lat}))); static_cast<std::int32_t>(util::toFixed(util::FloatLongitude{lon})),
static_cast<std::int32_t>(util::toFixed(util::FloatLatitude{lat})));
} }
} }
} }

View File

@ -1,3 +1,4 @@
#include "storage/storage.hpp"
#include "contractor/query_edge.hpp" #include "contractor/query_edge.hpp"
#include "extractor/compressed_edge_container.hpp" #include "extractor/compressed_edge_container.hpp"
#include "extractor/guidance/turn_instruction.hpp" #include "extractor/guidance/turn_instruction.hpp"
@ -8,7 +9,6 @@
#include "storage/shared_barriers.hpp" #include "storage/shared_barriers.hpp"
#include "storage/shared_datatype.hpp" #include "storage/shared_datatype.hpp"
#include "storage/shared_memory.hpp" #include "storage/shared_memory.hpp"
#include "storage/storage.hpp"
#include "engine/datafacade/datafacade_base.hpp" #include "engine/datafacade/datafacade_base.hpp"
#include "util/coordinate.hpp" #include "util/coordinate.hpp"
#include "util/exception.hpp" #include "util/exception.hpp"
@ -375,7 +375,7 @@ int Storage::Run()
} }
std::uint64_t num_bearings; std::uint64_t num_bearings;
intersection_stream.read(reinterpret_cast<char*>(&num_bearings),sizeof(num_bearings)); intersection_stream.read(reinterpret_cast<char *>(&num_bearings), sizeof(num_bearings));
std::vector<DiscreteBearing> bearing_class_table(num_bearings); std::vector<DiscreteBearing> bearing_class_table(num_bearings);
intersection_stream.read(reinterpret_cast<char *>(&bearing_class_table[0]), intersection_stream.read(reinterpret_cast<char *>(&bearing_class_table[0]),

View File

@ -85,7 +85,7 @@ return_code parseArguments(int argc, char *argv[], contractor::ContractorConfig
.run(), .run(),
option_variables); option_variables);
} }
catch(boost::program_options::error& e) catch (boost::program_options::error &e)
{ {
util::SimpleLogger().Write(logWARNING) << "[error] " << e.what(); util::SimpleLogger().Write(logWARNING) << "[error] " << e.what();
return return_code::fail; return return_code::fail;

View File

@ -130,7 +130,7 @@ inline unsigned generateServerProgramOptions(const int argc,
.run(), .run(),
option_variables); option_variables);
} }
catch(boost::program_options::error& e) catch (boost::program_options::error &e)
{ {
util::SimpleLogger().Write(logWARNING) << "[error] " << e.what(); util::SimpleLogger().Write(logWARNING) << "[error] " << e.what();
return INIT_FAILED; return INIT_FAILED;

View File

@ -284,8 +284,10 @@ Coordinate interpolateLinear(double factor, const Coordinate from, const Coordin
const auto to_lon = static_cast<std::int32_t>(to.lon); const auto to_lon = static_cast<std::int32_t>(to.lon);
const auto to_lat = static_cast<std::int32_t>(to.lat); const auto to_lat = static_cast<std::int32_t>(to.lat);
FixedLongitude interpolated_lon{static_cast<std::int32_t>(from_lon + factor * (to_lon - from_lon))}; FixedLongitude interpolated_lon{
FixedLatitude interpolated_lat{static_cast<std::int32_t>(from_lat + factor * (to_lat - from_lat))}; static_cast<std::int32_t>(from_lon + factor * (to_lon - from_lon))};
FixedLatitude interpolated_lat{
static_cast<std::int32_t>(from_lat + factor * (to_lat - from_lat))};
return {std::move(interpolated_lon), std::move(interpolated_lat)}; return {std::move(interpolated_lon), std::move(interpolated_lat)};
} }

View File

@ -19,7 +19,7 @@ BOOST_AUTO_TEST_CASE(insert_and_retrieve_packed_test)
for (std::size_t i = 0; i < num_test_cases; i++) for (std::size_t i = 0; i < num_test_cases; i++)
{ {
OSMNodeID r {static_cast<std::uint64_t>(rand() % 2147483647)}; // max 33-bit uint OSMNodeID r{static_cast<std::uint64_t>(rand() % 2147483647)}; // max 33-bit uint
packed_ids.push_back(r); packed_ids.push_back(r);
original_ids.push_back(r); original_ids.push_back(r);