Add PathFinder trait
This commit is contained in:
parent
5c8010c23b
commit
08eb0a8e11
8 changed files with 688 additions and 373 deletions
|
|
@ -67,12 +67,6 @@ impl std::ops::Sub for Position {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<(i32, i32)> for Position {
|
||||
fn from(value: (i32, i32)) -> Self {
|
||||
Position::new(value.0, value.1)
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::Mul<i32> for Position {
|
||||
type Output = Position;
|
||||
|
||||
|
|
@ -91,3 +85,9 @@ impl std::ops::Mul<Position> for i32 {
|
|||
rhs
|
||||
}
|
||||
}
|
||||
|
||||
impl From<(PositionType, PositionType)> for Position {
|
||||
fn from(value: (PositionType, PositionType)) -> Self {
|
||||
Self::new(value.0, value.1)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ pub trait Visualize {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub enum Symbol {
|
||||
Arrow(Direction),
|
||||
ArrowEnter(Direction),
|
||||
|
|
@ -131,6 +132,16 @@ impl Visualization {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn overlay_visualization(&mut self, other: &Self) {
|
||||
self.size = Position::new(
|
||||
PositionType::max(self.size.x, other.size.x),
|
||||
PositionType::max(self.size.y, other.size.y),
|
||||
);
|
||||
|
||||
self.symbols
|
||||
.extend(other.symbols.iter().map(|(&k, &v)| (k, v)));
|
||||
}
|
||||
|
||||
pub fn size(&self) -> Position {
|
||||
self.size
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue