drawing: remove hardcoded layer count of 2

This commit is contained in:
Mikolaj Wielgus 2024-06-15 01:06:50 +02:00
parent c4ac090790
commit c4788c0277
2 changed files with 7 additions and 4 deletions

View File

@ -78,9 +78,9 @@ pub struct Drawing<CW: Copy, R: RulesTrait> {
} }
impl<CW: Copy, R: RulesTrait> Drawing<CW, R> { impl<CW: Copy, R: RulesTrait> Drawing<CW, R> {
pub fn new(rules: R) -> Self { pub fn new(rules: R, layer_count: usize) -> Self {
Self { Self {
geometry_with_rtree: GeometryWithRtree::new(2), geometry_with_rtree: GeometryWithRtree::new(layer_count),
rules, rules,
} }
} }

View File

@ -124,8 +124,11 @@ impl DsnDesign {
} }
pub fn make_board(&self) -> Board<DsnMesadata> { pub fn make_board(&self) -> Board<DsnMesadata> {
let rules = DsnMesadata::from_pcb(&self.pcb); let mesadata = DsnMesadata::from_pcb(&self.pcb);
let mut board = Board::new(Layout::new(Drawing::new(rules))); let mut board = Board::new(Layout::new(Drawing::new(
mesadata,
self.pcb.structure.layer_vec.len(),
)));
// mapping of pin -> net prepared for adding pins // mapping of pin -> net prepared for adding pins
let pin_nets = HashMap::<String, usize>::from_iter( let pin_nets = HashMap::<String, usize>::from_iter(