mirror of
https://github.com/aziis98/asd-2024.git
synced 2026-10-06 06:35:00 +00:00
changes
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use std::time::Instant;
|
||||
|
||||
use macroquad::{prelude::*, rand, ui::root_ui};
|
||||
use macroquad::{prelude::*, ui::root_ui};
|
||||
|
||||
#[macroquad::main("by-hand")]
|
||||
async fn main() {
|
||||
|
||||
@@ -533,8 +533,8 @@ fn generate() -> (
|
||||
) {
|
||||
let mut g: StableGraph<(String, Orientation), ()> = StableGraph::new();
|
||||
|
||||
let file = std::fs::File::open(env::args().nth(1).expect("missing gfa file argument")).unwrap();
|
||||
let entries = parser::parse_source(file).unwrap();
|
||||
let entries =
|
||||
parser::parse_file(env::args().nth(1).expect("missing gfa file argument")).unwrap();
|
||||
|
||||
let mut index_map = HashMap::new();
|
||||
|
||||
|
||||
@@ -26,14 +26,14 @@ pub struct SettingsInteraction {
|
||||
pub struct SettingsNavigation {
|
||||
pub fit_to_screen_enabled: bool,
|
||||
pub zoom_and_pan_enabled: bool,
|
||||
pub screen_padding: f32,
|
||||
// pub screen_padding: f32,
|
||||
pub zoom_speed: f32,
|
||||
}
|
||||
|
||||
impl Default for SettingsNavigation {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
screen_padding: 0.3,
|
||||
// screen_padding: 0.3,
|
||||
zoom_speed: 0.1,
|
||||
fit_to_screen_enabled: true,
|
||||
zoom_and_pan_enabled: false,
|
||||
|
||||
@@ -46,8 +46,7 @@ impl App for InteractiveApp {
|
||||
fn generate_graph() -> Graph<(String, Orientation), ()> {
|
||||
let mut g: StableGraph<(String, Orientation), ()> = StableGraph::new();
|
||||
|
||||
let file = std::fs::File::open("../../dataset/example.gfa").unwrap();
|
||||
let entries = parser::parse_source(file).unwrap();
|
||||
let entries = parser::parse_file("../../dataset/example.gfa").unwrap();
|
||||
|
||||
let mut index_map = HashMap::new();
|
||||
|
||||
|
||||
@@ -21,8 +21,9 @@ use macroquad::prelude::*;
|
||||
async fn main() {
|
||||
let mut graph = Graph::<(String, Orientation), ()>::new();
|
||||
|
||||
let file = std::fs::File::open(env::args().nth(1).expect("missing gfa file argument")).unwrap();
|
||||
let entries = parser::parse_source(file).unwrap();
|
||||
let filename = env::args().nth(1).expect("missing gfa file argument");
|
||||
|
||||
let entries = parser::parse_file(filename).expect("failed to parse file");
|
||||
|
||||
let mut index_map = HashMap::new();
|
||||
|
||||
|
||||
@@ -137,15 +137,7 @@ fn load_graph() -> StableGraph<(String, Point2<f32>), ()> {
|
||||
let mut graph = StableGraph::new();
|
||||
|
||||
let filename = env::args().nth(1).expect("missing gfa file argument");
|
||||
|
||||
let file_lines_count = BufReader::new(std::fs::File::open(&filename).expect("file not found"))
|
||||
.lines()
|
||||
.progress_with(indicatif::ProgressBar::new_spinner())
|
||||
.count() as u64;
|
||||
|
||||
let file = std::fs::File::open(filename).unwrap();
|
||||
|
||||
let entries = parser::parse_source(file, file_lines_count).unwrap();
|
||||
let entries = parser::parse_file(filename).expect("failed to parse file");
|
||||
|
||||
let mut index_map = HashMap::new();
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
io::{self, BufRead, BufReader, Read},
|
||||
str::FromStr,
|
||||
thread,
|
||||
@@ -126,6 +127,17 @@ fn parse_walk(line: &str) -> Entry {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn parse_file<R: AsRef<str>>(file: R) -> io::Result<Vec<Entry>> {
|
||||
let file_lines_count = BufReader::new(std::fs::File::open(file.as_ref())?)
|
||||
.lines()
|
||||
.progress_count(0)
|
||||
.count() as u64;
|
||||
|
||||
let file = std::fs::File::open(file.as_ref())?;
|
||||
|
||||
parse_source(file, file_lines_count)
|
||||
}
|
||||
|
||||
pub fn parse_source<R: Read>(reader: R, line_count: u64) -> io::Result<Vec<Entry>> {
|
||||
let mut entries = Vec::new();
|
||||
let mut skipped = Vec::new();
|
||||
|
||||
Reference in New Issue
Block a user