mirror of https://codeberg.org/topola/topola.git
layout: general info about the module
This commit is contained in:
parent
2ef645bbaf
commit
de0ba42e18
|
|
@ -27,16 +27,21 @@ use crate::{
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// Represents a weight for various compounds
|
||||||
#[derive(Debug, Clone, Copy)]
|
#[derive(Debug, Clone, Copy)]
|
||||||
#[enum_dispatch(GetMaybeNet)]
|
#[enum_dispatch(GetMaybeNet)]
|
||||||
pub enum CompoundWeight {
|
pub enum CompoundWeight {
|
||||||
|
/// Represents the weight of a polygon compound, includes its basic [`Layout`] information
|
||||||
Poly(PolyWeight),
|
Poly(PolyWeight),
|
||||||
|
/// Represents Via weight properties, containing its [`Layout`] properties
|
||||||
Via(ViaWeight),
|
Via(ViaWeight),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The alias to differ node types
|
||||||
pub type NodeIndex = GenericNode<PrimitiveIndex, GenericIndex<CompoundWeight>>;
|
pub type NodeIndex = GenericNode<PrimitiveIndex, GenericIndex<CompoundWeight>>;
|
||||||
|
|
||||||
#[derive(Debug, Getters)]
|
#[derive(Debug, Getters)]
|
||||||
|
/// Structure for managing the Layout design
|
||||||
pub struct Layout<R: AccessRules> {
|
pub struct Layout<R: AccessRules> {
|
||||||
drawing: Drawing<CompoundWeight, R>,
|
drawing: Drawing<CompoundWeight, R>,
|
||||||
}
|
}
|
||||||
|
|
@ -46,6 +51,7 @@ impl<R: AccessRules> Layout<R> {
|
||||||
Self { drawing }
|
Self { drawing }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Insert [`Cane`] object into the [`Layout`]
|
||||||
pub fn insert_cane(
|
pub fn insert_cane(
|
||||||
&mut self,
|
&mut self,
|
||||||
from: DotIndex,
|
from: DotIndex,
|
||||||
|
|
@ -59,12 +65,14 @@ impl<R: AccessRules> Layout<R> {
|
||||||
.insert_cane(from, around, dot_weight, seg_weight, bend_weight, cw)
|
.insert_cane(from, around, dot_weight, seg_weight, bend_weight, cw)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Remove [`Cane`] object from the [`Layout`]
|
||||||
pub fn remove_cane(&mut self, cane: &Cane, face: LooseDotIndex) {
|
pub fn remove_cane(&mut self, cane: &Cane, face: LooseDotIndex) {
|
||||||
self.drawing.remove_cane(cane, face)
|
self.drawing.remove_cane(cane, face)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[debug_ensures(ret.is_ok() -> self.drawing.node_count() == old(self.drawing.node_count()) + weight.to_layer - weight.from_layer + 2)]
|
#[debug_ensures(ret.is_ok() -> self.drawing.node_count() == old(self.drawing.node_count()) + weight.to_layer - weight.from_layer + 2)]
|
||||||
#[debug_ensures(ret.is_err() -> self.drawing.node_count() == old(self.drawing.node_count()))]
|
#[debug_ensures(ret.is_err() -> self.drawing.node_count() == old(self.drawing.node_count()))]
|
||||||
|
/// Insert [`Via`] into the [`Layout`]
|
||||||
pub fn add_via(&mut self, weight: ViaWeight) -> Result<GenericIndex<ViaWeight>, Infringement> {
|
pub fn add_via(&mut self, weight: ViaWeight) -> Result<GenericIndex<ViaWeight>, Infringement> {
|
||||||
let compound = self.drawing.add_compound(weight.into());
|
let compound = self.drawing.add_compound(weight.into());
|
||||||
let mut dots = vec![];
|
let mut dots = vec![];
|
||||||
|
|
@ -96,6 +104,7 @@ impl<R: AccessRules> Layout<R> {
|
||||||
Ok(GenericIndex::<ViaWeight>::new(compound.petgraph_index()))
|
Ok(GenericIndex::<ViaWeight>::new(compound.petgraph_index()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pub fn add_fixed_dot(&mut self, weight: FixedDotWeight) -> Result<FixedDotIndex, Infringement> {
|
pub fn add_fixed_dot(&mut self, weight: FixedDotWeight) -> Result<FixedDotIndex, Infringement> {
|
||||||
self.drawing.add_fixed_dot(weight)
|
self.drawing.add_fixed_dot(weight)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
//! Layout module for handling board geometry.
|
||||||
|
|
||||||
mod layout;
|
mod layout;
|
||||||
pub mod poly;
|
pub mod poly;
|
||||||
pub mod via;
|
pub mod via;
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
//! Module for handling Polygon properties
|
||||||
|
|
||||||
use enum_dispatch::enum_dispatch;
|
use enum_dispatch::enum_dispatch;
|
||||||
|
|
||||||
use geo::{LineString, Point, Polygon};
|
use geo::{LineString, Point, Polygon};
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
//! Module for handling Vias properties
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue