mirror of https://codeberg.org/topola/topola.git
layout: implement `MakePrimitiveShape` for vias
This commit is contained in:
parent
c5148b0cb1
commit
5d082d81c0
|
|
@ -17,6 +17,7 @@ use topola::{
|
|||
},
|
||||
graph::{GenericIndex, GetNodeIndex},
|
||||
layout::{
|
||||
via::ViaWeight,
|
||||
zone::{MakePolyShape, Zone, ZoneWeight},
|
||||
CompoundWeight, Layout, NodeIndex,
|
||||
},
|
||||
|
|
@ -78,13 +79,22 @@ impl Overlay {
|
|||
}
|
||||
NodeIndex::Compound(compound) => {
|
||||
match board.layout().drawing().compound_weight(compound) {
|
||||
CompoundWeight::Zone(zone) => Zone::new(
|
||||
/*CompoundWeight::Zone(zone) => Zone::new(
|
||||
GenericIndex::<ZoneWeight>::new(compound.node_index()),
|
||||
board.layout(),
|
||||
)
|
||||
.shape()
|
||||
.into(),
|
||||
CompoundWeight::Via(via) => unreachable!(),
|
||||
.into(),*/
|
||||
CompoundWeight::Zone(weight) => board
|
||||
.layout()
|
||||
.zone(GenericIndex::<ZoneWeight>::new(compound.node_index()))
|
||||
.shape()
|
||||
.into(),
|
||||
CompoundWeight::Via(weight) => board
|
||||
.layout()
|
||||
.via(GenericIndex::<ViaWeight>::new(compound.node_index()))
|
||||
.shape()
|
||||
.into(),
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ use crate::{
|
|||
},
|
||||
graph::{GenericIndex, GetNodeIndex},
|
||||
layout::{
|
||||
via::ViaWeight,
|
||||
via::{Via, ViaWeight},
|
||||
zone::{GetMaybeApex, MakePolyShape, Zone, ZoneWeight},
|
||||
},
|
||||
math::Circle,
|
||||
|
|
@ -256,33 +256,8 @@ impl<R: RulesTrait> Layout<R> {
|
|||
pub fn zone(&self, index: GenericIndex<ZoneWeight>) -> Zone<R> {
|
||||
Zone::new(index, self)
|
||||
}
|
||||
|
||||
pub fn via(&self, index: GenericIndex<ViaWeight>) -> Via<R> {
|
||||
Via::new(index, self)
|
||||
}
|
||||
}
|
||||
|
||||
/*impl<R: RulesTrait> CompoundManagerTrait<ZoneWeight, GenericIndex<ZoneWeight>> for Layout<R> {
|
||||
fn add_compound(&mut self, weight: ZoneWeight) -> GenericIndex<ZoneWeight> {
|
||||
self.drawing.add_compound(weight)
|
||||
}
|
||||
|
||||
fn remove_compound(&mut self, compound: GenericIndex<ZoneWeight>) {
|
||||
self.drawing.remove_compound(compound);
|
||||
}
|
||||
|
||||
fn add_to_compound<W>(
|
||||
&mut self,
|
||||
primitive: GenericIndex<W>,
|
||||
compound: GenericIndex<ZoneWeight>,
|
||||
) {
|
||||
self.drawing.add_to_compound(primitive, compound);
|
||||
}
|
||||
|
||||
fn compound_weight(&self, compound: GenericIndex<ZoneWeight>) -> ZoneWeight {
|
||||
self.drawing.compound_weight(compound)
|
||||
}
|
||||
|
||||
fn compounds<W>(
|
||||
&self,
|
||||
node: GenericIndex<W>,
|
||||
) -> impl Iterator<Item = GenericIndex<ZoneWeight>> {
|
||||
self.drawing.compounds(node)
|
||||
}
|
||||
}*/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
use crate::{
|
||||
drawing::{graph::GetMaybeNet, rules::RulesTrait},
|
||||
geometry::compound::CompoundManagerTrait,
|
||||
drawing::{graph::GetMaybeNet, primitive::MakePrimitiveShape, rules::RulesTrait},
|
||||
geometry::{
|
||||
compound::CompoundManagerTrait,
|
||||
primitive::{DotShape, PrimitiveShape},
|
||||
},
|
||||
graph::{GenericIndex, GetNodeIndex},
|
||||
layout::{CompoundWeight, Layout},
|
||||
math::Circle,
|
||||
|
|
@ -27,6 +30,18 @@ impl<'a, R: RulesTrait> GetMaybeNet for Via<'a, R> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a, R: RulesTrait> MakePrimitiveShape for Via<'a, R> {
|
||||
fn shape(&self) -> PrimitiveShape {
|
||||
if let CompoundWeight::Via(weight) =
|
||||
self.layout.drawing().compound_weight(self.index.into())
|
||||
{
|
||||
weight.shape()
|
||||
} else {
|
||||
unreachable!();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct ViaWeight {
|
||||
pub from_layer: u64,
|
||||
|
|
@ -35,14 +50,20 @@ pub struct ViaWeight {
|
|||
pub maybe_net: Option<usize>,
|
||||
}
|
||||
|
||||
impl From<GenericIndex<ViaWeight>> for GenericIndex<CompoundWeight> {
|
||||
fn from(via: GenericIndex<ViaWeight>) -> Self {
|
||||
GenericIndex::<CompoundWeight>::new(via.node_index())
|
||||
}
|
||||
}
|
||||
|
||||
impl GetMaybeNet for ViaWeight {
|
||||
fn maybe_net(&self) -> Option<usize> {
|
||||
self.maybe_net
|
||||
}
|
||||
}
|
||||
|
||||
impl From<GenericIndex<ViaWeight>> for GenericIndex<CompoundWeight> {
|
||||
fn from(via: GenericIndex<ViaWeight>) -> Self {
|
||||
GenericIndex::<CompoundWeight>::new(via.node_index())
|
||||
impl MakePrimitiveShape for ViaWeight {
|
||||
fn shape(&self) -> PrimitiveShape {
|
||||
DotShape { c: self.circle }.into()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue