Modify GUI for better readability, clean up
This commit is contained in:
13
src/main.rs
13
src/main.rs
@@ -1,15 +1,18 @@
|
||||
use eframe::{run_native, App, CreationContext, NativeOptions, Frame};
|
||||
use egui::{CentralPanel, SidePanel, Context};
|
||||
use egui_graphs::{GraphView, Graph, SettingsStyle, LayoutRandom, LayoutStateRandom};
|
||||
use egui_graphs::{DefaultEdgeShape, DefaultNodeShape, Graph, GraphView, LayoutRandom, LayoutStateRandom, SettingsStyle};
|
||||
|
||||
use algorithms::ford_fulkerson;
|
||||
use petgraph::Directed;
|
||||
use random_generator::MaxflowProblem;
|
||||
use layout::CustomEdgeShape;
|
||||
use crate::algorithms::ford_fulkerson;
|
||||
|
||||
mod random_generator;
|
||||
mod algorithms;
|
||||
mod graph;
|
||||
mod layout;
|
||||
|
||||
pub struct MaxflowApp {
|
||||
g: Graph<(f32, f32), (u64, u64)>,
|
||||
g: Graph<(f32, f32), (u64, u64), Directed, u32, DefaultNodeShape, CustomEdgeShape>,
|
||||
p: MaxflowProblem,
|
||||
node_count: u64,
|
||||
max_capacity: u64,
|
||||
@@ -26,7 +29,7 @@ impl App for MaxflowApp {
|
||||
fn update(&mut self, ctx: &Context, _: &mut Frame) {
|
||||
ctx.set_theme(egui::Theme::Light);
|
||||
CentralPanel::default().show(ctx, |ui| {
|
||||
ui.add(&mut GraphView::<_, _, _, _, _, _, LayoutStateRandom, LayoutRandom>::new(&mut self.g).with_styles(&SettingsStyle::default().with_labels_always(true)));
|
||||
ui.add(&mut GraphView::<_, _, _, _, _, CustomEdgeShape, LayoutStateRandom, LayoutRandom>::new(&mut self.g).with_styles(&SettingsStyle::default().with_labels_always(true)));
|
||||
});
|
||||
SidePanel::right("right_panel")
|
||||
.min_width(200.)
|
||||
|
||||
Reference in New Issue
Block a user