Support for excluding common entities and excluding custom ones

This commit is contained in:
elvis
2025-07-16 16:20:29 +02:00
parent 0ef51200e5
commit 23ce9c3488
4 changed files with 90 additions and 8 deletions

View File

@ -41,6 +41,20 @@ pub fn digraph(
Ok(graph)
}
pub fn common_entities(
graph: &RSgraph
) -> RSset {
graph.node_references().fold(
None,
|acc, node|
match acc {
None => Some(node.1.available_entities.clone()),
Some(acc) => Some(node.1.available_entities.intersection(&acc))
}
).unwrap_or(RSset::new())
}
// -----------------------------------------------------------------------------
// helper functions
// -----------------------------------------------------------------------------
@ -54,6 +68,7 @@ pub enum GraphMapNodes {
Hide,
Entities,
MaskEntities { mask: RSset },
ExcludeEntities { mask: RSset },
Context,
}
@ -108,6 +123,20 @@ impl GraphMapNodesTy {
}
)
},
ExcludeEntities { mask } => {
Box::new(
move |_, node: &RSsystem| {
let masked_entities =
node.available_entities
.subtraction(&mask);
format!("{}",
translator::RSsetDisplay::from(
&translator,
&masked_entities)
)
}
)
}
Context => {
Box::new(
move |_, node: &RSsystem|