mirror of https://codeberg.org/topola/topola.git
refactor(drawing): factor out common {Bend,Dot,Seg}Weight fields
This commit is contained in:
parent
2e4b3b52ab
commit
1e690ace11
|
|
@ -10,7 +10,7 @@ use crate::{
|
||||||
board::AccessMesadata,
|
board::AccessMesadata,
|
||||||
drawing::{
|
drawing::{
|
||||||
band::BandTermsegIndex,
|
band::BandTermsegIndex,
|
||||||
dot::{FixedDotIndex, FixedDotWeight},
|
dot::{FixedDotIndex, FixedDotWeight, GeneralDotWeight},
|
||||||
},
|
},
|
||||||
layout::LayoutEdit,
|
layout::LayoutEdit,
|
||||||
math::Circle,
|
math::Circle,
|
||||||
|
|
@ -34,14 +34,14 @@ impl PointrouteExecutionStepper {
|
||||||
) -> Result<Self, AutorouterError> {
|
) -> Result<Self, AutorouterError> {
|
||||||
let destination = autorouter.board.add_fixed_dot_infringably(
|
let destination = autorouter.board.add_fixed_dot_infringably(
|
||||||
&mut LayoutEdit::new(),
|
&mut LayoutEdit::new(),
|
||||||
FixedDotWeight {
|
FixedDotWeight(GeneralDotWeight {
|
||||||
circle: Circle {
|
circle: Circle {
|
||||||
pos: point,
|
pos: point,
|
||||||
r: options.router_options.routed_band_width / 2.0,
|
r: options.router_options.routed_band_width / 2.0,
|
||||||
},
|
},
|
||||||
layer: 0,
|
layer: 0,
|
||||||
maybe_net: None,
|
maybe_net: None,
|
||||||
},
|
}),
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ use crate::{
|
||||||
drawing::{
|
drawing::{
|
||||||
band::BandUid,
|
band::BandUid,
|
||||||
bend::{BendIndex, BendWeight},
|
bend::{BendIndex, BendWeight},
|
||||||
dot::{DotIndex, DotWeight, FixedDotIndex, FixedDotWeight},
|
dot::{DotIndex, DotWeight, FixedDotIndex, FixedDotWeight, GeneralDotWeight},
|
||||||
graph::{GetLayer, GetMaybeNet, PrimitiveIndex, PrimitiveWeight},
|
graph::{GetLayer, GetMaybeNet, PrimitiveIndex, PrimitiveWeight},
|
||||||
seg::{FixedSegIndex, FixedSegWeight, SegIndex, SegWeight},
|
seg::{FixedSegIndex, FixedSegWeight, SegIndex, SegWeight},
|
||||||
Collect,
|
Collect,
|
||||||
|
|
@ -246,14 +246,14 @@ impl<M: AccessMesadata> Board<M> {
|
||||||
} else {
|
} else {
|
||||||
self.add_poly_fixed_dot_infringably(
|
self.add_poly_fixed_dot_infringably(
|
||||||
recorder,
|
recorder,
|
||||||
FixedDotWeight {
|
FixedDotWeight(GeneralDotWeight {
|
||||||
circle: Circle {
|
circle: Circle {
|
||||||
pos: resolved_poly.shape().center(),
|
pos: resolved_poly.shape().center(),
|
||||||
r: 100.0,
|
r: 100.0,
|
||||||
},
|
},
|
||||||
layer: resolved_poly.layer(),
|
layer: resolved_poly.layer(),
|
||||||
maybe_net: resolved_poly.maybe_net(),
|
maybe_net: resolved_poly.maybe_net(),
|
||||||
},
|
}),
|
||||||
poly,
|
poly,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,57 +74,71 @@ impl TryFrom<PrimitiveWeight> for BendWeight {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||||
pub struct FixedBendWeight {
|
pub struct FixedBendWeight(pub GeneralBendWeight);
|
||||||
pub width: f64,
|
impl_weight_forward!(FixedBendWeight, FixedBend, FixedBendIndex);
|
||||||
pub offset: f64,
|
|
||||||
pub layer: usize,
|
|
||||||
pub maybe_net: Option<usize>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl_fixed_weight!(FixedBendWeight, FixedBend, FixedBendIndex);
|
|
||||||
|
|
||||||
impl GetOffset for FixedBendWeight {
|
impl GetOffset for FixedBendWeight {
|
||||||
fn offset(&self) -> f64 {
|
fn offset(&self) -> f64 {
|
||||||
self.offset
|
self.0.offset()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SetOffset for FixedBendWeight {
|
impl SetOffset for FixedBendWeight {
|
||||||
fn set_offset(&mut self, offset: f64) {
|
fn set_offset(&mut self, offset: f64) {
|
||||||
self.offset = offset
|
self.0.set_offset(offset);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl GetWidth for FixedBendWeight {
|
|
||||||
fn width(&self) -> f64 {
|
|
||||||
self.width
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||||
pub struct LooseBendWeight {
|
pub struct LooseBendWeight(pub GeneralBendWeight);
|
||||||
|
impl_weight_forward!(LooseBendWeight, LooseBend, LooseBendIndex);
|
||||||
|
|
||||||
|
impl GetOffset for LooseBendWeight {
|
||||||
|
fn offset(&self) -> f64 {
|
||||||
|
self.0.offset()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl SetOffset for LooseBendWeight {
|
||||||
|
fn set_offset(&mut self, offset: f64) {
|
||||||
|
self.0.set_offset(offset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||||
|
pub struct GeneralBendWeight {
|
||||||
pub width: f64,
|
pub width: f64,
|
||||||
pub offset: f64,
|
pub offset: f64,
|
||||||
pub layer: usize,
|
pub layer: usize,
|
||||||
pub maybe_net: Option<usize>,
|
pub maybe_net: Option<usize>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl GetOffset for LooseBendWeight {
|
impl GetLayer for GeneralBendWeight {
|
||||||
|
fn layer(&self) -> usize {
|
||||||
|
self.layer
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl GetMaybeNet for GeneralBendWeight {
|
||||||
|
fn maybe_net(&self) -> Option<usize> {
|
||||||
|
self.maybe_net
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl GetOffset for GeneralBendWeight {
|
||||||
fn offset(&self) -> f64 {
|
fn offset(&self) -> f64 {
|
||||||
self.offset
|
self.offset
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SetOffset for LooseBendWeight {
|
impl SetOffset for GeneralBendWeight {
|
||||||
fn set_offset(&mut self, offset: f64) {
|
fn set_offset(&mut self, offset: f64) {
|
||||||
self.offset = offset
|
self.offset = offset
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl GetWidth for LooseBendWeight {
|
impl GetWidth for GeneralBendWeight {
|
||||||
fn width(&self) -> f64 {
|
fn width(&self) -> f64 {
|
||||||
self.width
|
self.width
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl_loose_weight!(LooseBendWeight, LooseBend, LooseBendIndex);
|
|
||||||
|
|
|
||||||
|
|
@ -76,50 +76,61 @@ impl TryFrom<PrimitiveWeight> for DotWeight {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||||
pub struct FixedDotWeight {
|
pub struct FixedDotWeight(pub GeneralDotWeight);
|
||||||
pub circle: Circle,
|
impl_weight_forward!(FixedDotWeight, FixedDot, FixedDotIndex);
|
||||||
pub layer: usize,
|
|
||||||
pub maybe_net: Option<usize>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl_fixed_weight!(FixedDotWeight, FixedDot, FixedDotIndex);
|
|
||||||
|
|
||||||
impl GetSetPos for FixedDotWeight {
|
impl GetSetPos for FixedDotWeight {
|
||||||
fn pos(&self) -> Point {
|
fn pos(&self) -> Point {
|
||||||
self.circle.pos
|
self.0.pos()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_pos(&mut self, pos: Point) {
|
fn set_pos(&mut self, pos: Point) {
|
||||||
self.circle.pos = pos
|
self.0.set_pos(pos);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl GetWidth for FixedDotWeight {
|
|
||||||
fn width(&self) -> f64 {
|
|
||||||
self.circle.r * 2.0
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||||
pub struct LooseDotWeight {
|
pub struct LooseDotWeight(pub GeneralDotWeight);
|
||||||
|
impl_weight_forward!(LooseDotWeight, LooseDot, LooseDotIndex);
|
||||||
|
|
||||||
|
impl GetSetPos for LooseDotWeight {
|
||||||
|
fn pos(&self) -> Point {
|
||||||
|
self.0.pos()
|
||||||
|
}
|
||||||
|
fn set_pos(&mut self, pos: Point) {
|
||||||
|
self.0.set_pos(pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||||
|
pub struct GeneralDotWeight {
|
||||||
pub circle: Circle,
|
pub circle: Circle,
|
||||||
pub layer: usize,
|
pub layer: usize,
|
||||||
pub maybe_net: Option<usize>,
|
pub maybe_net: Option<usize>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl_loose_weight!(LooseDotWeight, LooseDot, LooseDotIndex);
|
impl GetLayer for GeneralDotWeight {
|
||||||
|
fn layer(&self) -> usize {
|
||||||
|
self.layer
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl GetSetPos for LooseDotWeight {
|
impl GetMaybeNet for GeneralDotWeight {
|
||||||
|
fn maybe_net(&self) -> Option<usize> {
|
||||||
|
self.maybe_net
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl GetSetPos for GeneralDotWeight {
|
||||||
fn pos(&self) -> Point {
|
fn pos(&self) -> Point {
|
||||||
self.circle.pos
|
self.circle.pos
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_pos(&mut self, pos: Point) {
|
fn set_pos(&mut self, pos: Point) {
|
||||||
self.circle.pos = pos
|
self.circle.pos = pos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl GetWidth for LooseDotWeight {
|
impl GetWidth for GeneralDotWeight {
|
||||||
fn width(&self) -> f64 {
|
fn width(&self) -> f64 {
|
||||||
self.circle.r * 2.0
|
self.circle.r * 2.0
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -329,7 +329,7 @@ impl<CW: Copy, R: AccessRules> Drawing<CW, R> {
|
||||||
) -> Result<LooseBendIndex, DrawingException> {
|
) -> Result<LooseBendIndex, DrawingException> {
|
||||||
// It makes no sense to wrap something around or under one of its connectables.
|
// It makes no sense to wrap something around or under one of its connectables.
|
||||||
//
|
//
|
||||||
if let Some(net) = weight.maybe_net {
|
if let Some(net) = weight.maybe_net() {
|
||||||
if let Some(around_net) = around.primitive(self).maybe_net() {
|
if let Some(around_net) = around.primitive(self).maybe_net() {
|
||||||
if net == around_net {
|
if net == around_net {
|
||||||
return Err(AlreadyConnected(net, around.into()).into());
|
return Err(AlreadyConnected(net, around.into()).into());
|
||||||
|
|
|
||||||
|
|
@ -59,23 +59,29 @@ pub trait MakePrimitive {
|
||||||
) -> Primitive<'a, CW, R>;
|
) -> Primitive<'a, CW, R>;
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! impl_weight {
|
macro_rules! impl_weight_forward {
|
||||||
($weight_struct:ident, $weight_variant:ident, $index_struct:ident) => {
|
($weight_struct:ty, $weight_variant:ident, $index_struct:ident) => {
|
||||||
impl Retag<PrimitiveIndex> for $weight_struct {
|
impl Retag<PrimitiveIndex> for $weight_struct {
|
||||||
fn retag(&self, index: NodeIndex<usize>) -> PrimitiveIndex {
|
fn retag(&self, index: NodeIndex<usize>) -> PrimitiveIndex {
|
||||||
PrimitiveIndex::$weight_variant($index_struct::new(index))
|
PrimitiveIndex::$weight_variant($index_struct::new(index))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> GetLayer for $weight_struct {
|
impl GetLayer for $weight_struct {
|
||||||
fn layer(&self) -> usize {
|
fn layer(&self) -> usize {
|
||||||
self.layer
|
self.0.layer()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> GetMaybeNet for $weight_struct {
|
impl GetMaybeNet for $weight_struct {
|
||||||
fn maybe_net(&self) -> Option<usize> {
|
fn maybe_net(&self) -> Option<usize> {
|
||||||
self.maybe_net
|
self.0.maybe_net()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl GetWidth for $weight_struct {
|
||||||
|
fn width(&self) -> f64 {
|
||||||
|
self.0.width()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -92,18 +98,6 @@ macro_rules! impl_weight {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! impl_fixed_weight {
|
|
||||||
($weight_struct:ident, $weight_variant:ident, $index_struct:ident) => {
|
|
||||||
impl_weight!($weight_struct, $weight_variant, $index_struct);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
macro_rules! impl_loose_weight {
|
|
||||||
($weight_struct:ident, $weight_variant:ident, $index_struct:ident) => {
|
|
||||||
impl_weight!($weight_struct, $weight_variant, $index_struct);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: This enum shouldn't exist: we shouldn't be carrying the tag around like this. Instead we
|
// TODO: This enum shouldn't exist: we shouldn't be carrying the tag around like this. Instead we
|
||||||
// should be getting it from the graph when it's needed.
|
// should be getting it from the graph when it's needed.
|
||||||
#[enum_dispatch(GetPetgraphIndex, MakePrimitive)]
|
#[enum_dispatch(GetPetgraphIndex, MakePrimitive)]
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ impl<CW: Copy, R: AccessRules> Guide for Drawing<CW, R> {
|
||||||
) -> Result<Line, NoTangents> {
|
) -> Result<Line, NoTangents> {
|
||||||
let from_circle = self.head_circle(head, width);
|
let from_circle = self.head_circle(head, width);
|
||||||
let to_circle = Circle {
|
let to_circle = Circle {
|
||||||
pos: self.primitive(into).weight().circle.pos,
|
pos: self.primitive(into).weight().0.circle.pos,
|
||||||
r: 0.0,
|
r: 0.0,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -476,7 +476,7 @@ impl<'a, CW: Copy, R: AccessRules> GetLimbs for LooseBend<'a, CW, R> {}
|
||||||
|
|
||||||
impl<'a, CW: Copy, R: AccessRules> GetOffset for LooseBend<'a, CW, R> {
|
impl<'a, CW: Copy, R: AccessRules> GetOffset for LooseBend<'a, CW, R> {
|
||||||
fn offset(&self) -> f64 {
|
fn offset(&self) -> f64 {
|
||||||
self.weight().offset
|
self.weight().offset()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -80,45 +80,37 @@ impl TryFrom<PrimitiveWeight> for SegWeight {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||||
pub struct FixedSegWeight {
|
pub struct FixedSegWeight(pub GeneralSegWeight);
|
||||||
pub width: f64,
|
impl_weight_forward!(FixedSegWeight, FixedSeg, FixedSegIndex);
|
||||||
pub layer: usize,
|
|
||||||
pub maybe_net: Option<usize>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl_fixed_weight!(FixedSegWeight, FixedSeg, FixedSegIndex);
|
|
||||||
|
|
||||||
impl GetWidth for FixedSegWeight {
|
|
||||||
fn width(&self) -> f64 {
|
|
||||||
self.width
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||||
pub struct LoneLooseSegWeight {
|
pub struct LoneLooseSegWeight(pub GeneralSegWeight);
|
||||||
pub width: f64,
|
impl_weight_forward!(LoneLooseSegWeight, LoneLooseSeg, LoneLooseSegIndex);
|
||||||
pub layer: usize,
|
|
||||||
pub maybe_net: Option<usize>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl_loose_weight!(LoneLooseSegWeight, LoneLooseSeg, LoneLooseSegIndex);
|
|
||||||
|
|
||||||
impl GetWidth for LoneLooseSegWeight {
|
|
||||||
fn width(&self) -> f64 {
|
|
||||||
self.width
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||||
pub struct SeqLooseSegWeight {
|
pub struct SeqLooseSegWeight(pub GeneralSegWeight);
|
||||||
|
impl_weight_forward!(SeqLooseSegWeight, SeqLooseSeg, SeqLooseSegIndex);
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||||
|
pub struct GeneralSegWeight {
|
||||||
pub width: f64,
|
pub width: f64,
|
||||||
pub layer: usize,
|
pub layer: usize,
|
||||||
pub maybe_net: Option<usize>,
|
pub maybe_net: Option<usize>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl_loose_weight!(SeqLooseSegWeight, SeqLooseSeg, SeqLooseSegIndex);
|
impl GetLayer for GeneralSegWeight {
|
||||||
|
fn layer(&self) -> usize {
|
||||||
|
self.layer
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl GetWidth for SeqLooseSegWeight {
|
impl GetMaybeNet for GeneralSegWeight {
|
||||||
|
fn maybe_net(&self) -> Option<usize> {
|
||||||
|
self.maybe_net
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl GetWidth for GeneralSegWeight {
|
||||||
fn width(&self) -> f64 {
|
fn width(&self) -> f64 {
|
||||||
self.width
|
self.width
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,10 @@ use crate::{
|
||||||
drawing::{
|
drawing::{
|
||||||
band::BandTermsegIndex,
|
band::BandTermsegIndex,
|
||||||
bend::{BendIndex, BendWeight, LooseBendWeight},
|
bend::{BendIndex, BendWeight, LooseBendWeight},
|
||||||
dot::{DotIndex, DotWeight, FixedDotIndex, FixedDotWeight, LooseDotIndex, LooseDotWeight},
|
dot::{
|
||||||
|
DotIndex, DotWeight, FixedDotIndex, FixedDotWeight, GeneralDotWeight, LooseDotIndex,
|
||||||
|
LooseDotWeight,
|
||||||
|
},
|
||||||
gear::GearIndex,
|
gear::GearIndex,
|
||||||
graph::{GetMaybeNet, IsInLayer, MakePrimitive, PrimitiveIndex, PrimitiveWeight},
|
graph::{GetMaybeNet, IsInLayer, MakePrimitive, PrimitiveIndex, PrimitiveWeight},
|
||||||
primitive::MakePrimitiveShape,
|
primitive::MakePrimitiveShape,
|
||||||
|
|
@ -99,11 +102,11 @@ impl<R: AccessRules> Layout<R> {
|
||||||
for layer in weight.from_layer..=weight.to_layer {
|
for layer in weight.from_layer..=weight.to_layer {
|
||||||
match self.drawing.add_fixed_dot(
|
match self.drawing.add_fixed_dot(
|
||||||
recorder,
|
recorder,
|
||||||
FixedDotWeight {
|
FixedDotWeight(GeneralDotWeight {
|
||||||
circle: weight.circle,
|
circle: weight.circle,
|
||||||
layer,
|
layer,
|
||||||
maybe_net: weight.maybe_net,
|
maybe_net: weight.maybe_net,
|
||||||
},
|
}),
|
||||||
) {
|
) {
|
||||||
Ok(dot) => {
|
Ok(dot) => {
|
||||||
self.drawing.add_to_compound(recorder, dot, compound);
|
self.drawing.add_to_compound(recorder, dot, compound);
|
||||||
|
|
|
||||||
|
|
@ -11,14 +11,14 @@ use thiserror::Error;
|
||||||
use crate::{
|
use crate::{
|
||||||
drawing::{
|
drawing::{
|
||||||
band::BandTermsegIndex,
|
band::BandTermsegIndex,
|
||||||
bend::{BendIndex, LooseBendWeight},
|
bend::{BendIndex, GeneralBendWeight, LooseBendWeight},
|
||||||
dot::{DotIndex, FixedDotIndex, LooseDotIndex, LooseDotWeight},
|
dot::{DotIndex, FixedDotIndex, GeneralDotWeight, LooseDotIndex, LooseDotWeight},
|
||||||
gear::GearIndex,
|
gear::GearIndex,
|
||||||
graph::{GetLayer, GetMaybeNet, MakePrimitive},
|
graph::{GetLayer, GetMaybeNet, MakePrimitive},
|
||||||
head::{CaneHead, GetFace, Head},
|
head::{CaneHead, GetFace, Head},
|
||||||
primitive::GetOtherJoint,
|
primitive::GetOtherJoint,
|
||||||
rules::AccessRules,
|
rules::AccessRules,
|
||||||
seg::{LoneLooseSegWeight, SeqLooseSegWeight},
|
seg::{GeneralSegWeight, LoneLooseSegWeight, SeqLooseSegWeight},
|
||||||
DrawingException, Guide, Infringement,
|
DrawingException, Guide, Infringement,
|
||||||
},
|
},
|
||||||
layout::{Layout, LayoutEdit},
|
layout::{Layout, LayoutEdit},
|
||||||
|
|
@ -98,11 +98,11 @@ impl<R: AccessRules> Draw for Layout<R> {
|
||||||
recorder,
|
recorder,
|
||||||
dot,
|
dot,
|
||||||
into,
|
into,
|
||||||
LoneLooseSegWeight {
|
LoneLooseSegWeight(GeneralSegWeight {
|
||||||
width,
|
width,
|
||||||
layer,
|
layer,
|
||||||
maybe_net,
|
maybe_net,
|
||||||
},
|
}),
|
||||||
)
|
)
|
||||||
.map_err(|err| DrawException::CannotFinishIn(into, err.into()))?,
|
.map_err(|err| DrawException::CannotFinishIn(into, err.into()))?,
|
||||||
),
|
),
|
||||||
|
|
@ -111,11 +111,11 @@ impl<R: AccessRules> Draw for Layout<R> {
|
||||||
recorder,
|
recorder,
|
||||||
into.into(),
|
into.into(),
|
||||||
dot,
|
dot,
|
||||||
SeqLooseSegWeight {
|
SeqLooseSegWeight(GeneralSegWeight {
|
||||||
width,
|
width,
|
||||||
layer,
|
layer,
|
||||||
maybe_net,
|
maybe_net,
|
||||||
},
|
}),
|
||||||
)
|
)
|
||||||
.map_err(|err| DrawException::CannotFinishIn(into, err.into()))?,
|
.map_err(|err| DrawException::CannotFinishIn(into, err.into()))?,
|
||||||
),
|
),
|
||||||
|
|
@ -279,25 +279,25 @@ impl<R: AccessRules> DrawPrivate for Layout<R> {
|
||||||
recorder,
|
recorder,
|
||||||
head.face(),
|
head.face(),
|
||||||
around,
|
around,
|
||||||
LooseDotWeight {
|
LooseDotWeight(GeneralDotWeight {
|
||||||
circle: Circle {
|
circle: Circle {
|
||||||
pos: to,
|
pos: to,
|
||||||
r: width / 2.0,
|
r: width / 2.0,
|
||||||
},
|
},
|
||||||
layer,
|
layer,
|
||||||
maybe_net,
|
maybe_net,
|
||||||
},
|
}),
|
||||||
SeqLooseSegWeight {
|
SeqLooseSegWeight(GeneralSegWeight {
|
||||||
width,
|
width,
|
||||||
layer,
|
layer,
|
||||||
maybe_net,
|
maybe_net,
|
||||||
},
|
}),
|
||||||
LooseBendWeight {
|
LooseBendWeight(GeneralBendWeight {
|
||||||
width,
|
width,
|
||||||
offset,
|
offset,
|
||||||
layer,
|
layer,
|
||||||
maybe_net,
|
maybe_net,
|
||||||
},
|
}),
|
||||||
cw,
|
cw,
|
||||||
)?;
|
)?;
|
||||||
Ok(CaneHead {
|
Ok(CaneHead {
|
||||||
|
|
|
||||||
|
|
@ -13,10 +13,10 @@ use geo::{point, Point, Rotate};
|
||||||
use crate::{
|
use crate::{
|
||||||
board::{AccessMesadata, Board},
|
board::{AccessMesadata, Board},
|
||||||
drawing::{
|
drawing::{
|
||||||
dot::FixedDotWeight,
|
dot::{FixedDotWeight, GeneralDotWeight},
|
||||||
graph::{GetLayer, GetMaybeNet, MakePrimitive},
|
graph::{GetLayer, GetMaybeNet, MakePrimitive},
|
||||||
primitive::MakePrimitiveShape,
|
primitive::MakePrimitiveShape,
|
||||||
seg::FixedSegWeight,
|
seg::{FixedSegWeight, GeneralSegWeight},
|
||||||
Drawing,
|
Drawing,
|
||||||
},
|
},
|
||||||
geometry::{primitive::PrimitiveShape, GetWidth},
|
geometry::{primitive::PrimitiveShape, GetWidth},
|
||||||
|
|
@ -434,11 +434,11 @@ impl SpecctraDesign {
|
||||||
|
|
||||||
board.add_fixed_dot_infringably(
|
board.add_fixed_dot_infringably(
|
||||||
recorder,
|
recorder,
|
||||||
FixedDotWeight {
|
FixedDotWeight(GeneralDotWeight {
|
||||||
circle,
|
circle,
|
||||||
layer,
|
layer,
|
||||||
maybe_net,
|
maybe_net,
|
||||||
},
|
}),
|
||||||
maybe_pin,
|
maybe_pin,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -465,50 +465,50 @@ impl SpecctraDesign {
|
||||||
// Corners.
|
// Corners.
|
||||||
let dot_1_1 = board.add_poly_fixed_dot_infringably(
|
let dot_1_1 = board.add_poly_fixed_dot_infringably(
|
||||||
recorder,
|
recorder,
|
||||||
FixedDotWeight {
|
FixedDotWeight(GeneralDotWeight {
|
||||||
circle: Circle {
|
circle: Circle {
|
||||||
pos: Self::pos(place, pin, x1, y1),
|
pos: Self::pos(place, pin, x1, y1),
|
||||||
r: 0.5,
|
r: 0.5,
|
||||||
},
|
},
|
||||||
layer,
|
layer,
|
||||||
maybe_net,
|
maybe_net,
|
||||||
},
|
}),
|
||||||
poly,
|
poly,
|
||||||
);
|
);
|
||||||
let dot_2_1 = board.add_poly_fixed_dot_infringably(
|
let dot_2_1 = board.add_poly_fixed_dot_infringably(
|
||||||
recorder,
|
recorder,
|
||||||
FixedDotWeight {
|
FixedDotWeight(GeneralDotWeight {
|
||||||
circle: Circle {
|
circle: Circle {
|
||||||
pos: Self::pos(place, pin, x2, y1),
|
pos: Self::pos(place, pin, x2, y1),
|
||||||
r: 0.5,
|
r: 0.5,
|
||||||
},
|
},
|
||||||
layer,
|
layer,
|
||||||
maybe_net,
|
maybe_net,
|
||||||
},
|
}),
|
||||||
poly,
|
poly,
|
||||||
);
|
);
|
||||||
let dot_2_2 = board.add_poly_fixed_dot_infringably(
|
let dot_2_2 = board.add_poly_fixed_dot_infringably(
|
||||||
recorder,
|
recorder,
|
||||||
FixedDotWeight {
|
FixedDotWeight(GeneralDotWeight {
|
||||||
circle: Circle {
|
circle: Circle {
|
||||||
pos: Self::pos(place, pin, x2, y2),
|
pos: Self::pos(place, pin, x2, y2),
|
||||||
r: 0.5,
|
r: 0.5,
|
||||||
},
|
},
|
||||||
layer,
|
layer,
|
||||||
maybe_net,
|
maybe_net,
|
||||||
},
|
}),
|
||||||
poly,
|
poly,
|
||||||
);
|
);
|
||||||
let dot_1_2 = board.add_poly_fixed_dot_infringably(
|
let dot_1_2 = board.add_poly_fixed_dot_infringably(
|
||||||
recorder,
|
recorder,
|
||||||
FixedDotWeight {
|
FixedDotWeight(GeneralDotWeight {
|
||||||
circle: Circle {
|
circle: Circle {
|
||||||
pos: Self::pos(place, pin, x1, y2),
|
pos: Self::pos(place, pin, x1, y2),
|
||||||
r: 0.5,
|
r: 0.5,
|
||||||
},
|
},
|
||||||
layer,
|
layer,
|
||||||
maybe_net,
|
maybe_net,
|
||||||
},
|
}),
|
||||||
poly,
|
poly,
|
||||||
);
|
);
|
||||||
// Sides.
|
// Sides.
|
||||||
|
|
@ -516,44 +516,44 @@ impl SpecctraDesign {
|
||||||
recorder,
|
recorder,
|
||||||
dot_1_1,
|
dot_1_1,
|
||||||
dot_2_1,
|
dot_2_1,
|
||||||
FixedSegWeight {
|
FixedSegWeight(GeneralSegWeight {
|
||||||
width: 1.0,
|
width: 1.0,
|
||||||
layer,
|
layer,
|
||||||
maybe_net,
|
maybe_net,
|
||||||
},
|
}),
|
||||||
poly,
|
poly,
|
||||||
);
|
);
|
||||||
board.add_poly_fixed_seg_infringably(
|
board.add_poly_fixed_seg_infringably(
|
||||||
recorder,
|
recorder,
|
||||||
dot_2_1,
|
dot_2_1,
|
||||||
dot_2_2,
|
dot_2_2,
|
||||||
FixedSegWeight {
|
FixedSegWeight(GeneralSegWeight {
|
||||||
width: 1.0,
|
width: 1.0,
|
||||||
layer,
|
layer,
|
||||||
maybe_net,
|
maybe_net,
|
||||||
},
|
}),
|
||||||
poly,
|
poly,
|
||||||
);
|
);
|
||||||
board.add_poly_fixed_seg_infringably(
|
board.add_poly_fixed_seg_infringably(
|
||||||
recorder,
|
recorder,
|
||||||
dot_2_2,
|
dot_2_2,
|
||||||
dot_1_2,
|
dot_1_2,
|
||||||
FixedSegWeight {
|
FixedSegWeight(GeneralSegWeight {
|
||||||
width: 1.0,
|
width: 1.0,
|
||||||
layer,
|
layer,
|
||||||
maybe_net,
|
maybe_net,
|
||||||
},
|
}),
|
||||||
poly,
|
poly,
|
||||||
);
|
);
|
||||||
board.add_poly_fixed_seg_infringably(
|
board.add_poly_fixed_seg_infringably(
|
||||||
recorder,
|
recorder,
|
||||||
dot_1_2,
|
dot_1_2,
|
||||||
dot_1_1,
|
dot_1_1,
|
||||||
FixedSegWeight {
|
FixedSegWeight(GeneralSegWeight {
|
||||||
width: 1.0,
|
width: 1.0,
|
||||||
layer,
|
layer,
|
||||||
maybe_net,
|
maybe_net,
|
||||||
},
|
}),
|
||||||
poly,
|
poly,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -573,14 +573,14 @@ impl SpecctraDesign {
|
||||||
let mut prev_pos = Self::pos(place, pin, coords[0].x, coords[0].y);
|
let mut prev_pos = Self::pos(place, pin, coords[0].x, coords[0].y);
|
||||||
let mut prev_index = board.add_fixed_dot_infringably(
|
let mut prev_index = board.add_fixed_dot_infringably(
|
||||||
recorder,
|
recorder,
|
||||||
FixedDotWeight {
|
FixedDotWeight(GeneralDotWeight {
|
||||||
circle: Circle {
|
circle: Circle {
|
||||||
pos: prev_pos,
|
pos: prev_pos,
|
||||||
r: width / 2.0,
|
r: width / 2.0,
|
||||||
},
|
},
|
||||||
layer,
|
layer,
|
||||||
maybe_net,
|
maybe_net,
|
||||||
},
|
}),
|
||||||
maybe_pin.clone(),
|
maybe_pin.clone(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -594,14 +594,14 @@ impl SpecctraDesign {
|
||||||
|
|
||||||
let index = board.add_fixed_dot_infringably(
|
let index = board.add_fixed_dot_infringably(
|
||||||
recorder,
|
recorder,
|
||||||
FixedDotWeight {
|
FixedDotWeight(GeneralDotWeight {
|
||||||
circle: Circle {
|
circle: Circle {
|
||||||
pos,
|
pos,
|
||||||
r: width / 2.0,
|
r: width / 2.0,
|
||||||
},
|
},
|
||||||
layer,
|
layer,
|
||||||
maybe_net,
|
maybe_net,
|
||||||
},
|
}),
|
||||||
maybe_pin.clone(),
|
maybe_pin.clone(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -610,11 +610,11 @@ impl SpecctraDesign {
|
||||||
recorder,
|
recorder,
|
||||||
prev_index,
|
prev_index,
|
||||||
index,
|
index,
|
||||||
FixedSegWeight {
|
FixedSegWeight(GeneralSegWeight {
|
||||||
width,
|
width,
|
||||||
layer,
|
layer,
|
||||||
maybe_net,
|
maybe_net,
|
||||||
},
|
}),
|
||||||
maybe_pin.clone(),
|
maybe_pin.clone(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -643,14 +643,14 @@ impl SpecctraDesign {
|
||||||
// add the first coordinate in the wire path as a dot and save its index
|
// add the first coordinate in the wire path as a dot and save its index
|
||||||
let mut prev_index = board.add_poly_fixed_dot_infringably(
|
let mut prev_index = board.add_poly_fixed_dot_infringably(
|
||||||
recorder,
|
recorder,
|
||||||
FixedDotWeight {
|
FixedDotWeight(GeneralDotWeight {
|
||||||
circle: Circle {
|
circle: Circle {
|
||||||
pos: Self::pos(place, pin, coords[0].x, coords[0].y),
|
pos: Self::pos(place, pin, coords[0].x, coords[0].y),
|
||||||
r: width / 2.0,
|
r: width / 2.0,
|
||||||
},
|
},
|
||||||
layer,
|
layer,
|
||||||
maybe_net,
|
maybe_net,
|
||||||
},
|
}),
|
||||||
// TODO: This manual retagging shouldn't be necessary, `.into()` should suffice.
|
// TODO: This manual retagging shouldn't be necessary, `.into()` should suffice.
|
||||||
//GenericIndex::new(poly.petgraph_index()).into(),
|
//GenericIndex::new(poly.petgraph_index()).into(),
|
||||||
poly,
|
poly,
|
||||||
|
|
@ -660,14 +660,14 @@ impl SpecctraDesign {
|
||||||
for coord in coords.iter().skip(1) {
|
for coord in coords.iter().skip(1) {
|
||||||
let index = board.add_poly_fixed_dot_infringably(
|
let index = board.add_poly_fixed_dot_infringably(
|
||||||
recorder,
|
recorder,
|
||||||
FixedDotWeight {
|
FixedDotWeight(GeneralDotWeight {
|
||||||
circle: Circle {
|
circle: Circle {
|
||||||
pos: Self::pos(place, pin, coord.x, coord.y),
|
pos: Self::pos(place, pin, coord.x, coord.y),
|
||||||
r: width / 2.0,
|
r: width / 2.0,
|
||||||
},
|
},
|
||||||
layer,
|
layer,
|
||||||
maybe_net,
|
maybe_net,
|
||||||
},
|
}),
|
||||||
// TODO: This manual retagging shouldn't be necessary, `.into()` should suffice.
|
// TODO: This manual retagging shouldn't be necessary, `.into()` should suffice.
|
||||||
poly,
|
poly,
|
||||||
);
|
);
|
||||||
|
|
@ -677,11 +677,11 @@ impl SpecctraDesign {
|
||||||
recorder,
|
recorder,
|
||||||
prev_index,
|
prev_index,
|
||||||
index,
|
index,
|
||||||
FixedSegWeight {
|
FixedSegWeight(GeneralSegWeight {
|
||||||
width,
|
width,
|
||||||
layer,
|
layer,
|
||||||
maybe_net,
|
maybe_net,
|
||||||
},
|
}),
|
||||||
// TODO: This manual retagging shouldn't be necessary, `.into()` should suffice.
|
// TODO: This manual retagging shouldn't be necessary, `.into()` should suffice.
|
||||||
poly,
|
poly,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue