diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-10-08 17:15:13 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-10-08 17:15:13 +0800 |
| commit | 2f15387e73435c1cf5bf61a766021bb69d46158c (patch) | |
| tree | f5cada1b509bdc781b1af2b60922abe717c59a8e /src/image.rs | |
| parent | a5741aeca683e39b01f667ad795ce87e9475fa41 (diff) | |
WIP(image): actually parse and build from astimage
Diffstat (limited to 'src/image.rs')
| -rw-r--r-- | src/image.rs | 84 |
1 files changed, 46 insertions, 38 deletions
diff --git a/src/image.rs b/src/image.rs index 9522364..09c23e1 100644 --- a/src/image.rs +++ b/src/image.rs @@ -346,44 +346,52 @@ impl FlowChart { } fn build(&mut self, ast: &[DepthExpr]) { - // for node in ast { - // match node { - // DepthExpr::Decision { - // cond, - // t, - // then_branch, - // else_branch, - // } => todo!(), - // DepthExpr::IO(_) => todo!(), - // DepthExpr::Process(_) => todo!(), - // } - // } - self.draw_process("abcdefghijklmnospa", VDirection::Up); - self.draw_direction(None, None); - self.draw_process("abc", VDirection::Up); - self.draw_direction(None, None); - self.draw_process("a", VDirection::Up); - let offset = self.offset; - self.draw_direction(None, None); - self.draw_process("a", VDirection::Up); - self.draw_direction(None, None); - let a = self.draw_process("a", VDirection::Up); - self.draw_direction( - Some(&NCOffset { - x: self - .offset - .center, - y: self - .offset - .y - - a.y, - }), - Some(&NCOffset { - x: offset.x + 100, - y: offset.y, - }), - ); - self.draw_process("a", VDirection::Down); + for node in ast { + let mut skip_dir = false; + match node { + // DepthExpr::Decision { + // cond, + // t, + // then_branch, + // else_branch, + // } => todo!(), + // DepthExpr::IO(_) => todo!(), + DepthExpr::Process(s) => { + println!("{}", s); + self.draw_process(s, VDirection::Up); + } + _ => skip_dir = true, + }; + if !skip_dir { + self.draw_direction(None, None); + } + } + // self.draw_process("abcdefghijklmnospa", VDirection::Up); + // self.draw_direction(None, None); + // self.draw_process("abc", VDirection::Up); + // self.draw_direction(None, None); + // self.draw_process("a", VDirection::Up); + // let offset = self.offset; + // self.draw_direction(None, None); + // self.draw_process("a", VDirection::Up); + // self.draw_direction(None, None); + // let a = self.draw_process("a", VDirection::Up); + // self.draw_direction( + // Some(&NCOffset { + // x: self + // .offset + // .center, + // y: self + // .offset + // .y + // - a.y, + // }), + // Some(&NCOffset { + // x: offset.x + 100, + // y: offset.y, + // }), + // ); + // self.draw_process("a", VDirection::Down); } } |
