refactor(topola-egui): Move storing principal layer to planar autoroute options

I've done some struct renaming while at it.
This commit is contained in:
Mikolaj Wielgus 2025-10-13 21:38:47 +02:00
parent 4c1a72dc1d
commit cd73c766a5
16 changed files with 134 additions and 123 deletions

View File

@ -11,7 +11,7 @@ use topola::autorouter::history::History;
use topola::autorouter::invoker::Invoker; use topola::autorouter::invoker::Invoker;
use topola::autorouter::selection::PinSelection; use topola::autorouter::selection::PinSelection;
use topola::autorouter::Autorouter; use topola::autorouter::Autorouter;
use topola::autorouter::AutorouterOptions; use topola::autorouter::PlanarAutorouteOptions;
use topola::autorouter::PresortBy; use topola::autorouter::PresortBy;
use topola::board::edit::BoardEdit; use topola::board::edit::BoardEdit;
use topola::router::RouterOptions; use topola::router::RouterOptions;
@ -39,7 +39,7 @@ fn main() -> Result<(), std::io::Error> {
history.do_( history.do_(
Command::Autoroute( Command::Autoroute(
PinSelection::new_select_layer(&board, 0), PinSelection::new_select_layer(&board, 0),
AutorouterOptions { PlanarAutorouteOptions {
presort_by: PresortBy::RatlineIntersectionCountAndLength, presort_by: PresortBy::RatlineIntersectionCountAndLength,
permutate: true, permutate: true,
router: RouterOptions { router: RouterOptions {

View File

@ -10,9 +10,7 @@ use crate::{
}; };
use egui::{Context, Ui}; use egui::{Context, Ui};
use topola::autorouter::{ use topola::autorouter::{multilayer_autoroute::MultilayerAutorouteOptions, PresortBy};
multilayer_autoroute::MultilayerAutorouterOptions, AutorouterOptions, PresortBy,
};
pub struct FileActions { pub struct FileActions {
pub open_design: Trigger, pub open_design: Trigger,
@ -336,7 +334,7 @@ impl RouteActions {
tr: &Translator, tr: &Translator,
have_workspace: bool, have_workspace: bool,
workspace_activities_enabled: bool, workspace_activities_enabled: bool,
multilayer_autorouter_options: &mut MultilayerAutorouterOptions, multilayer_autorouter_options: &mut MultilayerAutorouteOptions,
) -> egui::InnerResponse<()> { ) -> egui::InnerResponse<()> {
ui.add_enabled_ui(have_workspace, |ui| { ui.add_enabled_ui(have_workspace, |ui| {
ui.add_enabled_ui(workspace_activities_enabled, |ui| { ui.add_enabled_ui(workspace_activities_enabled, |ui| {

View File

@ -185,7 +185,8 @@ impl eframe::App for App {
if self.menu_bar.show_appearance_panel { if self.menu_bar.show_appearance_panel {
if let Some(workspace) = &mut self.maybe_workspace { if let Some(workspace) = &mut self.maybe_workspace {
workspace.update_appearance_panel(ctx); workspace
.update_appearance_panel(ctx, &mut self.menu_bar.multilayer_autoroute_options);
} }
} }

View File

@ -3,15 +3,16 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
use egui::{widget_text::WidgetText, Context, Grid, ScrollArea, SidePanel}; use egui::{widget_text::WidgetText, Context, Grid, ScrollArea, SidePanel};
use topola::board::{AccessMesadata, Board}; use topola::{
autorouter::multilayer_autoroute::MultilayerAutorouteOptions,
board::{AccessMesadata, Board},
};
pub struct AppearancePanel { pub struct AppearancePanel {
// TODO: // TODO:
// In1.Cu shall be #7fc87f (#d5ecd5 when selected). // In1.Cu shall be #7fc87f (#d5ecd5 when selected).
// In2.Cu shall be #ce7d2c (#e8c39e when selected). // In2.Cu shall be #ce7d2c (#e8c39e when selected).
pub visible: Box<[bool]>, pub visible: Box<[bool]>,
pub active_layer: Option<usize>,
} }
impl AppearancePanel { impl AppearancePanel {
@ -20,13 +21,15 @@ impl AppearancePanel {
let visible = core::iter::repeat(true) let visible = core::iter::repeat(true)
.take(layer_count) .take(layer_count)
.collect::<Box<[_]>>(); .collect::<Box<[_]>>();
Self { Self { visible }
visible,
active_layer: Some(0),
}
} }
pub fn update(&mut self, ctx: &Context, board: &Board<impl AccessMesadata>) { pub fn update(
&mut self,
ctx: &Context,
board: &Board<impl AccessMesadata>,
options: &mut MultilayerAutorouteOptions,
) {
SidePanel::right("appearance_panel").show(ctx, |ui| { SidePanel::right("appearance_panel").show(ctx, |ui| {
ui.label("Layers"); ui.label("Layers");
let row_height = ui.spacing().interact_size.y; let row_height = ui.spacing().interact_size.y;
@ -49,8 +52,8 @@ impl AppearancePanel {
// unnamed layers can't be used for routing // unnamed layers can't be used for routing
if layername.is_some() { if layername.is_some() {
ui.radio_value( ui.radio_value(
&mut self.active_layer, &mut options.planar.principal_layer,
Some(layer), layer,
WidgetText::default(), WidgetText::default(),
); );
} else { } else {

View File

@ -78,7 +78,7 @@ impl<'a> Displayer<'a> {
self.display_activity(menu_bar); self.display_activity(menu_bar);
if menu_bar.show_primitive_indices { if menu_bar.show_primitive_indices {
self.display_primitive_indices(); self.display_primitive_indices(menu_bar);
} }
} }
@ -571,18 +571,20 @@ impl<'a> Displayer<'a> {
} }
} }
fn display_primitive_indices(&mut self) { fn display_primitive_indices(&mut self, menu_bar: &MenuBar) {
let board = self.workspace.interactor.invoker().autorouter().board(); let board = self.workspace.interactor.invoker().autorouter().board();
if let Some(active_layer) = self.workspace.appearance_panel.active_layer { for primitive in board
for primitive in board.layout().drawing().layer_primitive_nodes(active_layer) { .layout()
.drawing()
.layer_primitive_nodes(menu_bar.multilayer_autoroute_options.planar.principal_layer)
{
let pos = primitive let pos = primitive
.primitive_ref(board.layout().drawing()) .primitive_ref(board.layout().drawing())
.shape() .shape()
.center(); .center();
let color = if let Some(activity) = &mut self.workspace.interactor.maybe_activity() let color = if let Some(activity) = &mut self.workspace.interactor.maybe_activity() {
{
if activity.obstacles().contains(&primitive) { if activity.obstacles().contains(&primitive) {
egui::Color32::from_rgb(255, 255, 255) egui::Color32::from_rgb(255, 255, 255)
} else { } else {
@ -601,4 +603,3 @@ impl<'a> Displayer<'a> {
} }
} }
} }
}

View File

@ -7,8 +7,8 @@ use std::{collections::BTreeSet, ops::ControlFlow, path::Path, sync::mpsc::Sende
use topola::{ use topola::{
autorouter::{ autorouter::{
anterouter::AnterouterOptions, execution::Command, invoker::InvokerError, anterouter::AnterouterOptions, execution::Command, invoker::InvokerError,
multilayer_autoroute::MultilayerAutorouterOptions, selection::Selection, AutorouterOptions, multilayer_autoroute::MultilayerAutorouteOptions, selection::Selection,
PresortBy, PlanarAutorouteOptions, PresortBy,
}, },
board::AccessMesadata, board::AccessMesadata,
interactor::{interaction::InteractionStepper, route_plan::RoutePlan}, interactor::{interaction::InteractionStepper, route_plan::RoutePlan},
@ -26,7 +26,7 @@ use crate::{
}; };
pub struct MenuBar { pub struct MenuBar {
pub multilayer_autorouter_options: MultilayerAutorouterOptions, pub multilayer_autoroute_options: MultilayerAutorouteOptions,
pub is_placing_via: bool, pub is_placing_via: bool,
pub show_ratsnest: bool, pub show_ratsnest: bool,
pub show_navmesh: bool, pub show_navmesh: bool,
@ -46,11 +46,12 @@ pub struct MenuBar {
impl MenuBar { impl MenuBar {
pub fn new() -> Self { pub fn new() -> Self {
Self { Self {
multilayer_autorouter_options: MultilayerAutorouterOptions { multilayer_autoroute_options: MultilayerAutorouteOptions {
anterouter: AnterouterOptions { anterouter: AnterouterOptions {
fanout_clearance: 200.0, fanout_clearance: 200.0,
}, },
planar: AutorouterOptions { planar: PlanarAutorouteOptions {
principal_layer: 0,
presort_by: PresortBy::RatlineIntersectionCountAndLength, presort_by: PresortBy::RatlineIntersectionCountAndLength,
permutate: true, permutate: true,
router: RouterOptions { router: RouterOptions {
@ -166,7 +167,7 @@ impl MenuBar {
tr, tr,
maybe_workspace.is_some(), maybe_workspace.is_some(),
workspace_activities_enabled, workspace_activities_enabled,
&mut self.multilayer_autorouter_options, &mut self.multilayer_autoroute_options,
) )
}); });
@ -294,12 +295,10 @@ impl MenuBar {
.recalculate_topo_navmesh .recalculate_topo_navmesh
.consume_key_triggered(ctx, ui) .consume_key_triggered(ctx, ui)
{ {
if let Some(active_layer) = workspace.appearance_panel.active_layer {
workspace.overlay.recalculate_topo_navmesh( workspace.overlay.recalculate_topo_navmesh(
workspace.interactor.invoker().autorouter(), workspace.interactor.invoker().autorouter(),
active_layer, self.multilayer_autoroute_options.planar.principal_layer,
); );
}
} else if actions.place.place_via.consume_key_enabled( } else if actions.place.place_via.consume_key_enabled(
ctx, ctx,
ui, ui,
@ -322,35 +321,35 @@ impl MenuBar {
Command::RemoveBands(selection.band_selection) Command::RemoveBands(selection.band_selection)
}) })
} else if actions.route.topo_autoroute.consume_key_triggered(ctx, ui) { } else if actions.route.topo_autoroute.consume_key_triggered(ctx, ui) {
if let Some(active_layer) = workspace.appearance_panel.active_layer { let active_layer_name = workspace
let active_layer = workspace
.interactor .interactor
.invoker() .invoker()
.autorouter() .autorouter()
.board() .board()
.layout() .layout()
.rules() .rules()
.layer_layername(active_layer) .layer_layername(
self.multilayer_autoroute_options.planar.principal_layer,
)
.expect("unknown active layer") .expect("unknown active layer")
.to_string(); .to_string();
schedule(error_dialog, workspace, |selection| { schedule(error_dialog, workspace, |selection| {
Command::TopoAutoroute { Command::TopoAutoroute {
selection: selection.pin_selection, selection: selection.pin_selection,
allowed_edges: BTreeSet::new(), allowed_edges: BTreeSet::new(),
active_layer, active_layer: active_layer_name,
routed_band_width: self routed_band_width: self
.multilayer_autorouter_options .multilayer_autoroute_options
.planar .planar
.router .router
.routed_band_width, .routed_band_width,
} }
}); });
}
} else if actions.route.autoroute.consume_key_triggered(ctx, ui) { } else if actions.route.autoroute.consume_key_triggered(ctx, ui) {
schedule(error_dialog, workspace, |selection| { schedule(error_dialog, workspace, |selection| {
Command::MultilayerAutoroute( Command::MultilayerAutoroute(
selection.pin_selection, selection.pin_selection,
self.multilayer_autorouter_options, self.multilayer_autoroute_options,
) )
}); });
} else if actions } else if actions
@ -361,7 +360,7 @@ impl MenuBar {
schedule(error_dialog, workspace, |selection| { schedule(error_dialog, workspace, |selection| {
Command::Autoroute( Command::Autoroute(
selection.pin_selection, selection.pin_selection,
self.multilayer_autorouter_options.planar, self.multilayer_autoroute_options.planar,
) )
}); });
} else if actions } else if actions
@ -372,7 +371,7 @@ impl MenuBar {
schedule(error_dialog, workspace, |selection| { schedule(error_dialog, workspace, |selection| {
Command::CompareDetours( Command::CompareDetours(
selection.pin_selection, selection.pin_selection,
self.multilayer_autorouter_options.planar, self.multilayer_autoroute_options.planar,
) )
}); });
} else if actions } else if actions
@ -388,15 +387,15 @@ impl MenuBar {
.place_route_plan .place_route_plan
.consume_key_triggered(ctx, ui) .consume_key_triggered(ctx, ui)
{ {
if let Some(active_layer) = workspace.appearance_panel.active_layer {
self.is_placing_via = false; self.is_placing_via = false;
workspace.interactor.interact(InteractionStepper::RoutePlan( workspace.interactor.interact(InteractionStepper::RoutePlan(
RoutePlan::new(active_layer), RoutePlan::new(
self.multilayer_autoroute_options.planar.principal_layer,
),
)); ));
} }
} }
} }
}
Ok::<(), InvokerError>(()) Ok::<(), InvokerError>(())
}) })
.inner .inner

View File

@ -51,7 +51,9 @@ impl Viewport {
let latest_point = point! {x: latest_pos.x as f64, y: -latest_pos.y as f64}; let latest_point = point! {x: latest_pos.x as f64, y: -latest_pos.y as f64};
let interactive_input = InteractiveInput { let interactive_input = InteractiveInput {
active_layer: workspace.appearance_panel.active_layer, active_layer: Some(
menu_bar.multilayer_autoroute_options.planar.principal_layer,
),
pointer_pos: latest_point, pointer_pos: latest_point,
dt: ctx.input(|i| i.stable_dt), dt: ctx.input(|i| i.stable_dt),
}; };

View File

@ -8,7 +8,9 @@ use std::{
}; };
use topola::{ use topola::{
autorouter::{execution::Command, history::History}, autorouter::{
execution::Command, history::History, multilayer_autoroute::MultilayerAutorouteOptions,
},
board::edit::BoardEdit, board::edit::BoardEdit,
interactor::{ interactor::{
activity::{InteractiveEvent, InteractiveEventKind, InteractiveInput}, activity::{InteractiveEvent, InteractiveEventKind, InteractiveInput},
@ -120,7 +122,7 @@ impl Workspace {
circle: Circle { circle: Circle {
pos: interactive_input.pointer_pos, pos: interactive_input.pointer_pos,
r: menu_bar r: menu_bar
.multilayer_autorouter_options .multilayer_autoroute_options
.planar .planar
.router .router
.routed_band_width .routed_band_width
@ -197,8 +199,12 @@ impl Workspace {
} }
} }
pub fn update_appearance_panel(&mut self, ctx: &egui::Context) { pub fn update_appearance_panel(
&mut self,
ctx: &egui::Context,
options: &mut MultilayerAutorouteOptions,
) {
self.appearance_panel self.appearance_panel
.update(ctx, self.interactor.invoker().autorouter().board()); .update(ctx, self.interactor.invoker().autorouter().board(), options);
} }
} }

View File

@ -12,7 +12,7 @@ use thiserror::Error;
use crate::{ use crate::{
autorouter::{ autorouter::{
multilayer_autoroute::{MultilayerAutorouteExecutionStepper, MultilayerAutorouterOptions}, multilayer_autoroute::{MultilayerAutorouteExecutionStepper, MultilayerAutorouteOptions},
permutator::PlanarAutorouteExecutionPermutator, permutator::PlanarAutorouteExecutionPermutator,
planner::Planner, planner::Planner,
ratsnests::Ratsnests, ratsnests::Ratsnests,
@ -44,7 +44,8 @@ pub enum PresortBy {
} }
#[derive(Clone, Copy, Debug, Deserialize, Serialize)] #[derive(Clone, Copy, Debug, Deserialize, Serialize)]
pub struct AutorouterOptions { pub struct PlanarAutorouteOptions {
pub principal_layer: usize,
pub presort_by: PresortBy, pub presort_by: PresortBy,
pub permutate: bool, pub permutate: bool,
pub router: RouterOptions, pub router: RouterOptions,
@ -86,7 +87,7 @@ impl<M: AccessMesadata> Autorouter<M> {
&mut self, &mut self,
selection: &PinSelection, selection: &PinSelection,
point: Point, point: Point,
options: AutorouterOptions, options: PlanarAutorouteOptions,
) -> Result<PointrouteExecutionStepper, AutorouterError> { ) -> Result<PointrouteExecutionStepper, AutorouterError> {
let ratvertex = self.find_selected_ratvertex(selection).unwrap(); let ratvertex = self.find_selected_ratvertex(selection).unwrap();
let origin_dot = match self let origin_dot = match self
@ -114,7 +115,7 @@ impl<M: AccessMesadata> Autorouter<M> {
pub fn multilayer_autoroute( pub fn multilayer_autoroute(
&mut self, &mut self,
selection: &PinSelection, selection: &PinSelection,
options: MultilayerAutorouterOptions, options: MultilayerAutorouteOptions,
) -> Result<MultilayerAutorouteExecutionStepper, AutorouterError> { ) -> Result<MultilayerAutorouteExecutionStepper, AutorouterError> {
let planner = Planner::new(self, &self.selected_ratlines(selection)); let planner = Planner::new(self, &self.selected_ratlines(selection));
@ -129,7 +130,7 @@ impl<M: AccessMesadata> Autorouter<M> {
pub fn planar_autoroute( pub fn planar_autoroute(
&mut self, &mut self,
selection: &PinSelection, selection: &PinSelection,
options: AutorouterOptions, options: PlanarAutorouteOptions,
) -> Result<PlanarAutorouteExecutionPermutator, AutorouterError> { ) -> Result<PlanarAutorouteExecutionPermutator, AutorouterError> {
PlanarAutorouteExecutionPermutator::new(self, self.selected_ratlines(selection), options) PlanarAutorouteExecutionPermutator::new(self, self.selected_ratlines(selection), options)
} }
@ -137,7 +138,7 @@ impl<M: AccessMesadata> Autorouter<M> {
pub(super) fn planar_autoroute_ratlines( pub(super) fn planar_autoroute_ratlines(
&mut self, &mut self,
ratlines: Vec<RatlineIndex>, ratlines: Vec<RatlineIndex>,
options: AutorouterOptions, options: PlanarAutorouteOptions,
) -> Result<PlanarAutorouteExecutionStepper, AutorouterError> { ) -> Result<PlanarAutorouteExecutionStepper, AutorouterError> {
PlanarAutorouteExecutionStepper::new(self, ratlines, options) PlanarAutorouteExecutionStepper::new(self, ratlines, options)
} }
@ -278,7 +279,7 @@ impl<M: AccessMesadata> Autorouter<M> {
pub fn compare_detours( pub fn compare_detours(
&mut self, &mut self,
selection: &PinSelection, selection: &PinSelection,
options: AutorouterOptions, options: PlanarAutorouteOptions,
) -> Result<CompareDetoursExecutionStepper, AutorouterError> { ) -> Result<CompareDetoursExecutionStepper, AutorouterError> {
let ratlines = self.selected_ratlines(selection); let ratlines = self.selected_ratlines(selection);
if ratlines.len() < 2 { if ratlines.len() < 2 {
@ -291,7 +292,7 @@ impl<M: AccessMesadata> Autorouter<M> {
&mut self, &mut self,
ratline1: RatlineIndex, ratline1: RatlineIndex,
ratline2: RatlineIndex, ratline2: RatlineIndex,
options: AutorouterOptions, options: PlanarAutorouteOptions,
) -> Result<CompareDetoursExecutionStepper, AutorouterError> { ) -> Result<CompareDetoursExecutionStepper, AutorouterError> {
CompareDetoursExecutionStepper::new(self, ratline1, ratline2, options) CompareDetoursExecutionStepper::new(self, ratline1, ratline2, options)
} }

View File

@ -20,7 +20,7 @@ use super::{
invoker::GetDebugOverlayData, invoker::GetDebugOverlayData,
planar_autoroute::{PlanarAutorouteContinueStatus, PlanarAutorouteExecutionStepper}, planar_autoroute::{PlanarAutorouteContinueStatus, PlanarAutorouteExecutionStepper},
ratline::RatlineIndex, ratline::RatlineIndex,
Autorouter, AutorouterError, AutorouterOptions, Autorouter, AutorouterError, PlanarAutorouteOptions,
}; };
pub struct CompareDetoursExecutionStepper { pub struct CompareDetoursExecutionStepper {
@ -38,7 +38,7 @@ impl CompareDetoursExecutionStepper {
autorouter: &mut Autorouter<impl AccessMesadata>, autorouter: &mut Autorouter<impl AccessMesadata>,
ratline1: RatlineIndex, ratline1: RatlineIndex,
ratline2: RatlineIndex, ratline2: RatlineIndex,
options: AutorouterOptions, options: PlanarAutorouteOptions,
) -> Result<Self, AutorouterError> { ) -> Result<Self, AutorouterError> {
Ok(Self { Ok(Self {
autoroute: autorouter.planar_autoroute_ratlines(vec![ratline1, ratline2], options)?, autoroute: autorouter.planar_autoroute_ratlines(vec![ratline1, ratline2], options)?,

View File

@ -9,7 +9,7 @@ use serde::{Deserialize, Serialize};
use crate::{ use crate::{
autorouter::{ autorouter::{
multilayer_autoroute::{MultilayerAutorouteExecutionStepper, MultilayerAutorouterOptions}, multilayer_autoroute::{MultilayerAutorouteExecutionStepper, MultilayerAutorouteOptions},
permutator::PlanarAutorouteExecutionPermutator, permutator::PlanarAutorouteExecutionPermutator,
}, },
board::{edit::BoardEdit, AccessMesadata}, board::{edit::BoardEdit, AccessMesadata},
@ -25,15 +25,15 @@ use super::{
place_via::PlaceViaExecutionStepper, place_via::PlaceViaExecutionStepper,
remove_bands::RemoveBandsExecutionStepper, remove_bands::RemoveBandsExecutionStepper,
selection::{BandSelection, PinSelection}, selection::{BandSelection, PinSelection},
Autorouter, AutorouterOptions, Autorouter, PlanarAutorouteOptions,
}; };
type Type = PinSelection; type Type = PinSelection;
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
pub enum Command { pub enum Command {
Autoroute(PinSelection, AutorouterOptions), // TODO: Rename to PlanarAutoroute. Autoroute(PinSelection, PlanarAutorouteOptions), // TODO: Rename to PlanarAutoroute.
MultilayerAutoroute(PinSelection, MultilayerAutorouterOptions), MultilayerAutoroute(PinSelection, MultilayerAutorouteOptions),
TopoAutoroute { TopoAutoroute {
selection: PinSelection, selection: PinSelection,
#[serde(default, skip_serializing_if = "BTreeSet::is_empty")] #[serde(default, skip_serializing_if = "BTreeSet::is_empty")]
@ -43,7 +43,7 @@ pub enum Command {
}, },
PlaceVia(ViaWeight), PlaceVia(ViaWeight),
RemoveBands(BandSelection), RemoveBands(BandSelection),
CompareDetours(Type, AutorouterOptions), CompareDetours(Type, PlanarAutorouteOptions),
MeasureLength(BandSelection), MeasureLength(BandSelection),
} }

View File

@ -14,7 +14,7 @@ use crate::{
permutator::PlanarAutorouteExecutionPermutator, permutator::PlanarAutorouteExecutionPermutator,
planar_autoroute::PlanarAutorouteContinueStatus, planar_autoroute::PlanarAutorouteContinueStatus,
ratline::RatlineIndex, ratline::RatlineIndex,
Autorouter, AutorouterError, AutorouterOptions, Autorouter, AutorouterError, PlanarAutorouteOptions,
}, },
board::edit::BoardEdit, board::edit::BoardEdit,
drawing::graph::PrimitiveIndex, drawing::graph::PrimitiveIndex,
@ -24,9 +24,9 @@ use crate::{
}; };
#[derive(Clone, Copy, Debug, Deserialize, Serialize)] #[derive(Clone, Copy, Debug, Deserialize, Serialize)]
pub struct MultilayerAutorouterOptions { pub struct MultilayerAutorouteOptions {
pub anterouter: AnterouterOptions, pub anterouter: AnterouterOptions,
pub planar: AutorouterOptions, pub planar: PlanarAutorouteOptions,
} }
pub struct MultilayerAutorouteExecutionStepper { pub struct MultilayerAutorouteExecutionStepper {
@ -38,7 +38,7 @@ impl MultilayerAutorouteExecutionStepper {
autorouter: &mut Autorouter<impl AccessMesadata>, autorouter: &mut Autorouter<impl AccessMesadata>,
ratlines: Vec<RatlineIndex>, ratlines: Vec<RatlineIndex>,
plan: AnterouterPlan, plan: AnterouterPlan,
options: MultilayerAutorouterOptions, options: MultilayerAutorouteOptions,
) -> Result<Self, AutorouterError> { ) -> Result<Self, AutorouterError> {
let mut assigner = Anterouter::new(plan); let mut assigner = Anterouter::new(plan);
assigner.anteroute(autorouter, &options.anterouter); assigner.anteroute(autorouter, &options.anterouter);

View File

@ -13,7 +13,7 @@ use crate::{
planar_autoroute::{PlanarAutorouteContinueStatus, PlanarAutorouteExecutionStepper}, planar_autoroute::{PlanarAutorouteContinueStatus, PlanarAutorouteExecutionStepper},
presorter::{PresortParams, PresortRatlines, SccIntersectionsAndLengthPresorter}, presorter::{PresortParams, PresortRatlines, SccIntersectionsAndLengthPresorter},
ratline::RatlineIndex, ratline::RatlineIndex,
Autorouter, AutorouterError, AutorouterOptions, Autorouter, AutorouterError, PlanarAutorouteOptions,
}, },
board::edit::BoardEdit, board::edit::BoardEdit,
drawing::graph::PrimitiveIndex, drawing::graph::PrimitiveIndex,
@ -25,14 +25,14 @@ use crate::{
pub struct PlanarAutorouteExecutionPermutator { pub struct PlanarAutorouteExecutionPermutator {
stepper: PlanarAutorouteExecutionStepper, stepper: PlanarAutorouteExecutionStepper,
permuter: RatlinesPermuter, permuter: RatlinesPermuter,
options: AutorouterOptions, options: PlanarAutorouteOptions,
} }
impl PlanarAutorouteExecutionPermutator { impl PlanarAutorouteExecutionPermutator {
pub fn new( pub fn new(
autorouter: &mut Autorouter<impl AccessMesadata>, autorouter: &mut Autorouter<impl AccessMesadata>,
ratlines: Vec<RatlineIndex>, ratlines: Vec<RatlineIndex>,
options: AutorouterOptions, options: PlanarAutorouteOptions,
) -> Result<Self, AutorouterError> { ) -> Result<Self, AutorouterError> {
let presorter = SccIntersectionsAndLengthPresorter::new( let presorter = SccIntersectionsAndLengthPresorter::new(
autorouter, autorouter,

View File

@ -12,7 +12,7 @@ use crate::{
autorouter::{ autorouter::{
planar_autoroute::PlanarAutorouteExecutionStepper, planar_autoroute::PlanarAutorouteExecutionStepper,
presorter::SccIntersectionsAndLengthPresorter, ratline::RatlineIndex, scc::Scc, Autorouter, presorter::SccIntersectionsAndLengthPresorter, ratline::RatlineIndex, scc::Scc, Autorouter,
AutorouterOptions, PlanarAutorouteOptions,
}, },
drawing::graph::MakePrimitiveRef, drawing::graph::MakePrimitiveRef,
geometry::{GenericNode, GetLayer}, geometry::{GenericNode, GetLayer},
@ -39,7 +39,7 @@ impl RatlinesPermuter {
autorouter: &mut Autorouter<impl AccessMesadata>, autorouter: &mut Autorouter<impl AccessMesadata>,
ratlines: Vec<RatlineIndex>, ratlines: Vec<RatlineIndex>,
presorter: SccIntersectionsAndLengthPresorter, presorter: SccIntersectionsAndLengthPresorter,
options: &AutorouterOptions, options: &PlanarAutorouteOptions,
) -> Self { ) -> Self {
RatlinesPermuter::SccPermutations(SccPermutationsRatlinePermuter::new( RatlinesPermuter::SccPermutations(SccPermutationsRatlinePermuter::new(
autorouter, ratlines, presorter, options, autorouter, ratlines, presorter, options,
@ -60,7 +60,7 @@ impl SccPermutationsRatlinePermuter {
_autorouter: &mut Autorouter<impl AccessMesadata>, _autorouter: &mut Autorouter<impl AccessMesadata>,
ratlines: Vec<RatlineIndex>, ratlines: Vec<RatlineIndex>,
presorter: SccIntersectionsAndLengthPresorter, presorter: SccIntersectionsAndLengthPresorter,
_options: &AutorouterOptions, _options: &PlanarAutorouteOptions,
) -> Self { ) -> Self {
// TODO: Instead of instantiating presorter again here, get it from // TODO: Instead of instantiating presorter again here, get it from
// an argument. // an argument.
@ -120,7 +120,7 @@ impl RatlineCutsRatlinePermuter {
_autorouter: &mut Autorouter<impl AccessMesadata>, _autorouter: &mut Autorouter<impl AccessMesadata>,
_ratlines: Vec<RatlineIndex>, _ratlines: Vec<RatlineIndex>,
_presorter: SccIntersectionsAndLengthPresorter, _presorter: SccIntersectionsAndLengthPresorter,
_options: &AutorouterOptions, _options: &PlanarAutorouteOptions,
) -> Self { ) -> Self {
/*Self { /*Self {
sccs: presorter.dissolve(), sccs: presorter.dissolve(),

View File

@ -26,7 +26,7 @@ use crate::{
use super::{ use super::{
invoker::GetDebugOverlayData, ratline::RatlineIndex, Autorouter, AutorouterError, invoker::GetDebugOverlayData, ratline::RatlineIndex, Autorouter, AutorouterError,
AutorouterOptions, PlanarAutorouteOptions,
}; };
/// Represents the current status of the autoroute operation. /// Represents the current status of the autoroute operation.
@ -53,7 +53,7 @@ pub struct PlanarAutorouteExecutionStepper {
/// Records the changes to the board data, one routed band per item. /// Records the changes to the board data, one routed band per item.
board_data_edits: Vec<BoardDataEdit>, board_data_edits: Vec<BoardDataEdit>,
/// The options for the autorouting process, defining how routing should be carried out. /// The options for the autorouting process, defining how routing should be carried out.
options: AutorouterOptions, options: PlanarAutorouteOptions,
} }
impl PlanarAutorouteExecutionStepper { impl PlanarAutorouteExecutionStepper {
@ -65,7 +65,7 @@ impl PlanarAutorouteExecutionStepper {
pub fn new( pub fn new(
autorouter: &mut Autorouter<impl AccessMesadata>, autorouter: &mut Autorouter<impl AccessMesadata>,
ratlines: Vec<RatlineIndex>, ratlines: Vec<RatlineIndex>,
options: AutorouterOptions, options: PlanarAutorouteOptions,
) -> Result<Self, AutorouterError> { ) -> Result<Self, AutorouterError> {
if ratlines.is_empty() { if ratlines.is_empty() {
return Err(AutorouterError::NothingToRoute); return Err(AutorouterError::NothingToRoute);

View File

@ -18,11 +18,11 @@ use crate::{
stepper::Step, stepper::Step,
}; };
use super::{Autorouter, AutorouterError, AutorouterOptions}; use super::{Autorouter, AutorouterError, PlanarAutorouteOptions};
pub struct PointrouteExecutionStepper { pub struct PointrouteExecutionStepper {
route: RouteStepper, route: RouteStepper,
options: AutorouterOptions, options: PlanarAutorouteOptions,
} }
impl PointrouteExecutionStepper { impl PointrouteExecutionStepper {
@ -30,7 +30,7 @@ impl PointrouteExecutionStepper {
autorouter: &mut Autorouter<impl AccessMesadata>, autorouter: &mut Autorouter<impl AccessMesadata>,
origin: FixedDotIndex, origin: FixedDotIndex,
point: Point, point: Point,
options: AutorouterOptions, options: PlanarAutorouteOptions,
) -> Result<Self, AutorouterError> { ) -> Result<Self, AutorouterError> {
let destination = autorouter.board.add_fixed_dot_infringably( let destination = autorouter.board.add_fixed_dot_infringably(
&mut BoardEdit::new(), // TODO? &mut BoardEdit::new(), // TODO?