@@ -1047,36 +1047,45 @@ void output_flex_t::wait()
1047
1047
1048
1048
void output_flex_t::node_add (osmium::Node const &node)
1049
1049
{
1050
- if (!m_process_node) {
1050
+ auto const &func =
1051
+ node.tags ().empty () ? m_process_untagged_node : m_process_node;
1052
+
1053
+ if (!func) {
1051
1054
return ;
1052
1055
}
1053
1056
1054
1057
m_context_node = &node;
1055
- get_mutex_and_call_lua_function (m_process_node , node);
1058
+ get_mutex_and_call_lua_function (func , node);
1056
1059
m_context_node = nullptr ;
1057
1060
}
1058
1061
1059
1062
void output_flex_t::way_add (osmium::Way *way)
1060
1063
{
1061
1064
assert (way);
1062
1065
1063
- if (!m_process_way) {
1066
+ auto const &func =
1067
+ way->tags ().empty () ? m_process_untagged_way : m_process_way;
1068
+
1069
+ if (!func) {
1064
1070
return ;
1065
1071
}
1066
1072
1067
1073
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 ());
1069
1075
}
1070
1076
1071
1077
void output_flex_t::relation_add (osmium::Relation const &relation)
1072
1078
{
1073
- if (!m_process_relation) {
1079
+ auto const &func = relation.tags ().empty () ? m_process_untagged_relation
1080
+ : m_process_relation;
1081
+
1082
+ if (!func) {
1074
1083
return ;
1075
1084
}
1076
1085
1077
1086
m_relation_cache.init (relation);
1078
1087
select_relation_members ();
1079
- get_mutex_and_call_lua_function (m_process_relation , relation);
1088
+ get_mutex_and_call_lua_function (func , relation);
1080
1089
}
1081
1090
1082
1091
void 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,
1171
1180
m_area_buffer(1024 , osmium::memory::Buffer::auto_grow::yes),
1172
1181
m_process_node(other->m_process_node), m_process_way(other->m_process_way),
1173
1182
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),
1174
1186
m_select_relation_members(other->m_select_relation_members),
1175
1187
m_after_nodes(other->m_after_nodes), m_after_ways(other->m_after_ways),
1176
1188
m_after_relations(other->m_after_relations)
@@ -1402,9 +1414,19 @@ void output_flex_t::init_lua(std::string const &filename,
1402
1414
lua_state (), calling_context::process_way, " process_way" };
1403
1415
m_process_relation = prepared_lua_function_t {
1404
1416
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
+
1405
1426
m_select_relation_members = prepared_lua_function_t {
1406
1427
lua_state (), calling_context::select_relation_members,
1407
1428
" select_relation_members" , 1 };
1429
+
1408
1430
m_after_nodes = prepared_lua_function_t {lua_state (), calling_context::main,
1409
1431
" after_nodes" };
1410
1432
m_after_ways = prepared_lua_function_t {lua_state (), calling_context::main,
0 commit comments