2024-11-03 20:57:53 +00:00
|
|
|
struct PlotDisplay {
|
|
|
|
|
circles: Vec<crate::Circle>,
|
|
|
|
|
circle_length: usize,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl PlotDisplay {
|
|
|
|
|
fn new(circles: Vec<crate::Circle>, circle_length: usize) -> Self {
|
|
|
|
|
Self {
|
|
|
|
|
circles,
|
|
|
|
|
circle_length,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl eframe::App for PlotDisplay { //TODO: Define axis ranges
|
|
|
|
|
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
|
|
|
|
|
egui::CentralPanel::default().show(ctx, |ui| {
|
|
|
|
|
crate::plot(ui, &mut self.circles, &self.circle_length);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub fn display_plot(circles: Vec<crate::Circle>) -> Result<(), eframe::Error> {
|
|
|
|
|
let options = eframe::NativeOptions::default();
|
|
|
|
|
eframe::run_native("Encoded Message", options, Box::new(|_cc| Ok(Box::<PlotDisplay>::new(
|
|
|
|
|
PlotDisplay::new(circles, 1000)
|
|
|
|
|
))))
|
|
|
|
|
}
|