@@ -1084,6 +1084,38 @@ void output_flex_t::delete_from_tables(osmium::item_type type, osmid_t osm_id)
10841084 }
10851085}
10861086
1087+ void output_flex_t::node_delete (osmium::Node const &node)
1088+ {
1089+ if (m_delete_node) {
1090+ m_context_node = &node;
1091+ get_mutex_and_call_lua_function (m_delete_node, node);
1092+ m_context_node = nullptr ;
1093+ }
1094+
1095+ node_delete (node.id ());
1096+ }
1097+
1098+ void output_flex_t::way_delete (osmium::Way *way)
1099+ {
1100+ if (m_delete_way) {
1101+ m_way_cache.init (way);
1102+ get_mutex_and_call_lua_function (m_delete_way, m_way_cache.get ());
1103+ }
1104+
1105+ way_delete (way->id ());
1106+ }
1107+
1108+ void output_flex_t::relation_delete (osmium::Relation const &rel)
1109+ {
1110+ if (m_delete_relation) {
1111+ m_relation_cache.init (rel);
1112+ select_relation_members ();
1113+ get_mutex_and_call_lua_function (m_delete_relation, rel);
1114+ }
1115+
1116+ relation_delete (rel.id ());
1117+ }
1118+
10871119/* Delete is easy, just remove all traces of this object. We don't need to
10881120 * worry about finding objects that depend on it, since the same diff must
10891121 * contain the change for that also. */
@@ -1146,6 +1178,8 @@ output_flex_t::output_flex_t(output_flex_t const *other,
11461178 m_process_untagged_node(other->m_process_untagged_node),
11471179 m_process_untagged_way(other->m_process_untagged_way),
11481180 m_process_untagged_relation(other->m_process_untagged_relation),
1181+ m_delete_node(other->m_delete_node), m_delete_way(other->m_delete_way),
1182+ m_delete_relation(other->m_delete_relation),
11491183 m_select_relation_members(other->m_select_relation_members),
11501184 m_after_nodes(other->m_after_nodes), m_after_ways(other->m_after_ways),
11511185 m_after_relations(other->m_after_relations)
@@ -1330,6 +1364,13 @@ void output_flex_t::init_lua(std::string const &filename,
13301364 prepared_lua_function_t {lua_state (), calling_context::process_relation,
13311365 " process_untagged_relation" };
13321366
1367+ m_delete_node = prepared_lua_function_t {
1368+ lua_state (), calling_context::process_node, " delete_node" };
1369+ m_delete_way = prepared_lua_function_t {
1370+ lua_state (), calling_context::process_way, " delete_way" };
1371+ m_delete_relation = prepared_lua_function_t {
1372+ lua_state (), calling_context::process_relation, " delete_relation" };
1373+
13331374 m_select_relation_members = prepared_lua_function_t {
13341375 lua_state (), calling_context::select_relation_members,
13351376 " select_relation_members" , 1 };
0 commit comments