Added relationship exclusion to context filter

This commit is contained in:
Bartek Kryza
2023-03-04 21:11:14 +01:00
parent a58b633d01
commit cfca79182c
4 changed files with 15 additions and 3 deletions

View File

@@ -301,6 +301,8 @@ tvl::value_t context_filter::match(const diagram &d, const element &e) const
if (d.type() != diagram_t::kClass)
return {};
// Running this filter makes sense only after the entire diagram is
// generated - i.e. during diagram generation
if (!d.complete())
return {};
@@ -319,11 +321,13 @@ tvl::value_t context_filter::match(const diagram &d, const element &e) const
// relationship with any of the context_root's
for (const relationship &rel :
context_root.value().relationships()) {
if (rel.destination() == e.id())
if (d.should_include(rel.type()) &&
rel.destination() == e.id())
return true;
}
for (const relationship &rel : e.relationships()) {
if (rel.destination() == context_root.value().id())
if (d.should_include(rel.type()) &&
rel.destination() == context_root.value().id())
return true;
}