mirror of https://codeberg.org/topola/topola.git
egui,tests: fix compilation errors
This commit is contained in:
parent
42a0777e7f
commit
a6fb1157e3
|
|
@ -57,7 +57,7 @@ impl Autoroute {
|
|||
let (from, to) = Self::edge_from_to(autorouter, cur_edge);
|
||||
|
||||
let layout = autorouter.layout.lock().unwrap();
|
||||
Some(Navmesh::new(&layout, from, to).ok()?)
|
||||
Some(Navmesh::new(&layout, from, to).ok().unwrap())
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
|
@ -109,14 +109,14 @@ impl Autoroute {
|
|||
}
|
||||
|
||||
pub struct Autorouter<R: RulesTrait> {
|
||||
ratsnest: Ratsnest,
|
||||
layout: Arc<Mutex<Layout<R>>>,
|
||||
ratsnest: Ratsnest,
|
||||
}
|
||||
|
||||
impl<R: RulesTrait> Autorouter<R> {
|
||||
pub fn new(layout: Arc<Mutex<Layout<R>>>) -> Result<Self, InsertionError> {
|
||||
let ratsnest = Ratsnest::new(&layout.lock().unwrap())?;
|
||||
Ok(Self { ratsnest, layout })
|
||||
Ok(Self { layout, ratsnest })
|
||||
}
|
||||
|
||||
pub fn autoroute(&mut self, layer: u64, observer: &mut impl RouterObserverTrait<R>) {
|
||||
|
|
@ -134,4 +134,8 @@ impl<R: RulesTrait> Autorouter<R> {
|
|||
pub fn layout(&self) -> &Arc<Mutex<Layout<R>>> {
|
||||
&self.layout
|
||||
}
|
||||
|
||||
pub fn ratsnest(&self) -> &Ratsnest {
|
||||
&self.ratsnest
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -203,23 +203,24 @@ impl eframe::App for App {
|
|||
execute(async move {
|
||||
let mut autorouter = Autorouter::new(layout).unwrap();
|
||||
if let Some(mut autoroute) = autorouter.autoroute_walk() {
|
||||
let from_to = autoroute.from_to(&autorouter);
|
||||
let from = autoroute.navmesh().as_ref().unwrap().from();
|
||||
let to = autoroute.navmesh().as_ref().unwrap().to();
|
||||
|
||||
{
|
||||
let mut shared_data = shared_data_arc_mutex.lock().unwrap();
|
||||
shared_data.from = dbg!(Some(from_to.0));
|
||||
shared_data.to = dbg!(Some(from_to.1));
|
||||
shared_data.navmesh = Some(autoroute.navmesh().clone());
|
||||
shared_data.from = Some(from);
|
||||
shared_data.to = Some(to);
|
||||
shared_data.navmesh = autoroute.navmesh().clone();
|
||||
}
|
||||
|
||||
while let Some(()) = autoroute.next(
|
||||
while autoroute.next(
|
||||
&mut autorouter,
|
||||
&mut DebugRouterObserver {
|
||||
shared_data: shared_data_arc_mutex.clone(),
|
||||
},
|
||||
) {
|
||||
shared_data_arc_mutex.lock().unwrap().navmesh =
|
||||
Some(autoroute.navmesh().clone());
|
||||
autoroute.navmesh().clone();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -58,6 +58,22 @@ pub trait RouterObserverTrait<R: RulesTrait> {
|
|||
fn on_estimate(&mut self, tracer: &Tracer<R>, vertex: VertexIndex);
|
||||
}
|
||||
|
||||
pub struct EmptyRouterObserver;
|
||||
|
||||
impl<R: RulesTrait> RouterObserverTrait<R> for EmptyRouterObserver {
|
||||
fn on_rework(&mut self, _tracer: &Tracer<R>, _trace: &Trace) {}
|
||||
fn before_probe(&mut self, _tracer: &Tracer<R>, _trace: &Trace, _edge: NavmeshEdgeReference) {}
|
||||
fn on_probe(
|
||||
&mut self,
|
||||
_tracer: &Tracer<R>,
|
||||
_trace: &Trace,
|
||||
_edge: NavmeshEdgeReference,
|
||||
_result: Result<(), DrawException>,
|
||||
) {
|
||||
}
|
||||
fn on_estimate(&mut self, _tracer: &Tracer<R>, _vertex: VertexIndex) {}
|
||||
}
|
||||
|
||||
pub struct Router<'a, R: RulesTrait> {
|
||||
layout: &'a mut Arc<Mutex<Layout<R>>>,
|
||||
navmesh: Navmesh,
|
||||
|
|
|
|||
Loading…
Reference in New Issue