@@ -835,17 +835,12 @@ void output_flex_t::get_mutex_and_call_lua_function(
835835
836836void output_flex_t::pending_way (osmid_t id)
837837{
838- if (!m_process_way) {
839- return ;
840- }
841-
842838 if (!m_way_cache.init (middle (), id)) {
843839 return ;
844840 }
845841
846842 way_delete (id);
847-
848- get_mutex_and_call_lua_function (m_process_way, m_way_cache.get ());
843+ process_way ();
849844}
850845
851846void output_flex_t::select_relation_members ()
@@ -892,9 +887,33 @@ void output_flex_t::select_relation_members(osmid_t id)
892887 select_relation_members ();
893888}
894889
890+ void output_flex_t::process_way ()
891+ {
892+ auto const &func = m_way_cache.get ().tags ().empty () ? m_process_untagged_way
893+ : m_process_way;
894+ if (!func) {
895+ return ;
896+ }
897+
898+ get_mutex_and_call_lua_function (func, m_way_cache.get ());
899+ }
900+
901+ void output_flex_t::process_relation ()
902+ {
903+ auto const &func = m_relation_cache.get ().tags ().empty ()
904+ ? m_process_untagged_relation
905+ : m_process_relation;
906+ if (!func) {
907+ return ;
908+ }
909+
910+ get_mutex_and_call_lua_function (func, m_relation_cache.get ());
911+ }
912+
895913void output_flex_t::pending_relation (osmid_t id)
896914{
897- if (!m_process_relation && !m_select_relation_members) {
915+ if (!m_process_relation && !m_process_untagged_relation &&
916+ !m_select_relation_members) {
898917 return ;
899918 }
900919
@@ -904,16 +923,12 @@ void output_flex_t::pending_relation(osmid_t id)
904923
905924 select_relation_members ();
906925 delete_from_tables (osmium::item_type::relation, id);
907-
908- if (m_process_relation) {
909- get_mutex_and_call_lua_function (m_process_relation,
910- m_relation_cache.get ());
911- }
926+ process_relation ();
912927}
913928
914929void output_flex_t::pending_relation_stage1c (osmid_t id)
915930{
916- if (!m_process_relation) {
931+ if (!m_process_relation && !m_process_untagged_relation ) {
917932 return ;
918933 }
919934
@@ -922,7 +937,7 @@ void output_flex_t::pending_relation_stage1c(osmid_t id)
922937 }
923938
924939 m_disable_insert = true ;
925- get_mutex_and_call_lua_function (m_process_relation, m_relation_cache. get () );
940+ process_relation ( );
926941 m_disable_insert = false ;
927942}
928943
@@ -1459,9 +1474,7 @@ void output_flex_t::reprocess_marked()
14591474 continue ;
14601475 }
14611476 way_delete (id);
1462- if (m_process_way) {
1463- get_mutex_and_call_lua_function (m_process_way, m_way_cache.get ());
1464- }
1477+ process_way ();
14651478 }
14661479
14671480 // We don't need these any more so can free the memory.
0 commit comments