invoker: added trait description

This commit is contained in:
hakki 2024-11-10 19:23:55 +01:00 committed by mikolaj
parent 7a01a76738
commit 63804a0297
4 changed files with 40 additions and 5 deletions

View File

@ -28,28 +28,41 @@ use super::{
#[enum_dispatch]
/// Getter trait to obtain Navigation Mesh
///
/// Navigation Mesh is possible routes between
/// two points
pub trait GetMaybeNavmesh {
/// Returns navigation mesh if possible
/// Returns Navigation Mesh if possible
fn maybe_navmesh(&self) -> Option<&Navmesh>;
}
#[enum_dispatch]
/// TODO: Trait to require Navigation Cord implementation details
/// Getter for Navigation Cord
///
/// Navigation Cord is the possible path of
/// ongoing autorouting process
pub trait GetMaybeNavcord {
/// Gets the Navigation Cord if possible
fn maybe_navcord(&self) -> Option<&NavcordStepper>;
}
#[enum_dispatch]
/// TODO: Requires Ghosts implementations
/// Requires Ghosts implementations
///
/// Ghosts are possible shapes of routing
/// bands
pub trait GetGhosts {
/// Retrieves the ghosts associated with the execution.
fn ghosts(&self) -> &[PrimitiveShape];
}
#[enum_dispatch]
/// TODO: Defines Obstacles getter implementation
/// Getter for the Obstacles
///
/// Obstacles are shapes of existing bands
/// to be avoided by the new band
pub trait GetObstacles {
/// Returns possible obstacles
/// Returns possible Obstacles
fn obstacles(&self) -> &[PrimitiveIndex];
}

View File

@ -10,9 +10,13 @@ use crate::drawing::{
use super::rules::AccessRules;
#[derive(Debug, Clone, Copy)]
/// Geometrical structure to define Navigation Cord Head
pub struct Cane {
/// Loose segment of the Cane
pub seg: SeqLooseSegIndex,
/// Loose dot of the Cane structure
pub dot: LooseDotIndex,
/// Bend of the Cane
pub bend: LooseBendIndex,
}

View File

@ -17,6 +17,11 @@ pub trait GetFace {
#[enum_dispatch(GetFace)]
#[derive(Debug, Clone, Copy)]
/// Defines possible Head objects
///
/// Head is the working end of routed band, which can be
/// either Bare when nothing has been routed yet, or Cane
/// when routed process has been started
pub enum Head {
Bare(BareHead),
Cane(CaneHead),
@ -29,7 +34,9 @@ impl<'a, CW: Copy, R: AccessRules> MakeRef<'a, HeadRef<'a, CW, R>, Drawing<CW, R
}
#[derive(Debug, Clone, Copy)]
/// Defines not started Head
pub struct BareHead {
/// Describes face of not started Head
pub face: FixedDotIndex,
}
@ -40,8 +47,11 @@ impl GetFace for BareHead {
}
#[derive(Debug, Clone, Copy)]
/// Defines Head during routing process
pub struct CaneHead {
/// Describes face of not started Head
pub face: LooseDotIndex,
/// Last cane followed on the unfinished end
pub cane: Cane,
}

View File

@ -16,13 +16,21 @@ use super::{
};
#[derive(Debug)]
/// Structure containing information about Navigation Cord Stepper
///
/// Navigation Cord is a one of chosen possible ways to connect
/// both Navigation Vertex
pub struct NavcordStepper {
/// Path of the current Navigation Cord
pub path: Vec<NavvertexIndex>,
/// Type of Navigaction Cord head
pub head: Head,
/// Width of the cord
pub width: f64,
}
impl NavcordStepper {
/// Create new Navigation Cord instance
pub fn new(
source: FixedDotIndex,
source_navvertex: NavvertexIndex,