From 41bd60ea59a8e9a913acaab405a350e9b245d1a4 Mon Sep 17 00:00:00 2001 From: Mikolaj Wielgus Date: Thu, 8 Aug 2024 11:28:17 +0200 Subject: [PATCH] cli: fix compile errors --- src/autorouter/selection.rs | 14 ++++++++++++++ src/bin/topola/main.rs | 6 ++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/autorouter/selection.rs b/src/autorouter/selection.rs index e10f9e1..2a32b06 100644 --- a/src/autorouter/selection.rs +++ b/src/autorouter/selection.rs @@ -31,6 +31,20 @@ impl PinSelection { } } + pub fn new_select_layer(board: &Board, layer: usize) -> Self { + let mut this = Self::new(); + + for node in board.layout().drawing().layer_primitive_nodes(layer) { + if let Some(selector) = this.node_selector(board, GenericNode::Primitive(node)) { + if !this.contains_node(board, GenericNode::Primitive(node)) { + this.select(selector); + } + } + } + + this + } + fn node_selector( &self, board: &Board, diff --git a/src/bin/topola/main.rs b/src/bin/topola/main.rs index 091d306..3d7aadb 100644 --- a/src/bin/topola/main.rs +++ b/src/bin/topola/main.rs @@ -7,7 +7,7 @@ use std::path::PathBuf; use topola::autorouter::history::History; use topola::autorouter::invoker::Command; use topola::autorouter::invoker::Invoker; -use topola::autorouter::selection::Selection; +use topola::autorouter::selection::PinSelection; use topola::autorouter::Autorouter; use topola::specctra::design::SpecctraDesign; @@ -44,7 +44,9 @@ fn main() -> Result<(), std::io::Error> { serde_json::from_reader(commands_bufread)? } else { let mut history = History::new(); - history.do_(Command::Autoroute(Selection::new_select_layer(&board, 0))); + history.do_(Command::Autoroute(PinSelection::new_select_layer( + &board, 0, + ))); history };