Skip to content

Commit b3b93e9

Browse files
committed
Move indirect dependency tracking into middle
Move dependency tracking of relations referencing ways referencing nodes from outputs into middle.
1 parent 74872fe commit b3b93e9

File tree

4 files changed

+12
-17
lines changed

4 files changed

+12
-17
lines changed

src/middle-pgsql.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,19 +321,29 @@ void middle_pgsql_t::node_changed(osmid_t osm_id)
321321
return;
322322
}
323323

324-
//keep track of whatever ways and rels these nodes intersect
324+
idlist_t way_ids;
325+
326+
// Find all ways referencing this node and mark them as pending.
325327
auto res = exec_prepared("mark_ways_by_node", osm_id);
328+
way_ids.reserve(res.num_tuples());
326329
for (int i = 0; i < res.num_tuples(); ++i) {
327330
osmid_t const marked = osmium::string_to_object_id(res.get_value(i, 0));
328331
m_ways_pending_tracker->mark(marked);
332+
way_ids.push_back(marked);
329333
}
330334

331-
//do the rels too
335+
// Find all relations referencing this node and mark them as pending.
332336
res = exec_prepared("mark_rels_by_node", osm_id);
333337
for (int i = 0; i < res.num_tuples(); ++i) {
334338
osmid_t const marked = osmium::string_to_object_id(res.get_value(i, 0));
335339
m_rels_pending_tracker->mark(marked);
336340
}
341+
342+
// For all ways referencing this node, mark relations referencing them
343+
// as pending.
344+
for (auto const way_id : way_ids) {
345+
way_changed(way_id);
346+
}
337347
}
338348

339349
void middle_pgsql_t::way_set(osmium::Way const &way)

src/output-flex.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,10 +1020,6 @@ void output_flex_t::pending_way(osmid_t id, int exists)
10201020

10211021
if (exists) {
10221022
way_delete(id);
1023-
auto const rel_ids = m_mid->relations_using_way(id);
1024-
for (auto const rel_id : rel_ids) {
1025-
m_rels_pending_tracker.mark(rel_id);
1026-
}
10271023
}
10281024

10291025
auto &way = m_buffer.get<osmium::Way>(0);

src/output-multi.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,10 +250,6 @@ void output_multi_t::reprocess_way(osmium::Way *way, bool exists)
250250
if (m_processor->interests(geometry_processor::interest_relation) &&
251251
exists) {
252252
way_delete(way->id());
253-
auto const rel_ids = m_mid->relations_using_way(way->id());
254-
for (auto const rel_id : rel_ids) {
255-
rels_pending_tracker.mark(rel_id);
256-
}
257253
}
258254

259255
//check if we are keeping this way

src/output-pgsql.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,6 @@ void output_pgsql_t::pending_way(osmid_t id, int exists)
7474
/* If the flag says this object may exist already, delete it first */
7575
if (exists) {
7676
pgsql_delete_way_from_output(id);
77-
// TODO: this now only has an effect when called from the iterate_ways
78-
// call-back, so we need some alternative way to trigger this within
79-
// osmdata_t.
80-
idlist_t const rel_ids = m_mid->relations_using_way(id);
81-
for (auto &mid : rel_ids) {
82-
rels_pending_tracker.mark(mid);
83-
}
8477
}
8578

8679
taglist_t outtags;

0 commit comments

Comments
 (0)