mirror of https://codeberg.org/topola/topola.git
geometry: store layer in `usize`, not `u64`
This commit is contained in:
parent
1cca9fe6e1
commit
008dcfeca0
|
|
@ -13,63 +13,36 @@ impl Layers {
|
||||||
pub fn new(board: &Board<impl MesadataTrait>) -> Self {
|
pub fn new(board: &Board<impl MesadataTrait>) -> Self {
|
||||||
let layer_count = board.layout().drawing().layer_count();
|
let layer_count = board.layout().drawing().layer_count();
|
||||||
let visible = std::iter::repeat(true)
|
let visible = std::iter::repeat(true)
|
||||||
.take(layer_count.try_into().unwrap() /* FIXME */)
|
.take(layer_count)
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
.into_boxed_slice();
|
.into_boxed_slice();
|
||||||
|
|
||||||
let colors = std::iter::repeat(egui::Color32::from_rgb(255, 255, 255))
|
let colors = std::iter::repeat(egui::Color32::from_rgb(255, 255, 255))
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.map(|(i, color)| {
|
.map(|(i, color)| {
|
||||||
if matches!(
|
if matches!(board.mesadata().layer_layername(i), Some("F.Cu")) {
|
||||||
board
|
|
||||||
.layout()
|
|
||||||
.drawing()
|
|
||||||
.rules()
|
|
||||||
.layer_layername(i.try_into().unwrap() /* FIXME */),
|
|
||||||
Some("F.Cu")
|
|
||||||
) {
|
|
||||||
egui::Color32::from_rgb(255, 52, 52)
|
egui::Color32::from_rgb(255, 52, 52)
|
||||||
} else if matches!(
|
} else if matches!(board.mesadata().layer_layername(i), Some("B.Cu")) {
|
||||||
board
|
|
||||||
.layout()
|
|
||||||
.drawing()
|
|
||||||
.rules()
|
|
||||||
.layer_layername(i.try_into().unwrap() /* FIXME */),
|
|
||||||
Some("B.Cu")
|
|
||||||
) {
|
|
||||||
egui::Color32::from_rgb(52, 52, 255)
|
egui::Color32::from_rgb(52, 52, 255)
|
||||||
} else {
|
} else {
|
||||||
color
|
color
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.take(layer_count.try_into().unwrap() /* FIXME */)
|
.take(layer_count)
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
.into_boxed_slice();
|
.into_boxed_slice();
|
||||||
let highlight_colors = std::iter::repeat(egui::Color32::from_rgb(255, 255, 255))
|
let highlight_colors = std::iter::repeat(egui::Color32::from_rgb(255, 255, 255))
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.map(|(i, color)| {
|
.map(|(i, color)| {
|
||||||
if matches!(
|
if matches!(board.mesadata().layer_layername(i), Some("F.Cu")) {
|
||||||
board
|
|
||||||
.layout()
|
|
||||||
.drawing()
|
|
||||||
.rules()
|
|
||||||
.layer_layername(i.try_into().unwrap() /* FIXME */),
|
|
||||||
Some("F.Cu")
|
|
||||||
) {
|
|
||||||
egui::Color32::from_rgb(255, 100, 100)
|
egui::Color32::from_rgb(255, 100, 100)
|
||||||
} else if matches!(
|
} else if matches!(board.mesadata().layer_layername(i), Some("B.Cu")) {
|
||||||
board
|
|
||||||
.layout()
|
|
||||||
.drawing()
|
|
||||||
.rules()
|
|
||||||
.layer_layername(i.try_into().unwrap() /* FIXME */),
|
|
||||||
Some("B.Cu")
|
|
||||||
) {
|
|
||||||
egui::Color32::from_rgb(100, 100, 255)
|
egui::Color32::from_rgb(100, 100, 255)
|
||||||
} else {
|
} else {
|
||||||
color
|
color
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.take(layer_count.try_into().unwrap() /* FIXME */)
|
.take(layer_count)
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
.into_boxed_slice();
|
.into_boxed_slice();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ use topola::{
|
||||||
pub struct Overlay {
|
pub struct Overlay {
|
||||||
ratsnest: Ratsnest,
|
ratsnest: Ratsnest,
|
||||||
selection: Selection,
|
selection: Selection,
|
||||||
active_layer: u64,
|
active_layer: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Overlay {
|
impl Overlay {
|
||||||
|
|
|
||||||
|
|
@ -179,6 +179,10 @@ impl<M: MesadataTrait> Board<M> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn mesadata(&self) -> &M {
|
||||||
|
self.layout.drawing().rules()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn layout(&self) -> &Layout<M> {
|
pub fn layout(&self) -> &Layout<M> {
|
||||||
&self.layout
|
&self.layout
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
use crate::drawing::rules::RulesTrait;
|
use crate::drawing::rules::RulesTrait;
|
||||||
|
|
||||||
pub trait MesadataTrait: RulesTrait {
|
pub trait MesadataTrait: RulesTrait {
|
||||||
fn bename_layer(&mut self, layer: u64, layername: String);
|
fn bename_layer(&mut self, layer: usize, layername: String);
|
||||||
fn layer_layername(&self, layer: u64) -> Option<&str>;
|
fn layer_layername(&self, layer: usize) -> Option<&str>;
|
||||||
fn layername_layer(&self, layername: &str) -> Option<u64>;
|
fn layername_layer(&self, layername: &str) -> Option<usize>;
|
||||||
|
|
||||||
fn bename_net(&mut self, net: usize, netname: String);
|
fn bename_net(&mut self, net: usize, netname: String);
|
||||||
fn net_netname(&self, net: usize) -> Option<&str>;
|
fn net_netname(&self, net: usize) -> Option<&str>;
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ impl BendWeightTrait<PrimitiveWeight> for BendWeight {}
|
||||||
pub struct FixedBendWeight {
|
pub struct FixedBendWeight {
|
||||||
pub width: f64,
|
pub width: f64,
|
||||||
pub offset: f64,
|
pub offset: f64,
|
||||||
pub layer: u64,
|
pub layer: usize,
|
||||||
pub maybe_net: Option<usize>,
|
pub maybe_net: Option<usize>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -104,7 +104,7 @@ impl GetWidth for FixedBendWeight {
|
||||||
pub struct LooseBendWeight {
|
pub struct LooseBendWeight {
|
||||||
pub width: f64,
|
pub width: f64,
|
||||||
pub offset: f64,
|
pub offset: f64,
|
||||||
pub layer: u64,
|
pub layer: usize,
|
||||||
pub maybe_net: Option<usize>,
|
pub maybe_net: Option<usize>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ impl DotWeightTrait<PrimitiveWeight> for DotWeight {}
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||||
pub struct FixedDotWeight {
|
pub struct FixedDotWeight {
|
||||||
pub circle: Circle,
|
pub circle: Circle,
|
||||||
pub layer: u64,
|
pub layer: usize,
|
||||||
pub maybe_net: Option<usize>,
|
pub maybe_net: Option<usize>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -104,7 +104,7 @@ impl GetWidth for FixedDotWeight {
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||||
pub struct LooseDotWeight {
|
pub struct LooseDotWeight {
|
||||||
pub circle: Circle,
|
pub circle: Circle,
|
||||||
pub layer: u64,
|
pub layer: usize,
|
||||||
pub maybe_net: Option<usize>,
|
pub maybe_net: Option<usize>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -686,7 +686,7 @@ impl<CW: Copy, R: RulesTrait> Drawing<CW, R> {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn layer_primitive_nodes(&self, layer: u64) -> impl Iterator<Item = PrimitiveIndex> + '_ {
|
pub fn layer_primitive_nodes(&self, layer: usize) -> impl Iterator<Item = PrimitiveIndex> + '_ {
|
||||||
self.geometry_with_rtree
|
self.geometry_with_rtree
|
||||||
.rtree()
|
.rtree()
|
||||||
.locate_in_envelope_intersecting(&AABB::from_corners(
|
.locate_in_envelope_intersecting(&AABB::from_corners(
|
||||||
|
|
@ -889,7 +889,7 @@ impl<CW: Copy, R: RulesTrait> Drawing<CW, R> {
|
||||||
Loose::new(index, self)
|
Loose::new(index, self)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn layer_count(&self) -> u64 {
|
pub fn layer_count(&self) -> usize {
|
||||||
self.geometry_with_rtree.layer_count()
|
self.geometry_with_rtree.layer_count()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ pub trait Retag<PrimitiveIndex> {
|
||||||
|
|
||||||
#[enum_dispatch]
|
#[enum_dispatch]
|
||||||
pub trait GetLayer {
|
pub trait GetLayer {
|
||||||
fn layer(&self) -> u64;
|
fn layer(&self) -> usize;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[enum_dispatch]
|
#[enum_dispatch]
|
||||||
|
|
@ -47,7 +47,7 @@ macro_rules! impl_weight {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> GetLayer for $weight_struct {
|
impl<'a> GetLayer for $weight_struct {
|
||||||
fn layer(&self) -> u64 {
|
fn layer(&self) -> usize {
|
||||||
self.layer
|
self.layer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,7 @@ macro_rules! impl_primitive {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, CW: Copy, R: RulesTrait> GetLayer for $primitive_struct<'a, CW, R> {
|
impl<'a, CW: Copy, R: RulesTrait> GetLayer for $primitive_struct<'a, CW, R> {
|
||||||
fn layer(&self) -> u64 {
|
fn layer(&self) -> usize {
|
||||||
self.weight().layer()
|
self.weight().layer()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ impl SegWeightTrait<PrimitiveWeight> for SegWeight {}
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||||
pub struct FixedSegWeight {
|
pub struct FixedSegWeight {
|
||||||
pub width: f64,
|
pub width: f64,
|
||||||
pub layer: u64,
|
pub layer: usize,
|
||||||
pub maybe_net: Option<usize>,
|
pub maybe_net: Option<usize>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -96,7 +96,7 @@ impl GetWidth for FixedSegWeight {
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||||
pub struct LoneLooseSegWeight {
|
pub struct LoneLooseSegWeight {
|
||||||
pub width: f64,
|
pub width: f64,
|
||||||
pub layer: u64,
|
pub layer: usize,
|
||||||
pub maybe_net: Option<usize>,
|
pub maybe_net: Option<usize>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -112,7 +112,7 @@ impl GetWidth for LoneLooseSegWeight {
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||||
pub struct SeqLooseSegWeight {
|
pub struct SeqLooseSegWeight {
|
||||||
pub width: f64,
|
pub width: f64,
|
||||||
pub layer: u64,
|
pub layer: usize,
|
||||||
pub maybe_net: Option<usize>,
|
pub maybe_net: Option<usize>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -193,7 +193,7 @@ impl DsnDesign {
|
||||||
(pin.x as f64, pin.y as f64).into(),
|
(pin.x as f64, pin.y as f64).into(),
|
||||||
pin.rotate.unwrap_or(0.0) as f64,
|
pin.rotate.unwrap_or(0.0) as f64,
|
||||||
circle.diameter as f64 / 2.0,
|
circle.diameter as f64 / 2.0,
|
||||||
layer as u64,
|
layer as usize,
|
||||||
*net,
|
*net,
|
||||||
Some(pinname.clone()),
|
Some(pinname.clone()),
|
||||||
)
|
)
|
||||||
|
|
@ -215,7 +215,7 @@ impl DsnDesign {
|
||||||
rect.y1 as f64,
|
rect.y1 as f64,
|
||||||
rect.x2 as f64,
|
rect.x2 as f64,
|
||||||
rect.y2 as f64,
|
rect.y2 as f64,
|
||||||
layer as u64,
|
layer as usize,
|
||||||
*net,
|
*net,
|
||||||
Some(pinname.clone()),
|
Some(pinname.clone()),
|
||||||
)
|
)
|
||||||
|
|
@ -235,7 +235,7 @@ impl DsnDesign {
|
||||||
pin.rotate.unwrap_or(0.0) as f64,
|
pin.rotate.unwrap_or(0.0) as f64,
|
||||||
&path.coord_vec,
|
&path.coord_vec,
|
||||||
path.width as f64,
|
path.width as f64,
|
||||||
layer as u64,
|
layer as usize,
|
||||||
*net,
|
*net,
|
||||||
Some(pinname.clone()),
|
Some(pinname.clone()),
|
||||||
)
|
)
|
||||||
|
|
@ -255,7 +255,7 @@ impl DsnDesign {
|
||||||
pin.rotate.unwrap_or(0.0) as f64,
|
pin.rotate.unwrap_or(0.0) as f64,
|
||||||
&polygon.coord_vec,
|
&polygon.coord_vec,
|
||||||
polygon.width as f64,
|
polygon.width as f64,
|
||||||
layer as u64,
|
layer as usize,
|
||||||
*net,
|
*net,
|
||||||
Some(pinname.clone()),
|
Some(pinname.clone()),
|
||||||
)
|
)
|
||||||
|
|
@ -299,7 +299,7 @@ impl DsnDesign {
|
||||||
(0.0, 0.0).into(),
|
(0.0, 0.0).into(),
|
||||||
0.0,
|
0.0,
|
||||||
circle.diameter as f64 / 2.0,
|
circle.diameter as f64 / 2.0,
|
||||||
layer as u64,
|
layer as usize,
|
||||||
net,
|
net,
|
||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
|
|
@ -321,7 +321,7 @@ impl DsnDesign {
|
||||||
rect.y1 as f64,
|
rect.y1 as f64,
|
||||||
rect.x2 as f64,
|
rect.x2 as f64,
|
||||||
rect.y2 as f64,
|
rect.y2 as f64,
|
||||||
layer as u64,
|
layer as usize,
|
||||||
net,
|
net,
|
||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
|
|
@ -341,7 +341,7 @@ impl DsnDesign {
|
||||||
0.0,
|
0.0,
|
||||||
&path.coord_vec,
|
&path.coord_vec,
|
||||||
path.width as f64,
|
path.width as f64,
|
||||||
layer as u64,
|
layer as usize,
|
||||||
net,
|
net,
|
||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
|
|
@ -361,7 +361,7 @@ impl DsnDesign {
|
||||||
0.0,
|
0.0,
|
||||||
&polygon.coord_vec,
|
&polygon.coord_vec,
|
||||||
polygon.width as f64,
|
polygon.width as f64,
|
||||||
layer as u64,
|
layer as usize,
|
||||||
net,
|
net,
|
||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
|
|
@ -392,7 +392,7 @@ impl DsnDesign {
|
||||||
0.0,
|
0.0,
|
||||||
&wire.path.coord_vec,
|
&wire.path.coord_vec,
|
||||||
wire.path.width as f64,
|
wire.path.width as f64,
|
||||||
layer as u64,
|
layer,
|
||||||
net,
|
net,
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
|
|
@ -448,7 +448,7 @@ impl DsnDesign {
|
||||||
pin_pos: Point,
|
pin_pos: Point,
|
||||||
pin_rot: f64,
|
pin_rot: f64,
|
||||||
r: f64,
|
r: f64,
|
||||||
layer: u64,
|
layer: usize,
|
||||||
net: usize,
|
net: usize,
|
||||||
maybe_pin: Option<String>,
|
maybe_pin: Option<String>,
|
||||||
) {
|
) {
|
||||||
|
|
@ -477,7 +477,7 @@ impl DsnDesign {
|
||||||
y1: f64,
|
y1: f64,
|
||||||
x2: f64,
|
x2: f64,
|
||||||
y2: f64,
|
y2: f64,
|
||||||
layer: u64,
|
layer: usize,
|
||||||
net: usize,
|
net: usize,
|
||||||
maybe_pin: Option<String>,
|
maybe_pin: Option<String>,
|
||||||
) {
|
) {
|
||||||
|
|
@ -586,7 +586,7 @@ impl DsnDesign {
|
||||||
pin_rot: f64,
|
pin_rot: f64,
|
||||||
coords: &Vec<structure::Point>,
|
coords: &Vec<structure::Point>,
|
||||||
width: f64,
|
width: f64,
|
||||||
layer: u64,
|
layer: usize,
|
||||||
net: usize,
|
net: usize,
|
||||||
maybe_pin: Option<String>,
|
maybe_pin: Option<String>,
|
||||||
) {
|
) {
|
||||||
|
|
@ -663,7 +663,7 @@ impl DsnDesign {
|
||||||
pin_rot: f64,
|
pin_rot: f64,
|
||||||
coords: &Vec<structure::Point>,
|
coords: &Vec<structure::Point>,
|
||||||
width: f64,
|
width: f64,
|
||||||
layer: u64,
|
layer: usize,
|
||||||
net: usize,
|
net: usize,
|
||||||
maybe_pin: Option<String>,
|
maybe_pin: Option<String>,
|
||||||
) {
|
) {
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ pub struct DsnMesadata {
|
||||||
class_rules: HashMap<String, DsnRule>,
|
class_rules: HashMap<String, DsnRule>,
|
||||||
|
|
||||||
// layername <-> layer for Layout
|
// layername <-> layer for Layout
|
||||||
pub layer_layername: BiHashMap<u64, String>,
|
pub layer_layername: BiHashMap<usize, String>,
|
||||||
|
|
||||||
// netname <-> net for Layout
|
// netname <-> net for Layout
|
||||||
pub net_netname: BiHashMap<usize, String>,
|
pub net_netname: BiHashMap<usize, String>,
|
||||||
|
|
@ -45,7 +45,7 @@ impl DsnMesadata {
|
||||||
pcb.structure
|
pcb.structure
|
||||||
.layer_vec
|
.layer_vec
|
||||||
.iter()
|
.iter()
|
||||||
.map(|layer| (layer.property.index as u64, layer.name.clone())),
|
.map(|layer| (layer.property.index, layer.name.clone())),
|
||||||
);
|
);
|
||||||
|
|
||||||
// keeping this as a separate iter pass because it might be moved into a different struct later?
|
// keeping this as a separate iter pass because it might be moved into a different struct later?
|
||||||
|
|
@ -122,15 +122,15 @@ impl RulesTrait for DsnMesadata {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MesadataTrait for DsnMesadata {
|
impl MesadataTrait for DsnMesadata {
|
||||||
fn bename_layer(&mut self, layer: u64, layername: String) {
|
fn bename_layer(&mut self, layer: usize, layername: String) {
|
||||||
self.layer_layername.insert(layer, layername);
|
self.layer_layername.insert(layer, layername);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn layer_layername(&self, layer: u64) -> Option<&str> {
|
fn layer_layername(&self, layer: usize) -> Option<&str> {
|
||||||
self.layer_layername.get_by_left(&layer).map(|s| s.as_str())
|
self.layer_layername.get_by_left(&layer).map(|s| s.as_str())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn layername_layer(&self, layername: &str) -> Option<u64> {
|
fn layername_layer(&self, layername: &str) -> Option<usize> {
|
||||||
self.layer_layername.get_by_right(layername).copied()
|
self.layer_layername.get_by_right(layername).copied()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,14 +9,14 @@ use crate::{
|
||||||
|
|
||||||
#[enum_dispatch]
|
#[enum_dispatch]
|
||||||
pub trait PrimitiveShapeTrait: ShapeTrait {
|
pub trait PrimitiveShapeTrait: ShapeTrait {
|
||||||
fn priority(&self) -> u64;
|
fn priority(&self) -> usize;
|
||||||
fn inflate(&self, margin: f64) -> PrimitiveShape;
|
fn inflate(&self, margin: f64) -> PrimitiveShape;
|
||||||
fn intersects(&self, other: &PrimitiveShape) -> bool;
|
fn intersects(&self, other: &PrimitiveShape) -> bool;
|
||||||
fn envelope(&self, margin: f64) -> AABB<[f64; 2]>;
|
fn envelope(&self, margin: f64) -> AABB<[f64; 2]>;
|
||||||
fn width(&self) -> f64;
|
fn width(&self) -> f64;
|
||||||
fn length(&self) -> f64;
|
fn length(&self) -> f64;
|
||||||
|
|
||||||
fn envelope_3d(&self, margin: f64, layer: u64) -> AABB<[f64; 3]> {
|
fn envelope_3d(&self, margin: f64, layer: usize) -> AABB<[f64; 3]> {
|
||||||
let envelope = self.envelope(margin);
|
let envelope = self.envelope(margin);
|
||||||
AABB::from_corners(
|
AABB::from_corners(
|
||||||
[envelope.lower()[0], envelope.lower()[1], layer as f64],
|
[envelope.lower()[0], envelope.lower()[1], layer as f64],
|
||||||
|
|
@ -24,7 +24,7 @@ pub trait PrimitiveShapeTrait: ShapeTrait {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn full_height_envelope_3d(&self, margin: f64, layer_count: u64) -> AABB<[f64; 3]> {
|
fn full_height_envelope_3d(&self, margin: f64, layer_count: usize) -> AABB<[f64; 3]> {
|
||||||
let envelope = self.envelope(margin);
|
let envelope = self.envelope(margin);
|
||||||
AABB::from_corners(
|
AABB::from_corners(
|
||||||
[envelope.lower()[0], envelope.lower()[1], 0.0],
|
[envelope.lower()[0], envelope.lower()[1], 0.0],
|
||||||
|
|
@ -62,7 +62,7 @@ impl ShapeTrait for DotShape {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PrimitiveShapeTrait for DotShape {
|
impl PrimitiveShapeTrait for DotShape {
|
||||||
fn priority(&self) -> u64 {
|
fn priority(&self) -> usize {
|
||||||
3
|
3
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -162,7 +162,7 @@ impl ShapeTrait for SegShape {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PrimitiveShapeTrait for SegShape {
|
impl PrimitiveShapeTrait for SegShape {
|
||||||
fn priority(&self) -> u64 {
|
fn priority(&self) -> usize {
|
||||||
2
|
2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -279,7 +279,7 @@ impl ShapeTrait for BendShape {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PrimitiveShapeTrait for BendShape {
|
impl PrimitiveShapeTrait for BendShape {
|
||||||
fn priority(&self) -> u64 {
|
fn priority(&self) -> usize {
|
||||||
1
|
1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ pub struct GeometryWithRtree<
|
||||||
> {
|
> {
|
||||||
geometry: Geometry<PW, DW, SW, BW, CW, PI, DI, SI, BI>,
|
geometry: Geometry<PW, DW, SW, BW, CW, PI, DI, SI, BI>,
|
||||||
rtree: RTree<BboxedIndex<GenericNode<PI, GenericIndex<CW>>>>,
|
rtree: RTree<BboxedIndex<GenericNode<PI, GenericIndex<CW>>>>,
|
||||||
layer_count: u64,
|
layer_count: usize,
|
||||||
weight_marker: PhantomData<PW>,
|
weight_marker: PhantomData<PW>,
|
||||||
dot_weight_marker: PhantomData<DW>,
|
dot_weight_marker: PhantomData<DW>,
|
||||||
seg_weight_marker: PhantomData<SW>,
|
seg_weight_marker: PhantomData<SW>,
|
||||||
|
|
@ -75,7 +75,7 @@ impl<
|
||||||
BI: GetNodeIndex + Into<PI> + Copy,
|
BI: GetNodeIndex + Into<PI> + Copy,
|
||||||
> GeometryWithRtree<PW, DW, SW, BW, CW, PI, DI, SI, BI>
|
> GeometryWithRtree<PW, DW, SW, BW, CW, PI, DI, SI, BI>
|
||||||
{
|
{
|
||||||
pub fn new(layer_count: u64) -> Self {
|
pub fn new(layer_count: usize) -> Self {
|
||||||
Self {
|
Self {
|
||||||
geometry: Geometry::<PW, DW, SW, BW, CW, PI, DI, SI, BI>::new(),
|
geometry: Geometry::<PW, DW, SW, BW, CW, PI, DI, SI, BI>::new(),
|
||||||
rtree: RTree::new(),
|
rtree: RTree::new(),
|
||||||
|
|
@ -335,7 +335,7 @@ impl<
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn layer(&self, primitive: PI) -> u64 {
|
fn layer(&self, primitive: PI) -> usize {
|
||||||
if let Ok(dot) = <PI as TryInto<DI>>::try_into(primitive) {
|
if let Ok(dot) = <PI as TryInto<DI>>::try_into(primitive) {
|
||||||
self.geometry.dot_weight(dot).layer()
|
self.geometry.dot_weight(dot).layer()
|
||||||
} else if let Ok(seg) = <PI as TryInto<SI>>::try_into(primitive) {
|
} else if let Ok(seg) = <PI as TryInto<SI>>::try_into(primitive) {
|
||||||
|
|
@ -347,7 +347,7 @@ impl<
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn layer_count(&self) -> u64 {
|
pub fn layer_count(&self) -> usize {
|
||||||
self.layer_count
|
self.layer_count
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -240,7 +240,7 @@ impl<R: RulesTrait> Layout<R> {
|
||||||
|
|
||||||
pub fn layer_zone_nodes(
|
pub fn layer_zone_nodes(
|
||||||
&self,
|
&self,
|
||||||
layer: u64,
|
layer: usize,
|
||||||
) -> impl Iterator<Item = GenericIndex<ZoneWeight>> + '_ {
|
) -> impl Iterator<Item = GenericIndex<ZoneWeight>> + '_ {
|
||||||
self.drawing
|
self.drawing
|
||||||
.rtree()
|
.rtree()
|
||||||
|
|
|
||||||
|
|
@ -46,8 +46,8 @@ impl<'a, R: RulesTrait> MakePrimitiveShape for Via<'a, R> {
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
|
||||||
pub struct ViaWeight {
|
pub struct ViaWeight {
|
||||||
pub from_layer: u64,
|
pub from_layer: usize,
|
||||||
pub to_layer: u64,
|
pub to_layer: usize,
|
||||||
pub circle: Circle,
|
pub circle: Circle,
|
||||||
pub maybe_net: Option<usize>,
|
pub maybe_net: Option<usize>,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ impl<'a, R: RulesTrait> Zone<'a, R> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, R: RulesTrait> GetLayer for Zone<'a, R> {
|
impl<'a, R: RulesTrait> GetLayer for Zone<'a, R> {
|
||||||
fn layer(&self) -> u64 {
|
fn layer(&self) -> usize {
|
||||||
if let CompoundWeight::Zone(weight) =
|
if let CompoundWeight::Zone(weight) =
|
||||||
self.layout.drawing().compound_weight(self.index.into())
|
self.layout.drawing().compound_weight(self.index.into())
|
||||||
{
|
{
|
||||||
|
|
@ -136,12 +136,12 @@ impl From<GenericIndex<ZoneWeight>> for GenericIndex<CompoundWeight> {
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||||
pub struct SolidZoneWeight {
|
pub struct SolidZoneWeight {
|
||||||
pub layer: u64,
|
pub layer: usize,
|
||||||
pub maybe_net: Option<usize>,
|
pub maybe_net: Option<usize>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl GetLayer for SolidZoneWeight {
|
impl GetLayer for SolidZoneWeight {
|
||||||
fn layer(&self) -> u64 {
|
fn layer(&self) -> usize {
|
||||||
self.layer
|
self.layer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -160,12 +160,12 @@ impl From<GenericIndex<SolidZoneWeight>> for GenericIndex<CompoundWeight> {
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||||
pub struct PourZoneWeight {
|
pub struct PourZoneWeight {
|
||||||
pub layer: u64,
|
pub layer: usize,
|
||||||
pub maybe_net: Option<usize>,
|
pub maybe_net: Option<usize>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> GetLayer for PourZoneWeight {
|
impl<'a> GetLayer for PourZoneWeight {
|
||||||
fn layer(&self) -> u64 {
|
fn layer(&self) -> usize {
|
||||||
self.layer
|
self.layer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue