rename contra_flow to travel_mode, use unsigned char

This commit is contained in:
Emil Tin 2014-08-09 11:23:41 +02:00
parent 82c2ae5441
commit 3e6f27d173
7 changed files with 22 additions and 21 deletions

View File

@ -718,11 +718,11 @@ TurnInstruction EdgeBasedGraphFactory::AnalyzeTurn(const NodeID node_u,
const EdgeData &data1 = m_node_based_graph->GetEdgeData(edge1);
const EdgeData &data2 = m_node_based_graph->GetEdgeData(edge2);
if (!data1.contraFlow && data2.contraFlow)
if (!data1.travel_mode && data2.travel_mode)
{
return TurnInstruction::EnterAgainstAllowedDirection;
}
if (data1.contraFlow && !data2.contraFlow)
if (data1.travel_mode && !data2.travel_mode)
{
return TurnInstruction::LeaveAgainstAllowedDirection;
}

View File

@ -56,11 +56,11 @@ NodeBasedEdge::NodeBasedEdge(NodeID source,
bool roundabout,
bool in_tiny_cc,
bool access_restricted,
bool contra_flow,
TravelMode travel_mode,
bool is_split)
: source(source), target(target), name_id(name_id), weight(weight), type(type),
forward(forward), backward(backward), roundabout(roundabout), in_tiny_cc(in_tiny_cc),
access_restricted(access_restricted), contra_flow(contra_flow), is_split(is_split)
access_restricted(access_restricted), travel_mode(travel_mode), is_split(is_split)
{
BOOST_ASSERT_MSG(type > 0, "negative edge type");
}

View File

@ -44,7 +44,7 @@ struct NodeBasedEdge
bool roundabout,
bool in_tiny_cc,
bool access_restricted,
bool contra_flow,
TravelMode travel_mode,
bool is_split);
NodeID source;
@ -57,7 +57,7 @@ struct NodeBasedEdge
bool roundabout : 1;
bool in_tiny_cc : 1;
bool access_restricted : 1;
bool contra_flow : 1;
TravelMode travel_mode : 1;
bool is_split : 1;
NodeBasedEdge() = delete;

View File

@ -15,7 +15,7 @@ struct NodeBasedEdgeData
: distance(INVALID_EDGE_WEIGHT), edgeBasedNodeID(SPECIAL_NODEID),
nameID(std::numeric_limits<unsigned>::max()), type(std::numeric_limits<short>::max()),
isAccessRestricted(false), shortcut(false), forward(false), backward(false),
roundabout(false), ignore_in_grid(false), contraFlow(false)
roundabout(false), ignore_in_grid(false), travel_mode(false)
{
}
@ -29,7 +29,7 @@ struct NodeBasedEdgeData
bool backward : 1;
bool roundabout : 1;
bool ignore_in_grid : 1;
bool contraFlow : 1;
TravelMode travel_mode : 1;
void SwapDirectionFlags()
{
@ -42,7 +42,7 @@ struct NodeBasedEdgeData
{
return (forward == other.forward) && (backward == other.backward) &&
(nameID == other.nameID) && (ignore_in_grid == other.ignore_in_grid) &&
(contraFlow == other.contraFlow);
(travel_mode == other.travel_mode);
}
};
@ -93,7 +93,7 @@ NodeBasedDynamicGraphFromImportEdges(int number_of_nodes, std::vector<ImportEdge
edge.data.nameID = import_edge.name_id;
edge.data.type = import_edge.type;
edge.data.isAccessRestricted = import_edge.access_restricted;
edge.data.contraFlow = import_edge.contra_flow;
edge.data.travel_mode = import_edge.travel_mode;
edges_list.push_back(edge);
if (!import_edge.is_split)

View File

@ -376,7 +376,7 @@ void ExtractionContainers::PrepareData(const std::string &output_file_name,
file_out_stream.write((char *)&edge_iterator->is_roundabout, sizeof(bool));
file_out_stream.write((char *)&edge_iterator->is_in_tiny_cc, sizeof(bool));
file_out_stream.write((char *)&edge_iterator->is_access_restricted, sizeof(bool));
file_out_stream.write((char *)&edge_iterator->is_contra_flow, sizeof(bool));
file_out_stream.write((char *)&edge_iterator->travel_mode, sizeof(TravelMode));
file_out_stream.write((char *)&edge_iterator->is_split, sizeof(bool));
++number_of_used_edges;
}

View File

@ -38,7 +38,7 @@ struct InternalExtractorEdge
InternalExtractorEdge()
: start(0), target(0), type(0), direction(0), speed(0), name_id(0), is_roundabout(false),
is_in_tiny_cc(false), is_duration_set(false), is_access_restricted(false),
is_contra_flow(false), is_split(false)
travel_mode(0), is_split(false)
{
}
@ -52,12 +52,12 @@ struct InternalExtractorEdge
bool is_in_tiny_cc,
bool is_duration_set,
bool is_access_restricted,
bool is_contra_flow,
TravelMode travel_mode,
bool is_split)
: start(start), target(target), type(type), direction(direction), speed(speed),
name_id(name_id), is_roundabout(is_roundabout), is_in_tiny_cc(is_in_tiny_cc),
is_duration_set(is_duration_set), is_access_restricted(is_access_restricted),
is_contra_flow(is_contra_flow), is_split(is_split)
travel_mode(travel_mode), is_split(is_split)
{
BOOST_ASSERT(0 <= type);
}
@ -83,7 +83,7 @@ struct InternalExtractorEdge
bool is_in_tiny_cc;
bool is_duration_set;
bool is_access_restricted;
bool is_contra_flow;
TravelMode travel_mode;
bool is_split;
FixedPointCoordinate source_coordinate;

View File

@ -129,8 +129,8 @@ NodeID readBinaryOSRMGraphFromStream(std::istream &input_stream,
short type;
NodeID nameID;
int length;
bool is_roundabout, ignore_in_grid, is_access_restricted, is_contra_flow, is_split;
bool is_roundabout, ignore_in_grid, is_access_restricted, is_split;
TravelMode travel_mode;
for (EdgeID i = 0; i < m; ++i)
{
input_stream.read((char *)&source, sizeof(unsigned));
@ -143,7 +143,7 @@ NodeID readBinaryOSRMGraphFromStream(std::istream &input_stream,
input_stream.read((char *)&is_roundabout, sizeof(bool));
input_stream.read((char *)&ignore_in_grid, sizeof(bool));
input_stream.read((char *)&is_access_restricted, sizeof(bool));
input_stream.read((char *)&is_contra_flow, sizeof(bool));
input_stream.read((char *)&travel_mode, sizeof(TravelMode));
input_stream.read((char *)&is_split, sizeof(bool));
BOOST_ASSERT_MSG(length > 0, "loaded null length edge");
@ -200,7 +200,7 @@ NodeID readBinaryOSRMGraphFromStream(std::istream &input_stream,
is_roundabout,
ignore_in_grid,
is_access_restricted,
is_contra_flow,
travel_mode,
is_split);
}
@ -306,7 +306,8 @@ NodeID readBinaryOSRMGraphFromStream(std::istream &input_stream,
short type;
NodeID nameID;
int length;
bool is_roundabout, ignore_in_grid, is_access_restricted, is_contra_flow, is_split;
bool is_roundabout, ignore_in_grid, is_access_restricted, is_split;
TravelMode travel_mode;
for (EdgeID i = 0; i < m; ++i)
{
@ -320,7 +321,7 @@ NodeID readBinaryOSRMGraphFromStream(std::istream &input_stream,
input_stream.read((char *)&is_roundabout, sizeof(bool));
input_stream.read((char *)&ignore_in_grid, sizeof(bool));
input_stream.read((char *)&is_access_restricted, sizeof(bool));
input_stream.read((char *)&is_contra_flow, sizeof(bool));
input_stream.read((char *)&travel_mode, sizeof(TravelMode));
input_stream.read((char *)&is_split, sizeof(bool));
BOOST_ASSERT_MSG(length > 0, "loaded null length edge");