pass flags into process_segment
This commit is contained in:
parent
8ef366e061
commit
5554af6e4a
@ -12,9 +12,10 @@ struct ExtractionSegment
|
|||||||
const osrm::util::Coordinate target_,
|
const osrm::util::Coordinate target_,
|
||||||
double distance_,
|
double distance_,
|
||||||
double weight_,
|
double weight_,
|
||||||
double duration_)
|
double duration_,
|
||||||
|
const osrm::extractor::NodeBasedEdgeClassification flags_)
|
||||||
: source(source_), target(target_), distance(distance_), weight(weight_),
|
: source(source_), target(target_), distance(distance_), weight(weight_),
|
||||||
duration(duration_)
|
duration(duration_), flags(flags_)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23,6 +24,7 @@ struct ExtractionSegment
|
|||||||
const double distance;
|
const double distance;
|
||||||
double weight;
|
double weight;
|
||||||
double duration;
|
double duration;
|
||||||
|
const osrm::extractor::NodeBasedEdgeClassification flags;
|
||||||
};
|
};
|
||||||
} // namespace osrm::extractor
|
} // namespace osrm::extractor
|
||||||
|
|
||||||
|
|||||||
@ -706,7 +706,7 @@ void ExtractionContainers::PrepareEdges(ScriptingEnvironment &scripting_environm
|
|||||||
const auto accurate_distance =
|
const auto accurate_distance =
|
||||||
util::coordinate_calculation::greatCircleDistance(source_coord, target_coord);
|
util::coordinate_calculation::greatCircleDistance(source_coord, target_coord);
|
||||||
|
|
||||||
ExtractionSegment segment(source_coord, target_coord, distance, weight, duration);
|
ExtractionSegment segment(source_coord, target_coord, distance, weight, duration, edge_iterator->result.flags);
|
||||||
scripting_environment.ProcessSegment(segment);
|
scripting_environment.ProcessSegment(segment);
|
||||||
|
|
||||||
auto &edge = edge_iterator->result;
|
auto &edge = edge_iterator->result;
|
||||||
|
|||||||
@ -471,6 +471,30 @@ void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context)
|
|||||||
[](ExtractionRelationContainer &cont, const ExtractionRelation::OsmIDTyped &rel_id)
|
[](ExtractionRelationContainer &cont, const ExtractionRelation::OsmIDTyped &rel_id)
|
||||||
-> const ExtractionRelation & { return cont.GetRelationData(rel_id); });
|
-> const ExtractionRelation & { return cont.GetRelationData(rel_id); });
|
||||||
|
|
||||||
|
context.state.new_usertype<NodeBasedEdgeClassification>("NodeBasedEdgeClassification",
|
||||||
|
"forward",
|
||||||
|
// can't just do &NodeBasedEdgeClassification::forward with bitfields
|
||||||
|
sol::property([](NodeBasedEdgeClassification &c) -> bool { return c.forward; }),
|
||||||
|
"backward",
|
||||||
|
sol::property([](NodeBasedEdgeClassification &c) -> bool { return c.backward; }),
|
||||||
|
"is_split",
|
||||||
|
sol::property([](NodeBasedEdgeClassification &c) -> bool { return c.is_split; }),
|
||||||
|
"roundabout",
|
||||||
|
sol::property([](NodeBasedEdgeClassification &c) -> bool { return c.roundabout; }),
|
||||||
|
"circular",
|
||||||
|
sol::property([](NodeBasedEdgeClassification &c) -> bool { return c.circular; }),
|
||||||
|
"startpoint",
|
||||||
|
sol::property([](NodeBasedEdgeClassification &c) -> bool { return c.startpoint; }),
|
||||||
|
"restricted",
|
||||||
|
sol::property([](NodeBasedEdgeClassification &c) -> bool { return c.restricted; }),
|
||||||
|
"road_classification",
|
||||||
|
sol::property([](NodeBasedEdgeClassification &c) -> RoadClassification { return c.road_classification; }),
|
||||||
|
"highway_turn_classification",
|
||||||
|
sol::property([](NodeBasedEdgeClassification &c) -> uint8_t { return c.highway_turn_classification; }),
|
||||||
|
"access_turn_classification",
|
||||||
|
sol::property([](NodeBasedEdgeClassification &c) -> uint8_t { return c.access_turn_classification; })
|
||||||
|
);
|
||||||
|
|
||||||
context.state.new_usertype<ExtractionSegment>("ExtractionSegment",
|
context.state.new_usertype<ExtractionSegment>("ExtractionSegment",
|
||||||
"source",
|
"source",
|
||||||
&ExtractionSegment::source,
|
&ExtractionSegment::source,
|
||||||
@ -481,7 +505,10 @@ void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context)
|
|||||||
"weight",
|
"weight",
|
||||||
&ExtractionSegment::weight,
|
&ExtractionSegment::weight,
|
||||||
"duration",
|
"duration",
|
||||||
&ExtractionSegment::duration);
|
&ExtractionSegment::duration,
|
||||||
|
"flags",
|
||||||
|
&ExtractionSegment::flags);
|
||||||
|
|
||||||
|
|
||||||
// Keep in mind .location is available only if .pbf is preprocessed to set the location with the
|
// Keep in mind .location is available only if .pbf is preprocessed to set the location with the
|
||||||
// ref using osmium command "osmium add-locations-to-ways"
|
// ref using osmium command "osmium add-locations-to-ways"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user