Use driving_side tag of location-dependent data and OSM ways

This commit is contained in:
Michael Krasnyk 2017-08-07 23:39:34 +02:00
parent c9673741de
commit af3f0a4782
8 changed files with 55 additions and 25 deletions

View File

@ -61,6 +61,7 @@ struct ExtractionWay
road_classification = guidance::RoadClassification();
backward_restricted = false;
forward_restricted = false;
is_left_hand_driving = false;
}
// wrappers to allow assigning nil (nullptr) to string values
@ -114,6 +115,7 @@ struct ExtractionWay
bool is_startpoint : 1;
bool forward_restricted : 1;
bool backward_restricted : 1;
bool is_left_hand_driving : 1;
};
}
}

View File

@ -70,6 +70,7 @@ struct InternalExtractorEdge
false, // circular
true, // can be startpoint
false, // local access only
false, // is_left_hand_driving
false, // split edge
TRAVEL_MODE_INACCESSIBLE,
0,
@ -90,6 +91,7 @@ struct InternalExtractorEdge
bool circular,
bool startpoint,
bool restricted,
bool is_left_hand_driving,
bool is_split,
TravelMode travel_mode,
ClassData classes,
@ -107,6 +109,7 @@ struct InternalExtractorEdge
circular,
startpoint,
restricted,
is_left_hand_driving,
is_split,
travel_mode,
classes,
@ -140,6 +143,7 @@ struct InternalExtractorEdge
false, // circular
true, // can be startpoint
false, // local access only
false, // is_left_hand_driving
false, // split edge
TRAVEL_MODE_INACCESSIBLE,
0,
@ -160,6 +164,7 @@ struct InternalExtractorEdge
false, // circular
true, // can be startpoint
false, // local access only
false, // is_left_hand_driving
false, // split edge
TRAVEL_MODE_INACCESSIBLE,
0,

View File

@ -27,6 +27,7 @@ struct NodeBasedEdge
bool circular,
bool startpoint,
bool restricted,
bool is_left_hand_driving,
bool is_split,
TravelMode travel_mode,
ClassData classes,
@ -46,6 +47,7 @@ struct NodeBasedEdge
std::uint8_t circular : 1; // 1
std::uint8_t startpoint : 1; // 1
std::uint8_t restricted : 1; // 1
std::uint8_t is_left_hand_driving : 1; // 1
std::uint8_t is_split : 1; // 1
TravelMode travel_mode : 4; // 4
ClassData classes; // 8 1
@ -66,6 +68,7 @@ struct NodeBasedEdgeWithOSM : NodeBasedEdge
bool circular,
bool startpoint,
bool restricted,
bool is_left_hand_driving,
bool is_split,
TravelMode travel_mode,
ClassData classes,
@ -81,8 +84,8 @@ struct NodeBasedEdgeWithOSM : NodeBasedEdge
inline NodeBasedEdge::NodeBasedEdge()
: source(SPECIAL_NODEID), target(SPECIAL_NODEID), name_id(0), weight(0), duration(0),
forward(false), backward(false), roundabout(false), circular(false), startpoint(true),
restricted(false), is_split(false), travel_mode(TRAVEL_MODE_INACCESSIBLE),
lane_description_id(INVALID_LANE_DESCRIPTIONID)
restricted(false), is_left_hand_driving(false), is_split(false),
travel_mode(TRAVEL_MODE_INACCESSIBLE), lane_description_id(INVALID_LANE_DESCRIPTIONID)
{
}
@ -97,6 +100,7 @@ inline NodeBasedEdge::NodeBasedEdge(NodeID source,
bool circular,
bool startpoint,
bool restricted,
bool is_left_hand_driving,
bool is_split,
TravelMode travel_mode,
ClassData classes,
@ -104,9 +108,9 @@ inline NodeBasedEdge::NodeBasedEdge(NodeID source,
guidance::RoadClassification road_classification)
: source(source), target(target), name_id(name_id), weight(weight), duration(duration),
forward(forward), backward(backward), roundabout(roundabout), circular(circular),
startpoint(startpoint), restricted(restricted), is_split(is_split), travel_mode(travel_mode),
classes(classes), lane_description_id(lane_description_id),
road_classification(std::move(road_classification))
startpoint(startpoint), restricted(restricted), is_left_hand_driving(is_left_hand_driving),
is_split(is_split), travel_mode(travel_mode), classes(classes),
lane_description_id(lane_description_id), road_classification(std::move(road_classification))
{
}
@ -138,6 +142,7 @@ inline NodeBasedEdgeWithOSM::NodeBasedEdgeWithOSM(OSMNodeID source,
bool circular,
bool startpoint,
bool restricted,
bool is_left_hand_driving,
bool is_split,
TravelMode travel_mode,
ClassData classes,
@ -154,6 +159,7 @@ inline NodeBasedEdgeWithOSM::NodeBasedEdgeWithOSM(OSMNodeID source,
circular,
startpoint,
restricted,
is_left_hand_driving,
is_split,
travel_mode,
classes,

View File

@ -21,8 +21,8 @@ struct NodeBasedEdgeData
NodeBasedEdgeData()
: weight(INVALID_EDGE_WEIGHT), duration(INVALID_EDGE_WEIGHT), edge_id(SPECIAL_NODEID),
name_id(std::numeric_limits<unsigned>::max()), reversed(false), roundabout(false),
circular(false), travel_mode(TRAVEL_MODE_INACCESSIBLE),
lane_description_id(INVALID_LANE_DESCRIPTIONID)
circular(false), startpoint(false), restricted(false), is_left_hand_driving(false),
travel_mode(TRAVEL_MODE_INACCESSIBLE), lane_description_id(INVALID_LANE_DESCRIPTIONID)
{
}
@ -35,13 +35,14 @@ struct NodeBasedEdgeData
bool circular,
bool startpoint,
bool restricted,
bool is_left_hand_driving,
extractor::TravelMode travel_mode,
extractor::ClassData classes,
const LaneDescriptionID lane_description_id)
: weight(weight), duration(duration), edge_id(edge_id), name_id(name_id),
reversed(reversed), roundabout(roundabout), circular(circular), startpoint(startpoint),
restricted(restricted), travel_mode(travel_mode), classes(classes),
lane_description_id(lane_description_id)
restricted(restricted), is_left_hand_driving(is_left_hand_driving),
travel_mode(travel_mode), classes(classes), lane_description_id(lane_description_id)
{
}
@ -54,6 +55,7 @@ struct NodeBasedEdgeData
bool circular : 1;
bool startpoint : 1;
bool restricted : 1;
bool is_left_hand_driving : 1;
extractor::TravelMode travel_mode : 4;
extractor::ClassData classes;
LaneDescriptionID lane_description_id;
@ -65,7 +67,8 @@ struct NodeBasedEdgeData
(circular == other.circular) && (startpoint == other.startpoint) &&
(travel_mode == other.travel_mode) && (classes == other.classes) &&
(road_classification == other.road_classification) &&
(restricted == other.restricted);
(restricted == other.restricted) &&
(is_left_hand_driving == other.is_left_hand_driving);
}
bool CanCombineWith(const NodeBasedEdgeData &other) const
@ -96,6 +99,7 @@ NodeBasedDynamicGraphFromEdges(NodeID number_of_nodes,
output_edge.data.classes = input_edge.classes;
output_edge.data.startpoint = input_edge.startpoint;
output_edge.data.restricted = input_edge.restricted;
output_edge.data.is_left_hand_driving = input_edge.is_left_hand_driving;
output_edge.data.road_classification = input_edge.road_classification;
output_edge.data.lane_description_id = input_edge.lane_description_id;

View File

@ -406,6 +406,7 @@ void ExtractorCallbacks::ProcessWay(const osmium::Way &input_way, const Extracti
parsed_way.circular,
parsed_way.is_startpoint,
parsed_way.forward_restricted,
parsed_way.is_left_hand_driving,
split_edge,
parsed_way.forward_travel_mode,
forward_classes,
@ -433,6 +434,7 @@ void ExtractorCallbacks::ProcessWay(const osmium::Way &input_way, const Extracti
parsed_way.circular,
parsed_way.is_startpoint,
parsed_way.backward_restricted,
parsed_way.is_left_hand_driving,
split_edge,
parsed_way.backward_travel_mode,
backward_classes,

View File

@ -401,7 +401,10 @@ void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context)
[](ExtractionWay &way, bool flag) { way.forward_restricted = flag; }),
"backward_restricted",
sol::property([](const ExtractionWay &way) { return way.backward_restricted; },
[](ExtractionWay &way, bool flag) { way.backward_restricted = flag; }));
[](ExtractionWay &way, bool flag) { way.backward_restricted = flag; }),
"is_left_hand_driving",
sol::property([](const ExtractionWay &way) { return way.is_left_hand_driving; },
[](ExtractionWay &way, bool flag) { way.is_left_hand_driving = flag; }));
context.state.new_usertype<ExtractionRelation>(
"ExtractionRelation",

View File

@ -268,6 +268,11 @@
"object_types": [ "way" ],
"description": "Name of road for navigation instructions."
},
{
"key": "driving_side",
"object_types": [ "way" ],
"description": "Driving side in all bidirectional traffic."
},
{
"key": "turn:lanes",
"object_types": [ "way" ],

View File

@ -28,20 +28,23 @@ inline InputEdge MakeUnitEdge(const NodeID from, const NodeID to)
{
// src, tgt, dist, edge_id, name_id, fwd, bkwd, roundabout, circular, startpoint, local access,
// split edge, travel_mode
return {from,
to,
1,
SPECIAL_EDGEID,
0,
0,
false,
false,
false,
false,
true,
TRAVEL_MODE_INACCESSIBLE,
0,
INVALID_LANE_DESCRIPTIONID};
return {
from, // source
to, // target
1, // weight
1, // duration
SPECIAL_EDGEID, // edge_id
0, // name_id
false, // reversed
false, // roundabout
false, // circular
false, // startpoint
false, // is_left_hand_driving
true, // split edge
TRAVEL_MODE_INACCESSIBLE, // travel_mode
0, // classes
INVALID_LANE_DESCRIPTIONID // lane_description_id
};
}
} // namespace