mirror of https://codeberg.org/topola/topola.git
router: get rid of unnecessary RouterError
This commit is contained in:
parent
01deaa4b12
commit
d0058ef5fd
|
|
@ -7,7 +7,7 @@ use crate::{
|
||||||
board::{mesadata::AccessMesadata, Board},
|
board::{mesadata::AccessMesadata, Board},
|
||||||
drawing::{band::BandTermsegIndex, dot::FixedDotIndex, Infringement},
|
drawing::{band::BandTermsegIndex, dot::FixedDotIndex, Infringement},
|
||||||
layout::via::ViaWeight,
|
layout::via::ViaWeight,
|
||||||
router::{navmesh::NavmeshError, RouterError, RouterOptions},
|
router::{astar::AstarError, navmesh::NavmeshError, RouterOptions},
|
||||||
triangulation::GetTrianvertexNodeIndex,
|
triangulation::GetTrianvertexNodeIndex,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -33,8 +33,8 @@ pub enum AutorouterError {
|
||||||
NothingToRoute,
|
NothingToRoute,
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
Navmesh(#[from] NavmeshError),
|
Navmesh(#[from] NavmeshError),
|
||||||
#[error(transparent)]
|
#[error("routing failed: {0}")]
|
||||||
Router(#[from] RouterError),
|
Astar(#[from] AstarError),
|
||||||
#[error("could not place via")]
|
#[error("could not place via")]
|
||||||
CouldNotPlaceVia(#[from] Infringement),
|
CouldNotPlaceVia(#[from] Infringement),
|
||||||
#[error("could not remove band")]
|
#[error("could not remove band")]
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,11 @@ use crate::{
|
||||||
},
|
},
|
||||||
geometry::primitive::PrimitiveShape,
|
geometry::primitive::PrimitiveShape,
|
||||||
router::{
|
router::{
|
||||||
astar::{Astar, AstarStatus},
|
astar::{Astar, AstarError, AstarStatus},
|
||||||
navmesh::Navmesh,
|
navmesh::{Navmesh, NavmeshError},
|
||||||
trace::TraceStepper,
|
trace::TraceStepper,
|
||||||
tracer::Tracer,
|
tracer::Tracer,
|
||||||
Router, RouterAstarStrategy, RouterError, RouterStatus,
|
Router, RouterAstarStrategy, RouterStatus,
|
||||||
},
|
},
|
||||||
stepper::Step,
|
stepper::Step,
|
||||||
};
|
};
|
||||||
|
|
@ -26,7 +26,7 @@ impl RouteStepper {
|
||||||
from: FixedDotIndex,
|
from: FixedDotIndex,
|
||||||
to: FixedDotIndex,
|
to: FixedDotIndex,
|
||||||
width: f64,
|
width: f64,
|
||||||
) -> Result<Self, RouterError> {
|
) -> Result<Self, NavmeshError> {
|
||||||
let navmesh = Navmesh::new(router.layout(), from, to, router.options())?;
|
let navmesh = Navmesh::new(router.layout(), from, to, router.options())?;
|
||||||
Ok(Self::new_from_navmesh(router, navmesh, width))
|
Ok(Self::new_from_navmesh(router, navmesh, width))
|
||||||
}
|
}
|
||||||
|
|
@ -73,10 +73,10 @@ impl RouteStepper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, R: AccessRules> Step<Router<'a, R>, RouterStatus, RouterError, BandTermsegIndex>
|
impl<'a, R: AccessRules> Step<Router<'a, R>, RouterStatus, AstarError, BandTermsegIndex>
|
||||||
for RouteStepper
|
for RouteStepper
|
||||||
{
|
{
|
||||||
fn step(&mut self, router: &mut Router<R>) -> Result<RouterStatus, RouterError> {
|
fn step(&mut self, router: &mut Router<R>) -> Result<RouterStatus, AstarError> {
|
||||||
let tracer = Tracer::new(router.layout_mut());
|
let tracer = Tracer::new(router.layout_mut());
|
||||||
let target = self.astar.graph.destination();
|
let target = self.astar.graph.destination();
|
||||||
let mut strategy = RouterAstarStrategy::new(tracer, &mut self.trace, target);
|
let mut strategy = RouterAstarStrategy::new(tracer, &mut self.trace, target);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
use geo::EuclideanDistance;
|
use geo::EuclideanDistance;
|
||||||
use petgraph::{data::DataMap, visit::EdgeRef};
|
use petgraph::{data::DataMap, visit::EdgeRef};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use thiserror::Error;
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
drawing::{
|
drawing::{
|
||||||
|
|
@ -22,7 +21,7 @@ use crate::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
astar::{AstarError, AstarStrategy, PathTracker},
|
astar::{AstarStrategy, PathTracker},
|
||||||
draw::DrawException,
|
draw::DrawException,
|
||||||
navmesh::{Navmesh, NavmeshEdgeReference, NavmeshError, NavvertexIndex},
|
navmesh::{Navmesh, NavmeshEdgeReference, NavmeshError, NavvertexIndex},
|
||||||
route::RouteStepper,
|
route::RouteStepper,
|
||||||
|
|
@ -36,13 +35,6 @@ pub struct RouterOptions {
|
||||||
pub squeeze_through_under_bands: bool,
|
pub squeeze_through_under_bands: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Error, Debug, Clone)]
|
|
||||||
#[error("routing failed")]
|
|
||||||
pub enum RouterError {
|
|
||||||
Navmesh(#[from] NavmeshError),
|
|
||||||
Astar(#[from] AstarError),
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum RouterStatus {
|
pub enum RouterStatus {
|
||||||
Running,
|
Running,
|
||||||
|
|
@ -199,7 +191,7 @@ impl<'a, R: AccessRules> Router<'a, R> {
|
||||||
from: FixedDotIndex,
|
from: FixedDotIndex,
|
||||||
to: FixedDotIndex,
|
to: FixedDotIndex,
|
||||||
width: f64,
|
width: f64,
|
||||||
) -> Result<RouteStepper, RouterError> {
|
) -> Result<RouteStepper, NavmeshError> {
|
||||||
RouteStepper::new(self, from, to, width)
|
RouteStepper::new(self, from, to, width)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue