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