Add Visualize to LayoutResult
This commit is contained in:
		
							parent
							
								
									ec869d4c18
								
							
						
					
					
						commit
						c472a28591
					
				
					 5 changed files with 73 additions and 35 deletions
				
			
		|  | @ -1,7 +1,7 @@ | |||
| mod image; | ||||
| mod print; | ||||
| 
 | ||||
| use crate::prelude::*; | ||||
| use crate::{pathfield::PathField, prelude::*}; | ||||
| use ::image::RgbaImage; | ||||
| pub use image::image_grid; | ||||
| use std::collections::HashMap; | ||||
|  | @ -124,6 +124,25 @@ impl Visualization { | |||
|         } | ||||
|     } | ||||
| 
 | ||||
|     pub fn add_path(&mut self, path: &[PathField], fg: Option<Color>, bg: Option<Color>) { | ||||
|         for p in path { | ||||
|             match p { | ||||
|                 PathField::Belt { pos, dir } => { | ||||
|                     self.add_symbol(*pos, Symbol::Arrow(*dir), fg, bg); | ||||
|                 } | ||||
|                 PathField::Underground { pos, dir, len } => { | ||||
|                     self.add_symbol(*pos, Symbol::ArrowEnter(*dir), fg, None); | ||||
|                     self.add_symbol( | ||||
|                         pos.in_direction(dir, *len as i32), | ||||
|                         Symbol::ArrowExit(*dir), | ||||
|                         fg, | ||||
|                         bg, | ||||
|                     ); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     pub fn overwrite_background(&mut self, pos: Position, bg: Option<Color>) { | ||||
|         if let Some(s) = self.symbols.get_mut(&pos) { | ||||
|             s.2 = bg; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue