mirror of https://codeberg.org/topola/topola.git
geometry: move geometry module to from layout to root
As we'll be creating a deeper hierarchy of modules subordinate to layout, we need to keep the module full paths short to prevent tem from growing uncontrollably.
This commit is contained in:
parent
bbc89a3c94
commit
7f69ffddf9
|
|
@ -14,9 +14,9 @@ use painter::Painter;
|
||||||
use petgraph::visit::{EdgeRef, IntoEdgeReferences};
|
use petgraph::visit::{EdgeRef, IntoEdgeReferences};
|
||||||
use topola::draw::DrawException;
|
use topola::draw::DrawException;
|
||||||
use topola::dsn::design::DsnDesign;
|
use topola::dsn::design::DsnDesign;
|
||||||
|
use topola::geometry::shape::{Shape, ShapeTrait};
|
||||||
use topola::layout::connectivity::BandIndex;
|
use topola::layout::connectivity::BandIndex;
|
||||||
use topola::layout::dot::FixedDotWeight;
|
use topola::layout::dot::FixedDotWeight;
|
||||||
use topola::layout::geometry::shape::{Shape, ShapeTrait};
|
|
||||||
use topola::layout::graph::{GeometryIndex, MakePrimitive};
|
use topola::layout::graph::{GeometryIndex, MakePrimitive};
|
||||||
use topola::layout::primitive::MakeShape;
|
use topola::layout::primitive::MakeShape;
|
||||||
use topola::layout::rules::{Conditions, RulesTrait};
|
use topola::layout::rules::{Conditions, RulesTrait};
|
||||||
|
|
@ -246,7 +246,7 @@ fn main() -> Result<(), anyhow::Error> {
|
||||||
]),
|
]),
|
||||||
}));*/
|
}));*/
|
||||||
let design = DsnDesign::load_from_file("tests/data/test.dsn")?;
|
let design = DsnDesign::load_from_file("tests/data/test.dsn")?;
|
||||||
dbg!(&design);
|
//dbg!(&design);
|
||||||
let layout = design.make_layout();
|
let layout = design.make_layout();
|
||||||
let mut router = Router::new(layout);
|
let mut router = Router::new(layout);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ use geo::Point;
|
||||||
use pathfinder_canvas::{
|
use pathfinder_canvas::{
|
||||||
vec2f, ArcDirection, Canvas, CanvasRenderingContext2D, ColorU, FillRule, Path2D, RectF,
|
vec2f, ArcDirection, Canvas, CanvasRenderingContext2D, ColorU, FillRule, Path2D, RectF,
|
||||||
};
|
};
|
||||||
use topola::layout::geometry::shape::{Shape, ShapeTrait};
|
use topola::geometry::shape::{Shape, ShapeTrait};
|
||||||
|
|
||||||
pub struct Painter<'a> {
|
pub struct Painter<'a> {
|
||||||
canvas: &'a mut CanvasRenderingContext2D,
|
canvas: &'a mut CanvasRenderingContext2D,
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,10 @@ use geo::{EuclideanLength, Point};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
geometry::GetWidth,
|
||||||
layout::{
|
layout::{
|
||||||
bend::{BendIndex, LooseBendWeight},
|
bend::{BendIndex, LooseBendWeight},
|
||||||
dot::{DotIndex, FixedDotIndex, LooseDotIndex, LooseDotWeight},
|
dot::{DotIndex, FixedDotIndex, LooseDotIndex, LooseDotWeight},
|
||||||
geometry::GetWidth,
|
|
||||||
graph::{GetBandIndex, MakePrimitive},
|
graph::{GetBandIndex, MakePrimitive},
|
||||||
guide::{Guide, Head, HeadTrait, SegbendHead},
|
guide::{Guide, Head, HeadTrait, SegbendHead},
|
||||||
primitive::GetOtherJoint,
|
primitive::GetOtherJoint,
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,7 @@ impl<'de> Deserializer<'de> {
|
||||||
if string.len() > 0 {
|
if string.len() > 0 {
|
||||||
return Ok(string);
|
return Ok(string);
|
||||||
} else {
|
} else {
|
||||||
dbg!(self.line, self.column);
|
//dbg!(self.line, self.column);
|
||||||
return Err(Error::ExpectedUnquoted);
|
return Err(Error::ExpectedUnquoted);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -179,10 +179,10 @@ where
|
||||||
{
|
{
|
||||||
let mut deserializer = Deserializer::from_str(input);
|
let mut deserializer = Deserializer::from_str(input);
|
||||||
let t = T::deserialize(&mut deserializer)?;
|
let t = T::deserialize(&mut deserializer)?;
|
||||||
if !deserializer.input.is_empty() {
|
/*if !deserializer.input.is_empty() {
|
||||||
println!("remaining input");
|
println!("remaining input");
|
||||||
dbg!(deserializer.input);
|
dbg!(deserializer.input);
|
||||||
}
|
}*/
|
||||||
Ok(t)
|
Ok(t)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,15 @@ use petgraph::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
geometry::shape::{BendShape, DotShape, SegShape, Shape},
|
||||||
graph::{GenericIndex, GetNodeIndex},
|
graph::{GenericIndex, GetNodeIndex},
|
||||||
layout::{
|
layout::{
|
||||||
bend::{BendWeight, FixedBendWeight, LooseBendWeight},
|
bend::{BendWeight, FixedBendWeight, LooseBendWeight},
|
||||||
dot::{DotWeight, FixedDotWeight, LooseDotWeight},
|
dot::{DotWeight, FixedDotWeight, LooseDotWeight},
|
||||||
geometry::shape::{BendShape, DotShape, SegShape, Shape},
|
|
||||||
graph::{GeometryWeight, Retag},
|
graph::{GeometryWeight, Retag},
|
||||||
|
primitive::Primitive,
|
||||||
|
rules::RulesTrait,
|
||||||
|
seg::{FixedSegWeight, LoneLooseSegWeight, SegWeight, SeqLooseSegWeight},
|
||||||
},
|
},
|
||||||
math::Circle,
|
math::Circle,
|
||||||
};
|
};
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
|
geometry::{shape::ShapeTrait, GetWidth},
|
||||||
graph::GetNodeIndex,
|
graph::GetNodeIndex,
|
||||||
layout::{
|
layout::{
|
||||||
connectivity::{BandIndex, BandWeight, ConnectivityWeight, GetNet},
|
connectivity::{BandIndex, BandWeight, ConnectivityWeight, GetNet},
|
||||||
dot::{DotIndex, FixedDotIndex},
|
dot::{DotIndex, FixedDotIndex},
|
||||||
geometry::shape::ShapeTrait,
|
|
||||||
graph::{GeometryIndex, MakePrimitive},
|
graph::{GeometryIndex, MakePrimitive},
|
||||||
loose::{GetNextLoose, LooseIndex},
|
loose::{GetNextLoose, LooseIndex},
|
||||||
primitive::{GetJoints, GetOtherJoint, MakeShape},
|
primitive::{GetJoints, GetOtherJoint, MakeShape},
|
||||||
|
|
@ -11,7 +11,7 @@ use crate::{
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{geometry::GetWidth, rules::RulesTrait};
|
use super::rules::RulesTrait;
|
||||||
|
|
||||||
pub struct Band<'a, R: RulesTrait> {
|
pub struct Band<'a, R: RulesTrait> {
|
||||||
pub index: BandIndex,
|
pub index: BandIndex,
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
use enum_dispatch::enum_dispatch;
|
use enum_dispatch::enum_dispatch;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
geometry::{BendWeightTrait, GetOffset, GetWidth, SetOffset},
|
||||||
graph::{GenericIndex, GetNodeIndex},
|
graph::{GenericIndex, GetNodeIndex},
|
||||||
layout::{
|
layout::{
|
||||||
connectivity::{BandIndex, ContinentIndex},
|
connectivity::{BandIndex, ContinentIndex},
|
||||||
geometry::{BendWeightTrait, GetOffset, GetWidth},
|
|
||||||
graph::{
|
graph::{
|
||||||
GeometryIndex, GeometryWeight, GetBandIndex, GetContinentIndex, GetContinentIndexMut,
|
GeometryIndex, GeometryWeight, GetBandIndex, GetContinentIndex, GetContinentIndexMut,
|
||||||
MakePrimitive, Retag,
|
MakePrimitive, Retag,
|
||||||
|
|
@ -17,8 +17,6 @@ use crate::{
|
||||||
|
|
||||||
use petgraph::stable_graph::NodeIndex;
|
use petgraph::stable_graph::NodeIndex;
|
||||||
|
|
||||||
use super::geometry::SetOffset;
|
|
||||||
|
|
||||||
#[enum_dispatch(GetNodeIndex, MakePrimitive)]
|
#[enum_dispatch(GetNodeIndex, MakePrimitive)]
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||||
pub enum BendIndex {
|
pub enum BendIndex {
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,10 @@ use geo::Point;
|
||||||
use petgraph::stable_graph::NodeIndex;
|
use petgraph::stable_graph::NodeIndex;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
geometry::{DotWeightTrait, GetPos, GetWidth, SetPos},
|
||||||
graph::{GenericIndex, GetNodeIndex},
|
graph::{GenericIndex, GetNodeIndex},
|
||||||
layout::{
|
layout::{
|
||||||
connectivity::{BandIndex, ContinentIndex},
|
connectivity::{BandIndex, ContinentIndex},
|
||||||
geometry::{DotWeightTrait, GetPos, GetWidth},
|
|
||||||
graph::{
|
graph::{
|
||||||
GeometryIndex, GeometryWeight, GetBandIndex, GetContinentIndex, GetContinentIndexMut,
|
GeometryIndex, GeometryWeight, GetBandIndex, GetContinentIndex, GetContinentIndexMut,
|
||||||
MakePrimitive, Retag,
|
MakePrimitive, Retag,
|
||||||
|
|
@ -19,8 +19,6 @@ use crate::{
|
||||||
math::Circle,
|
math::Circle,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::geometry::SetPos;
|
|
||||||
|
|
||||||
#[enum_dispatch(GetNodeIndex, MakePrimitive)]
|
#[enum_dispatch(GetNodeIndex, MakePrimitive)]
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||||
pub enum DotIndex {
|
pub enum DotIndex {
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,11 @@ use enum_dispatch::enum_dispatch;
|
||||||
use geo::Line;
|
use geo::Line;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
geometry::shape::{Shape, ShapeTrait},
|
||||||
layout::{
|
layout::{
|
||||||
bend::BendIndex,
|
bend::BendIndex,
|
||||||
connectivity::BandIndex,
|
connectivity::BandIndex,
|
||||||
dot::{DotIndex, FixedDotIndex, LooseDotIndex},
|
dot::{DotIndex, FixedDotIndex, LooseDotIndex},
|
||||||
geometry::shape::{Shape, ShapeTrait},
|
|
||||||
graph::{GetBandIndex, MakePrimitive},
|
graph::{GetBandIndex, MakePrimitive},
|
||||||
primitive::{GetCore, GetInnerOuter, GetOtherJoint, GetWeight, MakeShape},
|
primitive::{GetCore, GetInnerOuter, GetOtherJoint, GetWeight, MakeShape},
|
||||||
rules::GetConditions,
|
rules::GetConditions,
|
||||||
|
|
|
||||||
|
|
@ -11,25 +11,25 @@ use super::connectivity::{
|
||||||
BandIndex, BandWeight, ConnectivityGraph, ConnectivityLabel, ConnectivityWeight,
|
BandIndex, BandWeight, ConnectivityGraph, ConnectivityLabel, ConnectivityWeight,
|
||||||
ContinentIndex, ContinentWeight, GetNet,
|
ContinentIndex, ContinentWeight, GetNet,
|
||||||
};
|
};
|
||||||
use super::geometry::with_rtree::GeometryWithRtree;
|
|
||||||
use super::loose::{GetNextLoose, Loose, LooseIndex};
|
use super::loose::{GetNextLoose, Loose, LooseIndex};
|
||||||
use super::rules::RulesTrait;
|
use super::rules::RulesTrait;
|
||||||
use super::segbend::Segbend;
|
use super::segbend::Segbend;
|
||||||
|
use crate::geometry::{
|
||||||
|
shape::{Shape, ShapeTrait},
|
||||||
|
with_rtree::GeometryWithRtree,
|
||||||
|
BendWeightTrait, DotWeightTrait, Geometry, GeometryLabel, GetOffset, GetPos, GetWidth,
|
||||||
|
SegWeightTrait,
|
||||||
|
};
|
||||||
use crate::graph::{GenericIndex, GetNodeIndex};
|
use crate::graph::{GenericIndex, GetNodeIndex};
|
||||||
use crate::layout::bend::BendIndex;
|
use crate::layout::bend::BendIndex;
|
||||||
use crate::layout::collect::Collect;
|
use crate::layout::collect::Collect;
|
||||||
use crate::layout::dot::DotWeight;
|
use crate::layout::dot::DotWeight;
|
||||||
use crate::layout::geometry::{
|
|
||||||
BendWeightTrait, DotWeightTrait, Geometry, GeometryLabel, GetOffset, GetPos, GetWidth,
|
|
||||||
SegWeightTrait,
|
|
||||||
};
|
|
||||||
use crate::layout::guide::Guide;
|
use crate::layout::guide::Guide;
|
||||||
use crate::layout::primitive::GetLimbs;
|
use crate::layout::primitive::GetLimbs;
|
||||||
use crate::layout::rules::GetConditions;
|
use crate::layout::rules::GetConditions;
|
||||||
use crate::layout::{
|
use crate::layout::{
|
||||||
bend::{FixedBendIndex, LooseBendIndex, LooseBendWeight},
|
bend::{FixedBendIndex, LooseBendIndex, LooseBendWeight},
|
||||||
dot::{DotIndex, FixedDotIndex, FixedDotWeight, LooseDotIndex, LooseDotWeight},
|
dot::{DotIndex, FixedDotIndex, FixedDotWeight, LooseDotIndex, LooseDotWeight},
|
||||||
geometry::shape::{Shape, ShapeTrait},
|
|
||||||
graph::{GeometryIndex, GeometryWeight, GetContinentIndex, MakePrimitive},
|
graph::{GeometryIndex, GeometryWeight, GetContinentIndex, MakePrimitive},
|
||||||
primitive::{GenericPrimitive, GetCore, GetInnerOuter, GetJoints, GetOtherJoint, MakeShape},
|
primitive::{GenericPrimitive, GetCore, GetInnerOuter, GetJoints, GetOtherJoint, MakeShape},
|
||||||
seg::{
|
seg::{
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ pub mod bend;
|
||||||
pub mod collect;
|
pub mod collect;
|
||||||
pub mod connectivity;
|
pub mod connectivity;
|
||||||
pub mod dot;
|
pub mod dot;
|
||||||
pub mod geometry;
|
|
||||||
pub mod guide;
|
pub mod guide;
|
||||||
mod layout;
|
mod layout;
|
||||||
pub mod loose;
|
pub mod loose;
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,21 @@
|
||||||
use enum_dispatch::enum_dispatch;
|
use enum_dispatch::enum_dispatch;
|
||||||
use petgraph::stable_graph::NodeIndex;
|
use petgraph::stable_graph::NodeIndex;
|
||||||
|
|
||||||
|
use crate::geometry::{
|
||||||
|
shape::{Shape, ShapeTrait},
|
||||||
|
GetOffset, GetWidth,
|
||||||
|
};
|
||||||
use crate::graph::{GenericIndex, GetNodeIndex};
|
use crate::graph::{GenericIndex, GetNodeIndex};
|
||||||
use crate::layout::dot::DotWeight;
|
use crate::layout::dot::DotWeight;
|
||||||
use crate::layout::seg::{
|
use crate::layout::seg::{
|
||||||
FixedSegWeight, LoneLooseSegIndex, LoneLooseSegWeight, SegIndex, SeqLooseSegIndex,
|
FixedSegWeight, LoneLooseSegIndex, LoneLooseSegWeight, SegIndex, SeqLooseSegIndex,
|
||||||
SeqLooseSegWeight,
|
SeqLooseSegWeight,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::layout::{
|
use crate::layout::{
|
||||||
bend::{BendIndex, FixedBendWeight, LooseBendIndex, LooseBendWeight},
|
bend::{BendIndex, FixedBendWeight, LooseBendIndex, LooseBendWeight},
|
||||||
connectivity::{BandIndex, ContinentIndex, GetNet},
|
connectivity::{BandIndex, ContinentIndex, GetNet},
|
||||||
dot::{DotIndex, FixedDotIndex, FixedDotWeight, LooseDotIndex, LooseDotWeight},
|
dot::{DotIndex, FixedDotIndex, FixedDotWeight, LooseDotIndex, LooseDotWeight},
|
||||||
geometry::{
|
|
||||||
shape::{Shape, ShapeTrait},
|
|
||||||
GetOffset, GetWidth,
|
|
||||||
},
|
|
||||||
graph::{GeometryIndex, GeometryWeight, GetBandIndex, GetContinentIndex, Retag},
|
graph::{GeometryIndex, GeometryWeight, GetBandIndex, GetContinentIndex, Retag},
|
||||||
loose::LooseIndex,
|
loose::LooseIndex,
|
||||||
Layout,
|
Layout,
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
use enum_dispatch::enum_dispatch;
|
use enum_dispatch::enum_dispatch;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
geometry::{GetWidth, SegWeightTrait},
|
||||||
graph::{GenericIndex, GetNodeIndex},
|
graph::{GenericIndex, GetNodeIndex},
|
||||||
layout::{
|
layout::{
|
||||||
connectivity::{BandIndex, ContinentIndex},
|
connectivity::{BandIndex, ContinentIndex},
|
||||||
geometry::{GetWidth, SegWeightTrait},
|
|
||||||
graph::{
|
graph::{
|
||||||
GeometryIndex, GeometryWeight, GetBandIndex, GetContinentIndex, GetContinentIndexMut,
|
GeometryIndex, GeometryWeight, GetBandIndex, GetContinentIndex, GetContinentIndexMut,
|
||||||
MakePrimitive, Retag,
|
MakePrimitive, Retag,
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ pub mod graph;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
pub mod layout;
|
pub mod layout;
|
||||||
pub mod dsn;
|
pub mod dsn;
|
||||||
|
pub mod geometry;
|
||||||
pub mod math;
|
pub mod math;
|
||||||
pub mod mesh;
|
pub mod mesh;
|
||||||
pub mod router;
|
pub mod router;
|
||||||
|
|
|
||||||
|
|
@ -10,14 +10,14 @@ use spade::{HasPosition, InsertionError, Point2};
|
||||||
use crate::layout::rules::RulesTrait;
|
use crate::layout::rules::RulesTrait;
|
||||||
use crate::triangulation::TriangulationEdgeReference;
|
use crate::triangulation::TriangulationEdgeReference;
|
||||||
use crate::{
|
use crate::{
|
||||||
|
geometry::shape::ShapeTrait,
|
||||||
graph::GetNodeIndex,
|
graph::GetNodeIndex,
|
||||||
layout::Layout,
|
|
||||||
layout::{
|
layout::{
|
||||||
bend::{FixedBendIndex, LooseBendIndex},
|
bend::{FixedBendIndex, LooseBendIndex},
|
||||||
dot::FixedDotIndex,
|
dot::FixedDotIndex,
|
||||||
geometry::shape::ShapeTrait,
|
|
||||||
graph::{GeometryIndex, MakePrimitive},
|
graph::{GeometryIndex, MakePrimitive},
|
||||||
primitive::{GetCore, MakeShape, Primitive},
|
primitive::{GetCore, MakeShape, Primitive},
|
||||||
|
Layout,
|
||||||
},
|
},
|
||||||
triangulation::{GetVertexIndex, Triangulation},
|
triangulation::{GetVertexIndex, Triangulation},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -6,14 +6,13 @@ use thiserror::Error;
|
||||||
|
|
||||||
use crate::astar::{astar, AstarStrategy, PathTracker};
|
use crate::astar::{astar, AstarStrategy, PathTracker};
|
||||||
use crate::draw::DrawException;
|
use crate::draw::DrawException;
|
||||||
use crate::layout::geometry::GetWidth;
|
use crate::geometry::{shape::ShapeTrait, GetWidth};
|
||||||
use crate::layout::guide::HeadTrait;
|
use crate::layout::guide::HeadTrait;
|
||||||
use crate::layout::rules::RulesTrait;
|
use crate::layout::rules::RulesTrait;
|
||||||
use crate::layout::Layout;
|
use crate::layout::Layout;
|
||||||
use crate::layout::{
|
use crate::layout::{
|
||||||
connectivity::BandIndex,
|
connectivity::BandIndex,
|
||||||
dot::FixedDotIndex,
|
dot::FixedDotIndex,
|
||||||
geometry::shape::ShapeTrait,
|
|
||||||
graph::{GeometryIndex, MakePrimitive},
|
graph::{GeometryIndex, MakePrimitive},
|
||||||
primitive::MakeShape,
|
primitive::MakeShape,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue