mirror of https://codeberg.org/topola/topola.git
layout: rename "zone" to "poly"
We'll keep the term "zone" for higher-level concepts.
This commit is contained in:
parent
71a2a3ebbf
commit
be9ff3a85a
|
|
@ -103,7 +103,7 @@ impl<M: AccessMesadata> Autorouter<M> {
|
|||
.node_index()
|
||||
{
|
||||
RatvertexIndex::FixedDot(dot) => dot,
|
||||
RatvertexIndex::Zone(zone) => self.board.zone_apex(zone),
|
||||
RatvertexIndex::Poly(poly) => self.board.poly_apex(poly),
|
||||
};
|
||||
|
||||
let target_dot = match self
|
||||
|
|
@ -114,7 +114,7 @@ impl<M: AccessMesadata> Autorouter<M> {
|
|||
.node_index()
|
||||
{
|
||||
RatvertexIndex::FixedDot(dot) => dot,
|
||||
RatvertexIndex::Zone(zone) => self.board.zone_apex(zone),
|
||||
RatvertexIndex::Poly(poly) => self.board.poly_apex(poly),
|
||||
};
|
||||
|
||||
(source_dot, target_dot)
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ use crate::{
|
|||
geometry::{compound::ManageCompounds, shape::AccessShape},
|
||||
graph::{GenericIndex, GetPetgraphIndex},
|
||||
layout::{
|
||||
zone::{MakePolyShape, ZoneWeight},
|
||||
poly::{MakePolyShape, PolyWeight},
|
||||
Layout,
|
||||
},
|
||||
triangulation::{GetTrianvertexNodeIndex, Triangulation},
|
||||
|
|
@ -31,14 +31,14 @@ use crate::{
|
|||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
pub enum RatvertexIndex {
|
||||
FixedDot(FixedDotIndex),
|
||||
Zone(GenericIndex<ZoneWeight>),
|
||||
Poly(GenericIndex<PolyWeight>),
|
||||
}
|
||||
|
||||
impl From<RatvertexIndex> for crate::layout::NodeIndex {
|
||||
fn from(vertex: RatvertexIndex) -> crate::layout::NodeIndex {
|
||||
match vertex {
|
||||
RatvertexIndex::FixedDot(dot) => crate::layout::NodeIndex::Primitive(dot.into()),
|
||||
RatvertexIndex::Zone(zone) => crate::layout::NodeIndex::Compound(zone.into()),
|
||||
RatvertexIndex::Poly(poly) => crate::layout::NodeIndex::Compound(poly.into()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -89,7 +89,7 @@ impl Ratsnest {
|
|||
for node in layout.drawing().layer_primitive_nodes(layer) {
|
||||
match node {
|
||||
PrimitiveIndex::FixedDot(dot) => {
|
||||
if layout.zones(dot).next().is_none() {
|
||||
if layout.polys(dot).next().is_none() {
|
||||
if let Some(net) = layout.drawing().primitive(dot).maybe_net() {
|
||||
if !triangulations.contains_key(&(layer, net)) {
|
||||
triangulations.insert(
|
||||
|
|
@ -113,8 +113,8 @@ impl Ratsnest {
|
|||
}
|
||||
}
|
||||
|
||||
for zone in layout.layer_zone_nodes(layer) {
|
||||
if let Some(net) = layout.drawing().compound_weight(zone.into()).maybe_net() {
|
||||
for poly in layout.layer_poly_nodes(layer) {
|
||||
if let Some(net) = layout.drawing().compound_weight(poly.into()).maybe_net() {
|
||||
if !triangulations.contains_key(&(layer, net)) {
|
||||
triangulations.insert(
|
||||
(layer, net),
|
||||
|
|
@ -126,8 +126,8 @@ impl Ratsnest {
|
|||
.get_mut(&(layer, net))
|
||||
.unwrap()
|
||||
.add_vertex(RatvertexWeight {
|
||||
vertex: RatvertexIndex::Zone(zone),
|
||||
pos: layout.zone(zone).shape().center(),
|
||||
vertex: RatvertexIndex::Poly(poly),
|
||||
pos: layout.poly(poly).shape().center(),
|
||||
})?
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ use crate::{
|
|||
drawing::graph::{GetLayer, MakePrimitive},
|
||||
geometry::compound::ManageCompounds,
|
||||
graph::{GenericIndex, GetPetgraphIndex},
|
||||
layout::{zone::ZoneWeight, CompoundWeight, NodeIndex},
|
||||
layout::{poly::PolyWeight, CompoundWeight, NodeIndex},
|
||||
};
|
||||
|
||||
#[derive(Debug, Clone, Hash, Eq, PartialEq, Serialize, Deserialize)]
|
||||
|
|
@ -66,11 +66,11 @@ impl Selection {
|
|||
primitive.primitive(board.layout().drawing()).layer()
|
||||
}
|
||||
NodeIndex::Compound(compound) => {
|
||||
if let CompoundWeight::Zone(..) = board.layout().drawing().compound_weight(compound)
|
||||
if let CompoundWeight::Poly(..) = board.layout().drawing().compound_weight(compound)
|
||||
{
|
||||
board
|
||||
.layout()
|
||||
.zone(GenericIndex::<ZoneWeight>::new(compound.petgraph_index()))
|
||||
.poly(GenericIndex::<PolyWeight>::new(compound.petgraph_index()))
|
||||
.layer()
|
||||
} else {
|
||||
unreachable!()
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ use topola::{
|
|||
shape::AccessShape,
|
||||
GenericNode,
|
||||
},
|
||||
layout::{via::ViaWeight, zone::MakePolyShape, Layout},
|
||||
layout::{poly::MakePolyShape, via::ViaWeight, Layout},
|
||||
math::Circle,
|
||||
router::{
|
||||
draw::DrawException,
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ use topola::{
|
|||
},
|
||||
graph::{GenericIndex, GetPetgraphIndex},
|
||||
layout::{
|
||||
poly::{MakePolyShape, Poly, PolyWeight},
|
||||
via::ViaWeight,
|
||||
zone::{MakePolyShape, Zone, ZoneWeight},
|
||||
CompoundWeight, Layout, NodeIndex,
|
||||
},
|
||||
};
|
||||
|
|
@ -76,9 +76,9 @@ impl Overlay {
|
|||
}
|
||||
NodeIndex::Compound(compound) => {
|
||||
match board.layout().drawing().compound_weight(compound) {
|
||||
CompoundWeight::Zone(weight) => board
|
||||
CompoundWeight::Poly(weight) => board
|
||||
.layout()
|
||||
.zone(GenericIndex::<ZoneWeight>::new(compound.petgraph_index()))
|
||||
.poly(GenericIndex::<PolyWeight>::new(compound.petgraph_index()))
|
||||
.shape()
|
||||
.into(),
|
||||
CompoundWeight::Via(weight) => board
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ use topola::{
|
|||
primitive::MakePrimitiveShape,
|
||||
},
|
||||
geometry::{shape::AccessShape, GenericNode},
|
||||
layout::{via::ViaWeight, zone::MakePolyShape},
|
||||
layout::{poly::MakePolyShape, via::ViaWeight},
|
||||
math::Circle,
|
||||
specctra::mesadata::SpecctraMesadata,
|
||||
};
|
||||
|
|
@ -126,17 +126,17 @@ impl Viewport {
|
|||
painter.paint_primitive(&shape, color);
|
||||
}
|
||||
|
||||
for zone in board.layout().layer_zone_nodes(i) {
|
||||
for poly in board.layout().layer_poly_nodes(i) {
|
||||
let color = if overlay
|
||||
.selection()
|
||||
.contains_node(board, GenericNode::Compound(zone.into()))
|
||||
.contains_node(board, GenericNode::Compound(poly.into()))
|
||||
{
|
||||
layers.highlight_colors[i]
|
||||
} else {
|
||||
layers.colors[i]
|
||||
};
|
||||
|
||||
painter.paint_polygon(&board.layout().zone(zone).shape().polygon, color)
|
||||
painter.paint_polygon(&board.layout().poly(poly).shape().polygon, color)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ use topola::drawing::seg::FixedSegWeight;
|
|||
use topola::drawing::{Infringement, LayoutException};
|
||||
use topola::geometry::primitive::{AccessPrimitiveShape, PrimitiveShape};
|
||||
use topola::geometry::shape::AccessShape;
|
||||
use topola::layout::zone::MakePolyShape;
|
||||
use topola::layout::poly::MakePolyShape;
|
||||
use topola::layout::Layout;
|
||||
use topola::router::draw::DrawException;
|
||||
use topola::router::navmesh::Navmesh;
|
||||
|
|
@ -303,9 +303,9 @@ fn render_times(
|
|||
painter.paint_primitive(&shape, color, view.zoom);
|
||||
}
|
||||
|
||||
for zone in layout.layer_zone_nodes(1) {
|
||||
for poly in layout.layer_poly_nodes(1) {
|
||||
painter.paint_polygon(
|
||||
&layout.zone(zone).shape().polygon,
|
||||
&layout.poly(poly).shape().polygon,
|
||||
ColorU::new(52, 52, 200, 255),
|
||||
view.zoom,
|
||||
);
|
||||
|
|
@ -322,9 +322,9 @@ fn render_times(
|
|||
painter.paint_primitive(&shape, color, view.zoom);
|
||||
}
|
||||
|
||||
for zone in layout.layer_zone_nodes(0) {
|
||||
for poly in layout.layer_poly_nodes(0) {
|
||||
painter.paint_polygon(
|
||||
&layout.zone(zone).shape().polygon,
|
||||
&layout.poly(poly).shape().polygon,
|
||||
ColorU::new(200, 52, 52, 255),
|
||||
view.zoom,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ use crate::{
|
|||
geometry::{shape::AccessShape, GenericNode},
|
||||
graph::GenericIndex,
|
||||
layout::{
|
||||
zone::{GetMaybeApex, MakePolyShape, ZoneWeight},
|
||||
poly::{GetMaybeApex, MakePolyShape, PolyWeight},
|
||||
Layout, NodeIndex,
|
||||
},
|
||||
math::Circle,
|
||||
|
|
@ -49,14 +49,14 @@ impl<M: AccessMesadata> Board<M> {
|
|||
dot
|
||||
}
|
||||
|
||||
pub fn add_zone_fixed_dot_infringably(
|
||||
pub fn add_poly_fixed_dot_infringably(
|
||||
&mut self,
|
||||
weight: FixedDotWeight,
|
||||
zone: GenericIndex<ZoneWeight>,
|
||||
poly: GenericIndex<PolyWeight>,
|
||||
) -> FixedDotIndex {
|
||||
let dot = self.layout.add_zone_fixed_dot_infringably(weight, zone);
|
||||
let dot = self.layout.add_poly_fixed_dot_infringably(weight, poly);
|
||||
|
||||
if let Some(pin) = self.node_pinname(GenericNode::Compound(zone.into())) {
|
||||
if let Some(pin) = self.node_pinname(GenericNode::Compound(poly.into())) {
|
||||
self.node_to_pinname
|
||||
.insert(GenericNode::Primitive(dot.into()), pin.to_string());
|
||||
}
|
||||
|
|
@ -81,18 +81,18 @@ impl<M: AccessMesadata> Board<M> {
|
|||
seg
|
||||
}
|
||||
|
||||
pub fn add_zone_fixed_seg_infringably(
|
||||
pub fn add_poly_fixed_seg_infringably(
|
||||
&mut self,
|
||||
from: FixedDotIndex,
|
||||
to: FixedDotIndex,
|
||||
weight: FixedSegWeight,
|
||||
zone: GenericIndex<ZoneWeight>,
|
||||
poly: GenericIndex<PolyWeight>,
|
||||
) -> FixedSegIndex {
|
||||
let seg = self
|
||||
.layout
|
||||
.add_zone_fixed_seg_infringably(from, to, weight, zone);
|
||||
.add_poly_fixed_seg_infringably(from, to, weight, poly);
|
||||
|
||||
if let Some(pin) = self.node_pinname(GenericNode::Compound(zone.into())) {
|
||||
if let Some(pin) = self.node_pinname(GenericNode::Compound(poly.into())) {
|
||||
self.node_to_pinname
|
||||
.insert(GenericNode::Primitive(seg.into()), pin.to_string());
|
||||
}
|
||||
|
|
@ -100,35 +100,35 @@ impl<M: AccessMesadata> Board<M> {
|
|||
seg
|
||||
}
|
||||
|
||||
pub fn add_zone(
|
||||
pub fn add_poly(
|
||||
&mut self,
|
||||
weight: ZoneWeight,
|
||||
weight: PolyWeight,
|
||||
maybe_pin: Option<String>,
|
||||
) -> GenericIndex<ZoneWeight> {
|
||||
let zone = self.layout.add_zone(weight);
|
||||
) -> GenericIndex<PolyWeight> {
|
||||
let poly = self.layout.add_poly(weight);
|
||||
|
||||
if let Some(pin) = maybe_pin {
|
||||
self.node_to_pinname
|
||||
.insert(GenericNode::Compound(zone.into()), pin.to_string());
|
||||
.insert(GenericNode::Compound(poly.into()), pin.to_string());
|
||||
}
|
||||
|
||||
zone
|
||||
poly
|
||||
}
|
||||
|
||||
pub fn zone_apex(&mut self, zone: GenericIndex<ZoneWeight>) -> FixedDotIndex {
|
||||
if let Some(apex) = self.layout.zone(zone).maybe_apex() {
|
||||
pub fn poly_apex(&mut self, poly: GenericIndex<PolyWeight>) -> FixedDotIndex {
|
||||
if let Some(apex) = self.layout.poly(poly).maybe_apex() {
|
||||
apex
|
||||
} else {
|
||||
self.add_zone_fixed_dot_infringably(
|
||||
self.add_poly_fixed_dot_infringably(
|
||||
FixedDotWeight {
|
||||
circle: Circle {
|
||||
pos: self.layout.zone(zone).shape().center(),
|
||||
pos: self.layout.poly(poly).shape().center(),
|
||||
r: 100.0,
|
||||
},
|
||||
layer: self.layout.zone(zone).layer(),
|
||||
maybe_net: self.layout.zone(zone).maybe_net(),
|
||||
layer: self.layout.poly(poly).layer(),
|
||||
maybe_net: self.layout.poly(poly).maybe_net(),
|
||||
},
|
||||
zone,
|
||||
poly,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,15 +25,15 @@ use crate::{
|
|||
},
|
||||
graph::{GenericIndex, GetPetgraphIndex},
|
||||
layout::{
|
||||
poly::{Poly, PolyWeight},
|
||||
via::{Via, ViaWeight},
|
||||
zone::{Zone, ZoneWeight},
|
||||
},
|
||||
};
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
#[enum_dispatch(GetMaybeNet)]
|
||||
pub enum CompoundWeight {
|
||||
Zone(ZoneWeight),
|
||||
Poly(PolyWeight),
|
||||
Via(ViaWeight),
|
||||
}
|
||||
|
||||
|
|
@ -107,27 +107,27 @@ impl<R: AccessRules> Layout<R> {
|
|||
self.drawing.add_fixed_dot_infringably(weight)
|
||||
}
|
||||
|
||||
pub fn add_zone_fixed_dot(
|
||||
pub fn add_poly_fixed_dot(
|
||||
&mut self,
|
||||
weight: FixedDotWeight,
|
||||
zone: GenericIndex<ZoneWeight>,
|
||||
poly: GenericIndex<PolyWeight>,
|
||||
) -> Result<FixedDotIndex, Infringement> {
|
||||
let maybe_dot = self.drawing.add_fixed_dot(weight);
|
||||
|
||||
if let Ok(dot) = maybe_dot {
|
||||
self.drawing.add_to_compound(dot, zone.into());
|
||||
self.drawing.add_to_compound(dot, poly.into());
|
||||
}
|
||||
|
||||
maybe_dot
|
||||
}
|
||||
|
||||
pub fn add_zone_fixed_dot_infringably(
|
||||
pub fn add_poly_fixed_dot_infringably(
|
||||
&mut self,
|
||||
weight: FixedDotWeight,
|
||||
zone: GenericIndex<ZoneWeight>,
|
||||
poly: GenericIndex<PolyWeight>,
|
||||
) -> FixedDotIndex {
|
||||
let dot = self.drawing.add_fixed_dot_infringably(weight);
|
||||
self.drawing.add_to_compound(dot, zone.into());
|
||||
self.drawing.add_to_compound(dot, poly.into());
|
||||
dot
|
||||
}
|
||||
|
||||
|
|
@ -149,31 +149,31 @@ impl<R: AccessRules> Layout<R> {
|
|||
self.drawing.add_fixed_seg_infringably(from, to, weight)
|
||||
}
|
||||
|
||||
pub fn add_zone_fixed_seg(
|
||||
pub fn add_poly_fixed_seg(
|
||||
&mut self,
|
||||
from: FixedDotIndex,
|
||||
to: FixedDotIndex,
|
||||
weight: FixedSegWeight,
|
||||
zone: GenericIndex<ZoneWeight>,
|
||||
poly: GenericIndex<PolyWeight>,
|
||||
) -> Result<FixedSegIndex, Infringement> {
|
||||
let maybe_seg = self.add_fixed_seg(from, to, weight);
|
||||
|
||||
if let Ok(seg) = maybe_seg {
|
||||
self.drawing.add_to_compound(seg, zone.into());
|
||||
self.drawing.add_to_compound(seg, poly.into());
|
||||
}
|
||||
|
||||
maybe_seg
|
||||
}
|
||||
|
||||
pub fn add_zone_fixed_seg_infringably(
|
||||
pub fn add_poly_fixed_seg_infringably(
|
||||
&mut self,
|
||||
from: FixedDotIndex,
|
||||
to: FixedDotIndex,
|
||||
weight: FixedSegWeight,
|
||||
zone: GenericIndex<ZoneWeight>,
|
||||
poly: GenericIndex<PolyWeight>,
|
||||
) -> FixedSegIndex {
|
||||
let seg = self.add_fixed_seg_infringably(from, to, weight);
|
||||
self.drawing.add_to_compound(seg, zone.into());
|
||||
self.drawing.add_to_compound(seg, poly.into());
|
||||
seg
|
||||
}
|
||||
|
||||
|
|
@ -199,10 +199,10 @@ impl<R: AccessRules> Layout<R> {
|
|||
self.drawing.move_dot(dot, to)
|
||||
}
|
||||
|
||||
pub fn add_zone(&mut self, weight: ZoneWeight) -> GenericIndex<ZoneWeight> {
|
||||
GenericIndex::<ZoneWeight>::new(
|
||||
pub fn add_poly(&mut self, weight: PolyWeight) -> GenericIndex<PolyWeight> {
|
||||
GenericIndex::<PolyWeight>::new(
|
||||
self.drawing
|
||||
.add_compound(CompoundWeight::Zone(weight))
|
||||
.add_compound(CompoundWeight::Poly(weight))
|
||||
.petgraph_index(),
|
||||
)
|
||||
}
|
||||
|
|
@ -243,18 +243,18 @@ impl<R: AccessRules> Layout<R> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn zones<W: 'static>(
|
||||
pub fn polys<W: 'static>(
|
||||
&self,
|
||||
node: GenericIndex<W>,
|
||||
) -> impl Iterator<Item = GenericIndex<CompoundWeight>> + '_ {
|
||||
self.drawing.compounds(node)
|
||||
}
|
||||
|
||||
pub fn zone_nodes(&self) -> impl Iterator<Item = GenericIndex<ZoneWeight>> + '_ {
|
||||
pub fn poly_nodes(&self) -> impl Iterator<Item = GenericIndex<PolyWeight>> + '_ {
|
||||
self.drawing.rtree().iter().filter_map(|wrapper| {
|
||||
if let NodeIndex::Compound(compound) = wrapper.data {
|
||||
if let CompoundWeight::Zone(..) = self.drawing.compound_weight(compound) {
|
||||
return Some(GenericIndex::<ZoneWeight>::new(compound.petgraph_index()));
|
||||
if let CompoundWeight::Poly(..) = self.drawing.compound_weight(compound) {
|
||||
return Some(GenericIndex::<PolyWeight>::new(compound.petgraph_index()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -262,10 +262,10 @@ impl<R: AccessRules> Layout<R> {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn layer_zone_nodes(
|
||||
pub fn layer_poly_nodes(
|
||||
&self,
|
||||
layer: usize,
|
||||
) -> impl Iterator<Item = GenericIndex<ZoneWeight>> + '_ {
|
||||
) -> impl Iterator<Item = GenericIndex<PolyWeight>> + '_ {
|
||||
self.drawing
|
||||
.rtree()
|
||||
.locate_in_envelope_intersecting(&AABB::from_corners(
|
||||
|
|
@ -274,8 +274,8 @@ impl<R: AccessRules> Layout<R> {
|
|||
))
|
||||
.filter_map(|wrapper| {
|
||||
if let NodeIndex::Compound(compound) = wrapper.data {
|
||||
if let CompoundWeight::Zone(..) = self.drawing.compound_weight(compound) {
|
||||
return Some(GenericIndex::<ZoneWeight>::new(compound.petgraph_index()));
|
||||
if let CompoundWeight::Poly(..) = self.drawing.compound_weight(compound) {
|
||||
return Some(GenericIndex::<PolyWeight>::new(compound.petgraph_index()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -283,13 +283,13 @@ impl<R: AccessRules> Layout<R> {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn zone_members(
|
||||
pub fn poly_members(
|
||||
&self,
|
||||
zone: GenericIndex<ZoneWeight>,
|
||||
poly: GenericIndex<PolyWeight>,
|
||||
) -> impl Iterator<Item = PrimitiveIndex> + '_ {
|
||||
self.drawing
|
||||
.geometry()
|
||||
.compound_members(GenericIndex::new(zone.petgraph_index()))
|
||||
.compound_members(GenericIndex::new(poly.petgraph_index()))
|
||||
}
|
||||
|
||||
pub fn drawing(&self) -> &Drawing<CompoundWeight, R> {
|
||||
|
|
@ -304,8 +304,8 @@ impl<R: AccessRules> Layout<R> {
|
|||
self.drawing.rules_mut()
|
||||
}
|
||||
|
||||
pub fn zone(&self, index: GenericIndex<ZoneWeight>) -> Zone<R> {
|
||||
Zone::new(index, self)
|
||||
pub fn poly(&self, index: GenericIndex<PolyWeight>) -> Poly<R> {
|
||||
Poly::new(index, self)
|
||||
}
|
||||
|
||||
pub fn via(&self, index: GenericIndex<ViaWeight>) -> Via<R> {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
mod layout;
|
||||
pub mod poly;
|
||||
pub mod via;
|
||||
pub mod zone;
|
||||
|
||||
pub use layout::*;
|
||||
|
|
|
|||
|
|
@ -26,13 +26,13 @@ pub trait GetMaybeApex {
|
|||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Zone<'a, R: AccessRules> {
|
||||
pub index: GenericIndex<ZoneWeight>,
|
||||
pub struct Poly<'a, R: AccessRules> {
|
||||
pub index: GenericIndex<PolyWeight>,
|
||||
layout: &'a Layout<R>,
|
||||
}
|
||||
|
||||
impl<'a, R: AccessRules> Zone<'a, R> {
|
||||
pub fn new(index: GenericIndex<ZoneWeight>, layout: &'a Layout<R>) -> Self {
|
||||
impl<'a, R: AccessRules> Poly<'a, R> {
|
||||
pub fn new(index: GenericIndex<PolyWeight>, layout: &'a Layout<R>) -> Self {
|
||||
Self { index, layout }
|
||||
}
|
||||
|
||||
|
|
@ -48,9 +48,9 @@ impl<'a, R: AccessRules> Zone<'a, R> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a, R: AccessRules> GetLayer for Zone<'a, R> {
|
||||
impl<'a, R: AccessRules> GetLayer for Poly<'a, R> {
|
||||
fn layer(&self) -> usize {
|
||||
if let CompoundWeight::Zone(weight) =
|
||||
if let CompoundWeight::Poly(weight) =
|
||||
self.layout.drawing().compound_weight(self.index.into())
|
||||
{
|
||||
weight.layer()
|
||||
|
|
@ -60,7 +60,7 @@ impl<'a, R: AccessRules> GetLayer for Zone<'a, R> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a, R: AccessRules> GetMaybeNet for Zone<'a, R> {
|
||||
impl<'a, R: AccessRules> GetMaybeNet for Poly<'a, R> {
|
||||
fn maybe_net(&self) -> Option<usize> {
|
||||
self.layout
|
||||
.drawing()
|
||||
|
|
@ -69,7 +69,7 @@ impl<'a, R: AccessRules> GetMaybeNet for Zone<'a, R> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a, R: AccessRules> MakePolyShape for Zone<'a, R> {
|
||||
impl<'a, R: AccessRules> MakePolyShape for Poly<'a, R> {
|
||||
fn shape(&self) -> PolyShape {
|
||||
PolyShape {
|
||||
polygon: Polygon::new(
|
||||
|
|
@ -103,7 +103,7 @@ impl<'a, R: AccessRules> MakePolyShape for Zone<'a, R> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a, R: AccessRules> GetMaybeApex for Zone<'a, R> {
|
||||
impl<'a, R: AccessRules> GetMaybeApex for Poly<'a, R> {
|
||||
fn maybe_apex(&self) -> Option<FixedDotIndex> {
|
||||
self.layout
|
||||
.drawing()
|
||||
|
|
@ -123,61 +123,61 @@ impl<'a, R: AccessRules> GetMaybeApex for Zone<'a, R> {
|
|||
|
||||
#[enum_dispatch(GetLayer, GetMaybeNet)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
pub enum ZoneWeight {
|
||||
Solid(SolidZoneWeight),
|
||||
Pour(PourZoneWeight),
|
||||
pub enum PolyWeight {
|
||||
Solid(SolidPolyWeight),
|
||||
Pour(PourPolyWeight),
|
||||
}
|
||||
|
||||
impl From<GenericIndex<ZoneWeight>> for GenericIndex<CompoundWeight> {
|
||||
fn from(zone: GenericIndex<ZoneWeight>) -> Self {
|
||||
GenericIndex::<CompoundWeight>::new(zone.petgraph_index())
|
||||
impl From<GenericIndex<PolyWeight>> for GenericIndex<CompoundWeight> {
|
||||
fn from(poly: GenericIndex<PolyWeight>) -> Self {
|
||||
GenericIndex::<CompoundWeight>::new(poly.petgraph_index())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
pub struct SolidZoneWeight {
|
||||
pub struct SolidPolyWeight {
|
||||
pub layer: usize,
|
||||
pub maybe_net: Option<usize>,
|
||||
}
|
||||
|
||||
impl GetLayer for SolidZoneWeight {
|
||||
impl GetLayer for SolidPolyWeight {
|
||||
fn layer(&self) -> usize {
|
||||
self.layer
|
||||
}
|
||||
}
|
||||
|
||||
impl GetMaybeNet for SolidZoneWeight {
|
||||
impl GetMaybeNet for SolidPolyWeight {
|
||||
fn maybe_net(&self) -> Option<usize> {
|
||||
self.maybe_net
|
||||
}
|
||||
}
|
||||
|
||||
impl From<GenericIndex<SolidZoneWeight>> for GenericIndex<CompoundWeight> {
|
||||
fn from(zone: GenericIndex<SolidZoneWeight>) -> Self {
|
||||
GenericIndex::<CompoundWeight>::new(zone.petgraph_index())
|
||||
impl From<GenericIndex<SolidPolyWeight>> for GenericIndex<CompoundWeight> {
|
||||
fn from(poly: GenericIndex<SolidPolyWeight>) -> Self {
|
||||
GenericIndex::<CompoundWeight>::new(poly.petgraph_index())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
pub struct PourZoneWeight {
|
||||
pub struct PourPolyWeight {
|
||||
pub layer: usize,
|
||||
pub maybe_net: Option<usize>,
|
||||
}
|
||||
|
||||
impl<'a> GetLayer for PourZoneWeight {
|
||||
impl<'a> GetLayer for PourPolyWeight {
|
||||
fn layer(&self) -> usize {
|
||||
self.layer
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> GetMaybeNet for PourZoneWeight {
|
||||
impl<'a> GetMaybeNet for PourPolyWeight {
|
||||
fn maybe_net(&self) -> Option<usize> {
|
||||
self.maybe_net
|
||||
}
|
||||
}
|
||||
|
||||
impl From<GenericIndex<PourZoneWeight>> for GenericIndex<CompoundWeight> {
|
||||
fn from(zone: GenericIndex<PourZoneWeight>) -> Self {
|
||||
GenericIndex::<CompoundWeight>::new(zone.petgraph_index())
|
||||
impl From<GenericIndex<PourPolyWeight>> for GenericIndex<CompoundWeight> {
|
||||
fn from(poly: GenericIndex<PourPolyWeight>) -> Self {
|
||||
GenericIndex::<CompoundWeight>::new(poly.petgraph_index())
|
||||
}
|
||||
}
|
||||
|
|
@ -6,7 +6,7 @@ use thiserror::Error;
|
|||
use crate::{
|
||||
board::{mesadata::AccessMesadata, Board},
|
||||
drawing::{dot::FixedDotWeight, seg::FixedSegWeight, Drawing},
|
||||
layout::{zone::SolidZoneWeight, Layout},
|
||||
layout::{poly::SolidPolyWeight, Layout},
|
||||
math::Circle,
|
||||
specctra::{
|
||||
mesadata::SpecctraMesadata,
|
||||
|
|
@ -389,8 +389,8 @@ impl SpecctraDesign {
|
|||
net: usize,
|
||||
maybe_pin: Option<String>,
|
||||
) {
|
||||
let zone = board.add_zone(
|
||||
SolidZoneWeight {
|
||||
let poly = board.add_poly(
|
||||
SolidPolyWeight {
|
||||
layer,
|
||||
maybe_net: Some(net),
|
||||
}
|
||||
|
|
@ -399,7 +399,7 @@ impl SpecctraDesign {
|
|||
);
|
||||
|
||||
// Corners.
|
||||
let dot_1_1 = board.add_zone_fixed_dot_infringably(
|
||||
let dot_1_1 = board.add_poly_fixed_dot_infringably(
|
||||
FixedDotWeight {
|
||||
circle: Circle {
|
||||
pos: Self::pos(place_pos, place_rot, pin_pos, pin_rot, x1, y1),
|
||||
|
|
@ -408,9 +408,9 @@ impl SpecctraDesign {
|
|||
layer,
|
||||
maybe_net: Some(net),
|
||||
},
|
||||
zone,
|
||||
poly,
|
||||
);
|
||||
let dot_2_1 = board.add_zone_fixed_dot_infringably(
|
||||
let dot_2_1 = board.add_poly_fixed_dot_infringably(
|
||||
FixedDotWeight {
|
||||
circle: Circle {
|
||||
pos: Self::pos(place_pos, place_rot, pin_pos, pin_rot, x2, y1),
|
||||
|
|
@ -419,9 +419,9 @@ impl SpecctraDesign {
|
|||
layer,
|
||||
maybe_net: Some(net),
|
||||
},
|
||||
zone,
|
||||
poly,
|
||||
);
|
||||
let dot_2_2 = board.add_zone_fixed_dot_infringably(
|
||||
let dot_2_2 = board.add_poly_fixed_dot_infringably(
|
||||
FixedDotWeight {
|
||||
circle: Circle {
|
||||
pos: Self::pos(place_pos, place_rot, pin_pos, pin_rot, x2, y2),
|
||||
|
|
@ -430,9 +430,9 @@ impl SpecctraDesign {
|
|||
layer,
|
||||
maybe_net: Some(net),
|
||||
},
|
||||
zone,
|
||||
poly,
|
||||
);
|
||||
let dot_1_2 = board.add_zone_fixed_dot_infringably(
|
||||
let dot_1_2 = board.add_poly_fixed_dot_infringably(
|
||||
FixedDotWeight {
|
||||
circle: Circle {
|
||||
pos: Self::pos(place_pos, place_rot, pin_pos, pin_rot, x1, y2),
|
||||
|
|
@ -441,10 +441,10 @@ impl SpecctraDesign {
|
|||
layer,
|
||||
maybe_net: Some(net),
|
||||
},
|
||||
zone,
|
||||
poly,
|
||||
);
|
||||
// Sides.
|
||||
board.add_zone_fixed_seg_infringably(
|
||||
board.add_poly_fixed_seg_infringably(
|
||||
dot_1_1,
|
||||
dot_2_1,
|
||||
FixedSegWeight {
|
||||
|
|
@ -452,9 +452,9 @@ impl SpecctraDesign {
|
|||
layer,
|
||||
maybe_net: Some(net),
|
||||
},
|
||||
zone,
|
||||
poly,
|
||||
);
|
||||
board.add_zone_fixed_seg_infringably(
|
||||
board.add_poly_fixed_seg_infringably(
|
||||
dot_2_1,
|
||||
dot_2_2,
|
||||
FixedSegWeight {
|
||||
|
|
@ -462,9 +462,9 @@ impl SpecctraDesign {
|
|||
layer,
|
||||
maybe_net: Some(net),
|
||||
},
|
||||
zone,
|
||||
poly,
|
||||
);
|
||||
board.add_zone_fixed_seg_infringably(
|
||||
board.add_poly_fixed_seg_infringably(
|
||||
dot_2_2,
|
||||
dot_1_2,
|
||||
FixedSegWeight {
|
||||
|
|
@ -472,9 +472,9 @@ impl SpecctraDesign {
|
|||
layer,
|
||||
maybe_net: Some(net),
|
||||
},
|
||||
zone,
|
||||
poly,
|
||||
);
|
||||
board.add_zone_fixed_seg_infringably(
|
||||
board.add_poly_fixed_seg_infringably(
|
||||
dot_1_2,
|
||||
dot_1_1,
|
||||
FixedSegWeight {
|
||||
|
|
@ -482,7 +482,7 @@ impl SpecctraDesign {
|
|||
layer,
|
||||
maybe_net: Some(net),
|
||||
},
|
||||
zone,
|
||||
poly,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -568,8 +568,8 @@ impl SpecctraDesign {
|
|||
net: usize,
|
||||
maybe_pin: Option<String>,
|
||||
) {
|
||||
let zone = board.add_zone(
|
||||
SolidZoneWeight {
|
||||
let poly = board.add_poly(
|
||||
SolidPolyWeight {
|
||||
layer,
|
||||
maybe_net: Some(net),
|
||||
}
|
||||
|
|
@ -578,7 +578,7 @@ impl SpecctraDesign {
|
|||
);
|
||||
|
||||
// add the first coordinate in the wire path as a dot and save its index
|
||||
let mut prev_index = board.add_zone_fixed_dot_infringably(
|
||||
let mut prev_index = board.add_poly_fixed_dot_infringably(
|
||||
FixedDotWeight {
|
||||
circle: Circle {
|
||||
pos: Self::pos(
|
||||
|
|
@ -595,13 +595,13 @@ impl SpecctraDesign {
|
|||
maybe_net: Some(net),
|
||||
},
|
||||
// TODO: This manual retagging shouldn't be necessary, `.into()` should suffice.
|
||||
//GenericIndex::new(zone.petgraph_index()).into(),
|
||||
zone,
|
||||
//GenericIndex::new(poly.petgraph_index()).into(),
|
||||
poly,
|
||||
);
|
||||
|
||||
// iterate through path coords starting from the second
|
||||
for coord in coords.iter().skip(1) {
|
||||
let index = board.add_zone_fixed_dot_infringably(
|
||||
let index = board.add_poly_fixed_dot_infringably(
|
||||
FixedDotWeight {
|
||||
circle: Circle {
|
||||
pos: Self::pos(place_pos, place_rot, pin_pos, pin_rot, coord.x, coord.y)
|
||||
|
|
@ -612,11 +612,11 @@ impl SpecctraDesign {
|
|||
maybe_net: Some(net),
|
||||
},
|
||||
// TODO: This manual retagging shouldn't be necessary, `.into()` should suffice.
|
||||
zone,
|
||||
poly,
|
||||
);
|
||||
|
||||
// add a seg between the current and previous coords
|
||||
let _ = board.add_zone_fixed_seg_infringably(
|
||||
let _ = board.add_poly_fixed_seg_infringably(
|
||||
prev_index,
|
||||
index,
|
||||
FixedSegWeight {
|
||||
|
|
@ -625,7 +625,7 @@ impl SpecctraDesign {
|
|||
maybe_net: Some(net),
|
||||
},
|
||||
// TODO: This manual retagging shouldn't be necessary, `.into()` should suffice.
|
||||
zone,
|
||||
poly,
|
||||
);
|
||||
|
||||
prev_index = index;
|
||||
|
|
|
|||
Loading…
Reference in New Issue