diff --git a/src/autorouter/autorouter.rs b/src/autorouter/autorouter.rs index e14acbd..e69ecd8 100644 --- a/src/autorouter/autorouter.rs +++ b/src/autorouter/autorouter.rs @@ -183,7 +183,7 @@ impl Autorouter { .trianvertex_index() { RatvertexIndex::FixedDot(dot) => dot, - RatvertexIndex::Zone(zone) => self.board.layout_mut().zone_apex(zone), + RatvertexIndex::Zone(zone) => self.board.zone_apex(zone), }; let target_dot = match self @@ -194,7 +194,7 @@ impl Autorouter { .trianvertex_index() { RatvertexIndex::FixedDot(dot) => dot, - RatvertexIndex::Zone(zone) => self.board.layout_mut().zone_apex(zone), + RatvertexIndex::Zone(zone) => self.board.zone_apex(zone), }; (source_dot, target_dot) diff --git a/src/autorouter/board.rs b/src/autorouter/board.rs index f2f8d33..f60ee49 100644 --- a/src/autorouter/board.rs +++ b/src/autorouter/board.rs @@ -3,14 +3,18 @@ use std::collections::HashMap; use crate::{ drawing::{ dot::{FixedDotIndex, FixedDotWeight}, - graph::PrimitiveIndex, + graph::{GetLayer, GetMaybeNet, PrimitiveIndex}, rules::RulesTrait, seg::{FixedSegIndex, FixedSegWeight}, Infringement, }, - geometry::GenericNode, + geometry::{shape::ShapeTrait, GenericNode}, graph::GenericIndex, - layout::{zone::ZoneWeight, Layout}, + layout::{ + zone::{GetMaybeApex, MakePolyShape, ZoneWeight}, + Layout, + }, + math::Circle, }; pub type NodeIndex = GenericNode>; @@ -114,6 +118,25 @@ impl Board { self.net_to_netname.insert(net, netname); } + pub fn zone_apex(&mut self, zone: GenericIndex) -> FixedDotIndex { + if let Some(apex) = self.layout.zone(zone).maybe_apex() { + apex + } else { + self.add_zone_fixed_dot( + FixedDotWeight { + circle: Circle { + pos: self.layout.zone(zone).shape().center(), + r: 100.0, + }, + layer: self.layout.zone(zone).layer(), + maybe_net: self.layout.zone(zone).maybe_net(), + }, + zone, + ) + .unwrap() + } + } + pub fn node_pin(&self, node: NodeIndex) -> Option<&String> { self.node_to_pin.get(&node) } diff --git a/src/layout/layout.rs b/src/layout/layout.rs index c51ab5d..6a266e0 100644 --- a/src/layout/layout.rs +++ b/src/layout/layout.rs @@ -180,25 +180,6 @@ impl Layout { .compound_members(GenericIndex::new(zone.node_index())) } - pub fn zone_apex(&mut self, zone: GenericIndex) -> FixedDotIndex { - if let Some(apex) = self.zone(zone).maybe_apex() { - apex - } else { - self.add_zone_fixed_dot( - FixedDotWeight { - circle: Circle { - pos: self.zone(zone).shape().center(), - r: 100.0, - }, - layer: self.zone(zone).layer(), - maybe_net: self.zone(zone).maybe_net(), - }, - zone, - ) - .unwrap() - } - } - pub fn drawing(&self) -> &Drawing { &self.drawing }