Propagate is_left_hand_driving from profile to data facade
This commit is contained in:
@@ -362,11 +362,18 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
||||
util::vector_view<extractor::ClassData> classes(
|
||||
classes_list_ptr, layout.num_entries[storage::DataLayout::CLASSES_LIST]);
|
||||
|
||||
auto is_left_hand_driving_ptr = layout.GetBlockPtr<unsigned>(
|
||||
memory_ptr, storage::DataLayout::IS_LEFT_HAND_DRIVING_LIST);
|
||||
util::vector_view<bool> is_left_hand_driving(
|
||||
is_left_hand_driving_ptr,
|
||||
layout.num_entries[storage::DataLayout::IS_LEFT_HAND_DRIVING_LIST]);
|
||||
|
||||
edge_based_node_data = extractor::EdgeBasedNodeDataView(std::move(geometry_ids),
|
||||
std::move(name_ids),
|
||||
std::move(component_ids),
|
||||
std::move(travel_modes),
|
||||
std::move(classes));
|
||||
std::move(classes),
|
||||
std::move(is_left_hand_driving));
|
||||
}
|
||||
|
||||
void InitializeEdgeInformationPointers(storage::DataLayout &layout, char *memory_ptr)
|
||||
@@ -939,9 +946,10 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
||||
m_lane_description_offsets[lane_description_id + 1]);
|
||||
}
|
||||
|
||||
bool IsLeftHandDriving() const override final
|
||||
bool IsLeftHandDriving(const NodeID id) const override final
|
||||
{
|
||||
return m_profile_properties->left_hand_driving; // TODO: remove
|
||||
// TODO: can be moved to a data block indexed by GeometryID
|
||||
return edge_based_node_data.IsLeftHandDriving(id);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -190,7 +190,7 @@ class BaseDataFacade
|
||||
|
||||
virtual util::guidance::EntryClass GetEntryClass(const EdgeID turn_id) const = 0;
|
||||
|
||||
virtual bool IsLeftHandDriving() const = 0;
|
||||
virtual bool IsLeftHandDriving(const NodeID id) const = 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -650,7 +650,7 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
|
||||
bool input_coordinate_is_at_right = !util::coordinate_calculation::isCCW(
|
||||
coordinates[segment.data.u], coordinates[segment.data.v], input_coordinate);
|
||||
|
||||
if (datafacade.IsLeftHandDriving())
|
||||
if (datafacade.IsLeftHandDriving(segment.data.forward_segment_id.id))
|
||||
input_coordinate_is_at_right = !input_coordinate_is_at_right;
|
||||
|
||||
return std::make_pair(input_coordinate_is_at_right, (!input_coordinate_is_at_right));
|
||||
|
||||
@@ -42,7 +42,8 @@ template <storage::Ownership Ownership> class EdgeBasedNodeDataContainerImpl
|
||||
EdgeBasedNodeDataContainerImpl() = default;
|
||||
|
||||
EdgeBasedNodeDataContainerImpl(std::size_t size)
|
||||
: geometry_ids(size), name_ids(size), component_ids(size), travel_modes(size), classes(size)
|
||||
: geometry_ids(size), name_ids(size), component_ids(size), travel_modes(size),
|
||||
classes(size), is_left_hand_driving(size)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -50,10 +51,11 @@ template <storage::Ownership Ownership> class EdgeBasedNodeDataContainerImpl
|
||||
Vector<NameID> name_ids,
|
||||
Vector<ComponentID> component_ids,
|
||||
Vector<TravelMode> travel_modes,
|
||||
Vector<ClassData> classes)
|
||||
Vector<ClassData> classes,
|
||||
Vector<bool> is_left_hand_driving)
|
||||
: geometry_ids(std::move(geometry_ids)), name_ids(std::move(name_ids)),
|
||||
component_ids(std::move(component_ids)), travel_modes(std::move(travel_modes)),
|
||||
classes(std::move(classes))
|
||||
classes(std::move(classes)), is_left_hand_driving(std::move(is_left_hand_driving))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -67,18 +69,25 @@ template <storage::Ownership Ownership> class EdgeBasedNodeDataContainerImpl
|
||||
|
||||
ClassData GetClassData(const NodeID node_id) const { return classes[node_id]; }
|
||||
|
||||
ClassData IsLeftHandDriving(const NodeID node_id) const
|
||||
{
|
||||
return is_left_hand_driving[node_id];
|
||||
}
|
||||
|
||||
// Used by EdgeBasedGraphFactory to fill data structure
|
||||
template <typename = std::enable_if<Ownership == storage::Ownership::Container>>
|
||||
void SetData(NodeID node_id,
|
||||
GeometryID geometry_id,
|
||||
NameID name_id,
|
||||
TravelMode travel_mode,
|
||||
ClassData class_data)
|
||||
ClassData class_data,
|
||||
bool is_left_hand_driving_flag)
|
||||
{
|
||||
geometry_ids[node_id] = geometry_id;
|
||||
name_ids[node_id] = name_id;
|
||||
travel_modes[node_id] = travel_mode;
|
||||
classes[node_id] = class_data;
|
||||
is_left_hand_driving[node_id] = is_left_hand_driving_flag;
|
||||
}
|
||||
|
||||
// Used by EdgeBasedGraphFactory to fill data structure
|
||||
@@ -102,6 +111,8 @@ template <storage::Ownership Ownership> class EdgeBasedNodeDataContainerImpl
|
||||
util::inplacePermutation(component_ids.begin(), component_ids.end(), permutation);
|
||||
util::inplacePermutation(travel_modes.begin(), travel_modes.end(), permutation);
|
||||
util::inplacePermutation(classes.begin(), classes.end(), permutation);
|
||||
util::inplacePermutation(
|
||||
is_left_hand_driving.begin(), is_left_hand_driving.end(), permutation);
|
||||
}
|
||||
|
||||
// all containers have the exact same size
|
||||
@@ -111,6 +122,7 @@ template <storage::Ownership Ownership> class EdgeBasedNodeDataContainerImpl
|
||||
BOOST_ASSERT(geometry_ids.size() == component_ids.size());
|
||||
BOOST_ASSERT(geometry_ids.size() == travel_modes.size());
|
||||
BOOST_ASSERT(geometry_ids.size() == classes.size());
|
||||
BOOST_ASSERT(geometry_ids.size() == is_left_hand_driving.size());
|
||||
return geometry_ids.size();
|
||||
}
|
||||
|
||||
@@ -120,6 +132,7 @@ template <storage::Ownership Ownership> class EdgeBasedNodeDataContainerImpl
|
||||
Vector<ComponentID> component_ids;
|
||||
Vector<TravelMode> travel_modes;
|
||||
Vector<ClassData> classes;
|
||||
Vector<bool> is_left_hand_driving;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -125,6 +125,7 @@ inline void read(storage::io::FileReader &reader,
|
||||
storage::serialization::read(reader, node_data_container.component_ids);
|
||||
storage::serialization::read(reader, node_data_container.travel_modes);
|
||||
storage::serialization::read(reader, node_data_container.classes);
|
||||
storage::serialization::read(reader, node_data_container.is_left_hand_driving);
|
||||
}
|
||||
|
||||
template <storage::Ownership Ownership>
|
||||
@@ -136,6 +137,7 @@ inline void write(storage::io::FileWriter &writer,
|
||||
storage::serialization::write(writer, node_data_container.component_ids);
|
||||
storage::serialization::write(writer, node_data_container.travel_modes);
|
||||
storage::serialization::write(writer, node_data_container.classes);
|
||||
storage::serialization::write(writer, node_data_container.is_left_hand_driving);
|
||||
}
|
||||
|
||||
inline void read(storage::io::FileReader &reader, NodeRestriction &restriction)
|
||||
|
||||
@@ -137,7 +137,7 @@ template <> inline void write<bool>(io::FileWriter &writer, const util::vector_v
|
||||
template <> inline void read<bool>(io::FileReader &reader, std::vector<bool> &data)
|
||||
{
|
||||
const auto count = reader.ReadElementCount64();
|
||||
BOOST_ASSERT(data.size() == count);
|
||||
data.resize(count);
|
||||
for (const auto index : util::irange<std::uint64_t>(0, count))
|
||||
{
|
||||
data[index] = reader.ReadOne<bool>();
|
||||
|
||||
@@ -24,6 +24,7 @@ const constexpr char *block_id_to_name[] = {"NAME_CHAR_DATA",
|
||||
"COMPONENT_ID_LIST",
|
||||
"TRAVEL_MODE_LIST",
|
||||
"CLASSES_LIST",
|
||||
"IS_LEFT_HAND_DRIVING_LIST",
|
||||
"CH_GRAPH_NODE_LIST",
|
||||
"CH_GRAPH_EDGE_LIST",
|
||||
"CH_EDGE_FILTER_0",
|
||||
@@ -111,6 +112,7 @@ struct DataLayout
|
||||
COMPONENT_ID_LIST,
|
||||
TRAVEL_MODE_LIST,
|
||||
CLASSES_LIST,
|
||||
IS_LEFT_HAND_DRIVING_LIST,
|
||||
CH_GRAPH_NODE_LIST,
|
||||
CH_GRAPH_EDGE_LIST,
|
||||
CH_EDGE_FILTER_0,
|
||||
|
||||
Reference in New Issue
Block a user