MCPcopy Create free account
hub / github.com/Project-OSRM/osrm-backend / ProcessElements

Method ProcessElements

src/extractor/scripting_environment_lua.cpp:1034–1096  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1032}
1033
1034void Sol2ScriptingEnvironment::ProcessElements(
1035 const osmium::memory::Buffer &buffer,
1036 const RestrictionParser &restriction_parser,
1037 const ManeuverOverrideRelationParser &maneuver_override_parser,
1038 const ExtractionRelationContainer &relations,
1039 std::vector<std::pair<const osmium::Node &, ExtractionNode>> &resulting_nodes,
1040 std::vector<std::pair<const osmium::Way &, ExtractionWay>> &resulting_ways,
1041 std::vector<InputTurnRestriction> &resulting_restrictions,
1042 std::vector<InputManeuverOverride> &resulting_maneuver_overrides)
1043{
1044 ExtractionNode result_node;
1045 ExtractionWay result_way;
1046 auto &local_context = this->GetSol2Context();
1047
1048 for (auto entity = buffer.cbegin(), end = buffer.cend(); entity != end; ++entity)
1049 {
1050 switch (entity->type())
1051 {
1052 case osmium::item_type::node:
1053 {
1054 const auto &node = static_cast<const osmium::Node &>(*entity);
1055 result_node.node = &node;
1056 if (local_context.has_node_function &&
1057 (!node.tags().empty() || local_context.properties.call_tagless_node_function))
1058 {
1059 local_context.ProcessNode(node, result_node, relations);
1060 }
1061 result_node.node = nullptr;
1062 resulting_nodes.push_back({node, result_node});
1063 }
1064 break;
1065 case osmium::item_type::way:
1066 {
1067 const osmium::Way &way = static_cast<const osmium::Way &>(*entity);
1068 // NOLINTNEXTLINE(bugprone-use-after-move)
1069 result_way.clear();
1070 if (local_context.has_way_function)
1071 {
1072 local_context.ProcessWay(way, result_way, relations);
1073 }
1074 resulting_ways.push_back({way, std::move(result_way)});
1075 }
1076 break;
1077 case osmium::item_type::relation:
1078 {
1079 const auto &relation = static_cast<const osmium::Relation &>(*entity);
1080 auto results = restriction_parser.TryParse(relation);
1081 if (!results.empty())
1082 {
1083 std::move(
1084 results.begin(), results.end(), std::back_inserter(resulting_restrictions));
1085 }
1086 else if (auto result_res = maneuver_override_parser.TryParse(relation))
1087 {
1088 resulting_maneuver_overrides.push_back(std::move(*result_res));
1089 }
1090 }
1091 break;

Callers 1

ParseOSMDataMethod · 0.45

Calls 11

typeMethod · 0.80
cbeginMethod · 0.45
cendMethod · 0.45
emptyMethod · 0.45
ProcessNodeMethod · 0.45
push_backMethod · 0.45
clearMethod · 0.45
ProcessWayMethod · 0.45
TryParseMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected