mirror of https://codeberg.org/topola/topola.git
feat(topola-egui): Display timeout of planar autoroute too
This commit is contained in:
parent
18e8f9812c
commit
9afe862edc
|
|
@ -48,14 +48,14 @@ impl StatusBar {
|
|||
let maximum = progress.maximum();
|
||||
let ratio = *value as f32 / *maximum as f32;
|
||||
|
||||
if let Some(trigger_progress) = activity.timeout_progress() {
|
||||
if let Some(timeout_progress) = activity.timeout_progress() {
|
||||
ui.add(egui::ProgressBar::new(ratio).text(format!(
|
||||
"{:.1}% ({:.1}/{:.1}) (timeout: {:.1}/{:.1}))",
|
||||
ratio * 100.0,
|
||||
value,
|
||||
maximum,
|
||||
trigger_progress.value(),
|
||||
trigger_progress.maximum(),
|
||||
timeout_progress.value(),
|
||||
timeout_progress.maximum(),
|
||||
)));
|
||||
} else {
|
||||
ui.add(egui::ProgressBar::new(ratio).text(format!(
|
||||
|
|
@ -71,12 +71,23 @@ impl StatusBar {
|
|||
let maximum = linear_subprogress.maximum();
|
||||
let ratio = *value as f32 / *maximum as f32;
|
||||
|
||||
ui.add(egui::ProgressBar::new(ratio).text(format!(
|
||||
"{:.1}% ({:.1}/{:.1})",
|
||||
ratio * 100.0,
|
||||
value,
|
||||
maximum
|
||||
)));
|
||||
if let Some(timeout_progress) = activity.timeout_progress() {
|
||||
ui.add(egui::ProgressBar::new(ratio).text(format!(
|
||||
"{:.1}% ({:.1}/{:.1}) (timeout: {:.1}/{:.1}))",
|
||||
ratio * 100.0,
|
||||
value,
|
||||
maximum,
|
||||
timeout_progress.subscale().value(),
|
||||
timeout_progress.subscale().maximum(),
|
||||
)));
|
||||
} else {
|
||||
ui.add(egui::ProgressBar::new(ratio).text(format!(
|
||||
"{:.1}% ({:.1}/{:.1})",
|
||||
ratio * 100.0,
|
||||
value,
|
||||
maximum
|
||||
)));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -200,9 +200,9 @@ impl<M> EstimateProgress for ExecutionStepper<M> {
|
|||
// Since enum_dispatch does not really support generics, we implement this the
|
||||
// long way by using `match`.
|
||||
impl<M> GetTimeoutProgress for ExecutionStepper<M> {
|
||||
type Subscale = ();
|
||||
type Subscale = LinearScale<f64>;
|
||||
|
||||
fn timeout_progress(&self) -> Option<LinearScale<f64>> {
|
||||
fn timeout_progress(&self) -> Option<LinearScale<f64, LinearScale<f64>>> {
|
||||
match self {
|
||||
ExecutionStepper::MultilayerAutoroute(autoroute) => autoroute.timeout_progress(),
|
||||
ExecutionStepper::PlanarAutoroute(autoroute) => None,
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
use std::ops::ControlFlow;
|
||||
|
||||
use derive_getters::Getters;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specctra_core::mesadata::AccessMesadata;
|
||||
|
||||
|
|
@ -36,9 +37,12 @@ pub struct MultilayerAutorouteOptions {
|
|||
pub planar: PlanarAutorouteOptions,
|
||||
}
|
||||
|
||||
#[derive(Getters)]
|
||||
pub struct MultilayerAutorouteExecutionStepper {
|
||||
planar: PlanarAutorouteReconfigurator,
|
||||
#[getter(skip)]
|
||||
anteroute_edit: BoardEdit,
|
||||
#[getter(skip)]
|
||||
options: MultilayerAutorouteOptions,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ impl MultilayerAutorouteReconfigurator {
|
|||
preconfiguration,
|
||||
options,
|
||||
)?,
|
||||
timeout: TimeVsProgressAccumulatorTimeout::new(10.0, 5.0),
|
||||
timeout: TimeVsProgressAccumulatorTimeout::new(10.0, 1.0),
|
||||
reconfigurer,
|
||||
options,
|
||||
})
|
||||
|
|
@ -161,13 +161,13 @@ impl EstimateProgress for MultilayerAutorouteReconfigurator {
|
|||
}
|
||||
|
||||
impl GetTimeoutProgress for MultilayerAutorouteReconfigurator {
|
||||
type Subscale = ();
|
||||
type Subscale = LinearScale<f64>;
|
||||
|
||||
fn timeout_progress(&self) -> Option<LinearScale<f64>> {
|
||||
fn timeout_progress(&self) -> Option<LinearScale<f64, LinearScale<f64>>> {
|
||||
Some(LinearScale::new(
|
||||
self.timeout.start_instant().elapsed().as_secs_f64(),
|
||||
*self.timeout.progress_accumulator(),
|
||||
(),
|
||||
self.stepper.planar().timeout_progress()?,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@ use crate::{
|
|||
geometry::primitive::PrimitiveShape,
|
||||
router::{navcord::Navcord, navmesh::Navmesh, thetastar::ThetastarStepper},
|
||||
stepper::{
|
||||
Abort, EstimateProgress, LinearScale, ReconfiguratorStatus, Reconfigure, Step,
|
||||
TimeVsProgressAccumulatorTimeout,
|
||||
Abort, EstimateProgress, GetTimeoutProgress, LinearScale, ReconfiguratorStatus,
|
||||
Reconfigure, Step, TimeVsProgressAccumulatorTimeout,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
@ -148,6 +148,18 @@ impl EstimateProgress for PlanarAutorouteReconfigurator {
|
|||
}
|
||||
}
|
||||
|
||||
impl GetTimeoutProgress for PlanarAutorouteReconfigurator {
|
||||
type Subscale = ();
|
||||
|
||||
fn timeout_progress(&self) -> Option<LinearScale<f64>> {
|
||||
Some(LinearScale::new(
|
||||
self.timeout.start_instant().elapsed().as_secs_f64(),
|
||||
*self.timeout.progress_accumulator(),
|
||||
(),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
impl GetDebugOverlayData for PlanarAutorouteReconfigurator {
|
||||
fn maybe_thetastar(&self) -> Option<&ThetastarStepper<Navmesh, f64>> {
|
||||
self.stepper.maybe_thetastar()
|
||||
|
|
|
|||
|
|
@ -117,9 +117,9 @@ impl<M> EstimateProgress for ActivityStepper<M> {
|
|||
// Since enum_dispatch does not really support generics, we implement this the
|
||||
// long way by using `match`.
|
||||
impl<M> GetTimeoutProgress for ActivityStepper<M> {
|
||||
type Subscale = ();
|
||||
type Subscale = LinearScale<f64>;
|
||||
|
||||
fn timeout_progress(&self) -> Option<LinearScale<f64>> {
|
||||
fn timeout_progress(&self) -> Option<LinearScale<f64, LinearScale<f64>>> {
|
||||
match self {
|
||||
ActivityStepper::Interaction(..) => None,
|
||||
ActivityStepper::Execution(execution) => execution.timeout_progress(),
|
||||
|
|
@ -218,9 +218,9 @@ impl<M> EstimateProgress for ActivityStepperWithStatus<M> {
|
|||
}
|
||||
|
||||
impl<M> GetTimeoutProgress for ActivityStepperWithStatus<M> {
|
||||
type Subscale = ();
|
||||
type Subscale = LinearScale<f64>;
|
||||
|
||||
fn timeout_progress(&self) -> Option<LinearScale<f64>> {
|
||||
fn timeout_progress(&self) -> Option<LinearScale<f64, LinearScale<f64>>> {
|
||||
self.activity.timeout_progress()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue