@@ -1047,36 +1047,45 @@ void output_flex_t::wait()
10471047
10481048void output_flex_t::node_add (osmium::Node const &node)
10491049{
1050- if (!m_process_node) {
1050+ auto const &func =
1051+ node.tags ().empty () ? m_process_untagged_node : m_process_node;
1052+
1053+ if (!func) {
10511054 return ;
10521055 }
10531056
10541057 m_context_node = &node;
1055- get_mutex_and_call_lua_function (m_process_node , node);
1058+ get_mutex_and_call_lua_function (func , node);
10561059 m_context_node = nullptr ;
10571060}
10581061
10591062void output_flex_t::way_add (osmium::Way *way)
10601063{
10611064 assert (way);
10621065
1063- if (!m_process_way) {
1066+ auto const &func =
1067+ way->tags ().empty () ? m_process_untagged_way : m_process_way;
1068+
1069+ if (!func) {
10641070 return ;
10651071 }
10661072
10671073 m_way_cache.init (way);
1068- get_mutex_and_call_lua_function (m_process_way , m_way_cache.get ());
1074+ get_mutex_and_call_lua_function (func , m_way_cache.get ());
10691075}
10701076
10711077void output_flex_t::relation_add (osmium::Relation const &relation)
10721078{
1073- if (!m_process_relation) {
1079+ auto const &func = relation.tags ().empty () ? m_process_untagged_relation
1080+ : m_process_relation;
1081+
1082+ if (!func) {
10741083 return ;
10751084 }
10761085
10771086 m_relation_cache.init (relation);
10781087 select_relation_members ();
1079- get_mutex_and_call_lua_function (m_process_relation , relation);
1088+ get_mutex_and_call_lua_function (func , relation);
10801089}
10811090
10821091void output_flex_t::delete_from_table (table_connection_t *table_connection,
@@ -1171,6 +1180,9 @@ output_flex_t::output_flex_t(output_flex_t const *other,
11711180 m_area_buffer(1024 , osmium::memory::Buffer::auto_grow::yes),
11721181 m_process_node(other->m_process_node), m_process_way(other->m_process_way),
11731182 m_process_relation(other->m_process_relation),
1183+ m_process_untagged_node(other->m_process_untagged_node),
1184+ m_process_untagged_way(other->m_process_untagged_way),
1185+ m_process_untagged_relation(other->m_process_untagged_relation),
11741186 m_select_relation_members(other->m_select_relation_members),
11751187 m_after_nodes(other->m_after_nodes), m_after_ways(other->m_after_ways),
11761188 m_after_relations(other->m_after_relations)
@@ -1402,9 +1414,19 @@ void output_flex_t::init_lua(std::string const &filename,
14021414 lua_state (), calling_context::process_way, " process_way" };
14031415 m_process_relation = prepared_lua_function_t {
14041416 lua_state (), calling_context::process_relation, " process_relation" };
1417+
1418+ m_process_untagged_node = prepared_lua_function_t {
1419+ lua_state (), calling_context::process_node, " process_untagged_node" };
1420+ m_process_untagged_way = prepared_lua_function_t {
1421+ lua_state (), calling_context::process_way, " process_untagged_way" };
1422+ m_process_untagged_relation =
1423+ prepared_lua_function_t {lua_state (), calling_context::process_relation,
1424+ " process_untagged_relation" };
1425+
14051426 m_select_relation_members = prepared_lua_function_t {
14061427 lua_state (), calling_context::select_relation_members,
14071428 " select_relation_members" , 1 };
1429+
14081430 m_after_nodes = prepared_lua_function_t {lua_state (), calling_context::main,
14091431 " after_nodes" };
14101432 m_after_ways = prepared_lua_function_t {lua_state (), calling_context::main,
0 commit comments