mirror of https://codeberg.org/topola/topola.git
fix(autorouter): have band removal and via placement in undo/redo
This commit is contained in:
parent
75aa4ea443
commit
2703f662ac
|
|
@ -53,12 +53,12 @@ impl ExecutionStepper {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ExecutionStepper::PlaceVia(place_via) => {
|
ExecutionStepper::PlaceVia(place_via) => {
|
||||||
place_via.doit(autorouter)?;
|
let edit = place_via.doit(autorouter)?;
|
||||||
ControlFlow::Break((None, "finished placing via".to_string()))
|
ControlFlow::Break((edit, "finished placing via".to_string()))
|
||||||
}
|
}
|
||||||
ExecutionStepper::RemoveBands(remove_bands) => {
|
ExecutionStepper::RemoveBands(remove_bands) => {
|
||||||
remove_bands.doit(autorouter)?;
|
let edit = remove_bands.doit(autorouter)?;
|
||||||
ControlFlow::Break((None, "finished removing bands".to_string()))
|
ControlFlow::Break((edit, "finished removing bands".to_string()))
|
||||||
}
|
}
|
||||||
ExecutionStepper::CompareDetours(compare_detours) => {
|
ExecutionStepper::CompareDetours(compare_detours) => {
|
||||||
match compare_detours.step(autorouter)? {
|
match compare_detours.step(autorouter)? {
|
||||||
|
|
|
||||||
|
|
@ -32,16 +32,18 @@ impl PlaceViaExecutionStepper {
|
||||||
pub fn doit(
|
pub fn doit(
|
||||||
&mut self,
|
&mut self,
|
||||||
autorouter: &mut Autorouter<impl AccessMesadata>,
|
autorouter: &mut Autorouter<impl AccessMesadata>,
|
||||||
) -> Result<(), AutorouterError> {
|
) -> Result<Option<LayoutEdit>, AutorouterError> {
|
||||||
if !self.done {
|
if !self.done {
|
||||||
self.done = true;
|
self.done = true;
|
||||||
|
|
||||||
|
let mut edit = LayoutEdit::new();
|
||||||
autorouter
|
autorouter
|
||||||
.board
|
.board
|
||||||
.layout_mut()
|
.layout_mut()
|
||||||
.add_via(&mut LayoutEdit::new(), self.weight)?;
|
.add_via(&mut edit, self.weight)?;
|
||||||
Ok(())
|
Ok(Some(edit))
|
||||||
} else {
|
} else {
|
||||||
Ok(())
|
Ok(None)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,20 +31,18 @@ impl RemoveBandsExecutionStepper {
|
||||||
pub fn doit(
|
pub fn doit(
|
||||||
&mut self,
|
&mut self,
|
||||||
autorouter: &mut Autorouter<impl AccessMesadata>,
|
autorouter: &mut Autorouter<impl AccessMesadata>,
|
||||||
) -> Result<(), AutorouterError> {
|
) -> Result<Option<LayoutEdit>, AutorouterError> {
|
||||||
if !self.done {
|
if !self.done {
|
||||||
self.done = true;
|
self.done = true;
|
||||||
|
|
||||||
|
let mut edit = LayoutEdit::new();
|
||||||
for selector in self.selection.selectors() {
|
for selector in self.selection.selectors() {
|
||||||
let band = autorouter.board.bandname_band(&selector.band).unwrap().0;
|
let band = autorouter.board.bandname_band(&selector.band).unwrap().0;
|
||||||
autorouter
|
autorouter.board.layout_mut().remove_band(&mut edit, band);
|
||||||
.board
|
|
||||||
.layout_mut()
|
|
||||||
.remove_band(&mut LayoutEdit::new(), band);
|
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(Some(edit))
|
||||||
} else {
|
} else {
|
||||||
Ok(())
|
Ok(None)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue