diff --git a/src/drawing/collect.rs b/src/drawing/collect.rs index 66eda63..14e8da0 100644 --- a/src/drawing/collect.rs +++ b/src/drawing/collect.rs @@ -1,10 +1,9 @@ -use crate::wraparoundable::{GetWraparound, WraparoundableIndex}; - -use super::{ +use crate::drawing::{ bend::LooseBendIndex, graph::PrimitiveIndex, primitive::{GetInnerOuter, GetJoints}, rules::RulesTrait, + wraparoundable::{GetWraparound, WraparoundableIndex}, Drawing, }; diff --git a/src/drawing/drawing.rs b/src/drawing/drawing.rs index 7d7026e..ba1a533 100644 --- a/src/drawing/drawing.rs +++ b/src/drawing/drawing.rs @@ -16,6 +16,7 @@ use crate::drawing::graph::GetMaybeNet; use crate::drawing::guide::Guide; use crate::drawing::primitive::GetLimbs; use crate::drawing::rules::GetConditions; +use crate::drawing::wraparoundable::{GetWraparound, Wraparoundable, WraparoundableIndex}; use crate::drawing::{ bend::{FixedBendIndex, LooseBendIndex, LooseBendWeight}, dot::{DotIndex, FixedDotIndex, FixedDotWeight, LooseDotIndex, LooseDotWeight}, @@ -38,7 +39,6 @@ use crate::geometry::{ use crate::graph::{GenericIndex, GetNodeIndex}; use crate::layout::zone::{ZoneIndex, ZoneWeight}; use crate::math::NoTangents; -use crate::wraparoundable::{GetWraparound, Wraparoundable, WraparoundableIndex}; use super::bend::BendWeight; use super::seg::SegWeight; diff --git a/src/drawing/mod.rs b/src/drawing/mod.rs index ddd431b..e464598 100644 --- a/src/drawing/mod.rs +++ b/src/drawing/mod.rs @@ -10,5 +10,6 @@ pub mod primitive; pub mod rules; pub mod seg; pub mod segbend; +pub mod wraparoundable; pub use drawing::*; diff --git a/src/wraparoundable.rs b/src/drawing/wraparoundable.rs similarity index 100% rename from src/wraparoundable.rs rename to src/drawing/wraparoundable.rs diff --git a/src/layout/layout.rs b/src/layout/layout.rs index 99105d0..d6d960f 100644 --- a/src/layout/layout.rs +++ b/src/layout/layout.rs @@ -13,6 +13,7 @@ use crate::{ SeqLooseSegWeight, }, segbend::Segbend, + wraparoundable::WraparoundableIndex, Drawing, Infringement, LayoutException, }, geometry::{ @@ -26,7 +27,6 @@ use crate::{ }, zone::{PourZoneIndex, SolidZoneIndex, ZoneIndex, ZoneWeight}, }, - wraparoundable::WraparoundableIndex, }; pub struct Layout { diff --git a/src/lib.rs b/src/lib.rs index b16f3c3..bcde884 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,7 +1,5 @@ #![feature(try_blocks)] -pub mod astar; -pub mod draw; pub mod graph; #[macro_use] pub mod drawing; @@ -9,8 +7,4 @@ pub mod dsn; pub mod geometry; pub mod layout; pub mod math; -pub mod mesh; pub mod router; -pub mod tracer; -pub mod triangulation; -pub mod wraparoundable; diff --git a/src/astar.rs b/src/router/astar.rs similarity index 100% rename from src/astar.rs rename to src/router/astar.rs diff --git a/src/draw.rs b/src/router/draw.rs similarity index 99% rename from src/draw.rs rename to src/router/draw.rs index 93d50d9..744cb31 100644 --- a/src/draw.rs +++ b/src/router/draw.rs @@ -11,11 +11,11 @@ use crate::{ primitive::GetOtherJoint, rules::RulesTrait, seg::{LoneLooseSegWeight, SeqLooseSegWeight}, + wraparoundable::WraparoundableIndex, Infringement, LayoutException, }, layout::Layout, math::{Circle, NoTangents}, - wraparoundable::WraparoundableIndex, }; #[derive(Error, Debug, Clone, Copy)] diff --git a/src/mesh.rs b/src/router/mesh.rs similarity index 98% rename from src/mesh.rs rename to src/router/mesh.rs index 5487ef8..cbe52ff 100644 --- a/src/mesh.rs +++ b/src/router/mesh.rs @@ -8,7 +8,6 @@ use petgraph::{stable_graph::NodeIndex, visit::EdgeRef}; use spade::{HasPosition, InsertionError, Point2}; use crate::drawing::rules::RulesTrait; -use crate::triangulation::TriangulationEdgeReference; use crate::{ drawing::{ bend::{FixedBendIndex, LooseBendIndex}, @@ -19,7 +18,7 @@ use crate::{ }, geometry::primitive::PrimitiveShapeTrait, graph::GetNodeIndex, - triangulation::{GetVertexIndex, Triangulation}, + router::triangulation::{GetVertexIndex, Triangulation, TriangulationEdgeReference}, }; #[enum_dispatch(GetNodeIndex, MakePrimitive)] diff --git a/src/router/mod.rs b/src/router/mod.rs new file mode 100644 index 0000000..3efa300 --- /dev/null +++ b/src/router/mod.rs @@ -0,0 +1,8 @@ +pub mod astar; +pub mod draw; +pub mod mesh; +mod router; +pub mod tracer; +pub mod triangulation; + +pub use router::*; diff --git a/src/router.rs b/src/router/router.rs similarity index 96% rename from src/router.rs rename to src/router/router.rs index 58bc509..d5b1265 100644 --- a/src/router.rs +++ b/src/router/router.rs @@ -4,8 +4,6 @@ use petgraph::visit::EdgeRef; use spade::InsertionError; use thiserror::Error; -use crate::astar::{astar, AstarStrategy, PathTracker}; -use crate::draw::DrawException; use crate::drawing::{ dot::FixedDotIndex, graph::{MakePrimitive, PrimitiveIndex}, @@ -16,9 +14,12 @@ use crate::geometry::primitive::PrimitiveShapeTrait; use crate::layout::connectivity::BandIndex; use crate::layout::Layout; -use crate::mesh::{Mesh, MeshEdgeReference, VertexIndex}; - -use crate::tracer::{Trace, Tracer}; +use crate::router::{ + astar::{astar, AstarStrategy, PathTracker}, + draw::DrawException, + mesh::{Mesh, MeshEdgeReference, VertexIndex}, + tracer::{Trace, Tracer}, +}; #[derive(Error, Debug, Clone, Copy)] #[error("failed to route from {from:?} to {to:?}")] // this should eventually use Display diff --git a/src/tracer.rs b/src/router/tracer.rs similarity index 96% rename from src/tracer.rs rename to src/router/tracer.rs index bb6ae9b..778bd00 100644 --- a/src/tracer.rs +++ b/src/router/tracer.rs @@ -1,16 +1,17 @@ use contracts::debug_ensures; use crate::{ - draw::{Draw, DrawException}, drawing::{ bend::LooseBendIndex, dot::FixedDotIndex, - graph::{GetMaybeNet, MakePrimitive}, - guide::{BareHead, Head, HeadTrait, SegbendHead}, + guide::{BareHead, Head, SegbendHead}, rules::RulesTrait, }, layout::{connectivity::BandIndex, Layout}, - mesh::{Mesh, VertexIndex}, + router::{ + draw::{Draw, DrawException}, + mesh::{Mesh, VertexIndex}, + }, }; #[derive(Debug)] diff --git a/src/triangulation.rs b/src/router/triangulation.rs similarity index 100% rename from src/triangulation.rs rename to src/router/triangulation.rs