mirror of https://codeberg.org/topola/topola.git
refactor(autorouter/planar_autoroute): Slightly reduce code duplication
This commit is contained in:
parent
3208d55272
commit
33d91b0a87
|
|
@ -141,9 +141,17 @@ impl PlanarAutorouteExecutionStepper {
|
||||||
|
|
||||||
autorouter.board.apply_edit(&board_edit.reverse());
|
autorouter.board.apply_edit(&board_edit.reverse());
|
||||||
|
|
||||||
|
self.curr_ratline_index = index;
|
||||||
|
Ok(self.start_routing_ratline(autorouter)?)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn start_routing_ratline(
|
||||||
|
&mut self,
|
||||||
|
autorouter: &mut Autorouter<impl AccessMesadata>,
|
||||||
|
) -> Result<(), AutorouterError> {
|
||||||
let (origin, destination) = self
|
let (origin, destination) = self
|
||||||
.configuration
|
.configuration
|
||||||
.ratline_terminating_dots(autorouter, index);
|
.ratline_terminating_dots(autorouter, self.curr_ratline_index);
|
||||||
let mut router = Router::new(autorouter.board.layout_mut(), self.options.router);
|
let mut router = Router::new(autorouter.board.layout_mut(), self.options.router);
|
||||||
|
|
||||||
self.route = Some(router.route(
|
self.route = Some(router.route(
|
||||||
|
|
@ -153,7 +161,6 @@ impl PlanarAutorouteExecutionStepper {
|
||||||
self.options.router.routed_band_width,
|
self.options.router.routed_band_width,
|
||||||
)?);
|
)?);
|
||||||
|
|
||||||
self.curr_ratline_index = index;
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -245,21 +252,14 @@ impl<M: AccessMesadata> Step<Autorouter<M>, Option<BoardEdit>, PlanarAutorouteCo
|
||||||
|
|
||||||
self.curr_ratline_index += 1;
|
self.curr_ratline_index += 1;
|
||||||
|
|
||||||
if let Some(..) = self.configuration.ratlines.get(self.curr_ratline_index) {
|
if self
|
||||||
let (origin, destination) = self
|
|
||||||
.configuration
|
.configuration
|
||||||
.ratline_terminating_dots(autorouter, self.curr_ratline_index);
|
.ratlines
|
||||||
let mut router = Router::new(autorouter.board.layout_mut(), self.options.router);
|
.get(self.curr_ratline_index)
|
||||||
|
.is_some()
|
||||||
|
{
|
||||||
self.dissolve_route_stepper_and_push_layout_edit();
|
self.dissolve_route_stepper_and_push_layout_edit();
|
||||||
let recorder = LayoutEdit::new();
|
self.start_routing_ratline(autorouter);
|
||||||
|
|
||||||
self.route = Some(router.route(
|
|
||||||
recorder,
|
|
||||||
origin,
|
|
||||||
destination,
|
|
||||||
self.options.router.routed_band_width,
|
|
||||||
)?);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(ControlFlow::Continue(ret))
|
Ok(ControlFlow::Continue(ret))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue