From 10dc1a86aa94be1dc745c51cf7333ff493d76b83 Mon Sep 17 00:00:00 2001 From: Mikolaj Wielgus Date: Sun, 19 Oct 2025 20:51:44 +0200 Subject: [PATCH] refactor(layout/layout): Add method to retrieve fixed dot's via (not used yet) --- src/layout/layout.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/layout/layout.rs b/src/layout/layout.rs index 521d84a..a269392 100644 --- a/src/layout/layout.rs +++ b/src/layout/layout.rs @@ -389,12 +389,23 @@ impl Layout { .compounds(GenericIndex::<()>::new(primitive.index())) .find_map(|(_, compound)| { if let CompoundWeight::Poly(_) = self.drawing().compound_weight(compound) { - Some(compound) + Some(GenericIndex::::new(compound.index())) + } else { + None + } + }) + } + + pub fn fixed_dot_via(&self, dot: FixedDotIndex) -> Option> { + self.drawing() + .compounds(GenericIndex::<()>::new(dot.index())) + .find_map(|(_, compound)| { + if let CompoundWeight::Via(_) = self.drawing().compound_weight(compound) { + Some(GenericIndex::::new(compound.index())) } else { None } }) - .map(|compound| GenericIndex::::new(compound.index())) } /// Checks if a node is not a primitive part of a compound, and if yes, returns its apex and center