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:
Mikolaj Wielgus 2024-02-26 07:23:44 +00:00
parent bbc89a3c94
commit 7f69ffddf9
19 changed files with 32 additions and 33 deletions

View File

@ -14,9 +14,9 @@ use painter::Painter;
use petgraph::visit::{EdgeRef, IntoEdgeReferences};
use topola::draw::DrawException;
use topola::dsn::design::DsnDesign;
use topola::geometry::shape::{Shape, ShapeTrait};
use topola::layout::connectivity::BandIndex;
use topola::layout::dot::FixedDotWeight;
use topola::layout::geometry::shape::{Shape, ShapeTrait};
use topola::layout::graph::{GeometryIndex, MakePrimitive};
use topola::layout::primitive::MakeShape;
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")?;
dbg!(&design);
//dbg!(&design);
let layout = design.make_layout();
let mut router = Router::new(layout);

View File

@ -2,7 +2,7 @@ use geo::Point;
use pathfinder_canvas::{
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> {
canvas: &'a mut CanvasRenderingContext2D,

View File

@ -3,10 +3,10 @@ use geo::{EuclideanLength, Point};
use thiserror::Error;
use crate::{
geometry::GetWidth,
layout::{
bend::{BendIndex, LooseBendWeight},
dot::{DotIndex, FixedDotIndex, LooseDotIndex, LooseDotWeight},
geometry::GetWidth,
graph::{GetBandIndex, MakePrimitive},
guide::{Guide, Head, HeadTrait, SegbendHead},
primitive::GetOtherJoint,

View File

@ -140,7 +140,7 @@ impl<'de> Deserializer<'de> {
if string.len() > 0 {
return Ok(string);
} else {
dbg!(self.line, self.column);
//dbg!(self.line, self.column);
return Err(Error::ExpectedUnquoted);
}
}
@ -179,10 +179,10 @@ where
{
let mut deserializer = Deserializer::from_str(input);
let t = T::deserialize(&mut deserializer)?;
if !deserializer.input.is_empty() {
/*if !deserializer.input.is_empty() {
println!("remaining input");
dbg!(deserializer.input);
}
}*/
Ok(t)
}

View File

@ -9,12 +9,15 @@ use petgraph::{
};
use crate::{
geometry::shape::{BendShape, DotShape, SegShape, Shape},
graph::{GenericIndex, GetNodeIndex},
layout::{
bend::{BendWeight, FixedBendWeight, LooseBendWeight},
dot::{DotWeight, FixedDotWeight, LooseDotWeight},
geometry::shape::{BendShape, DotShape, SegShape, Shape},
graph::{GeometryWeight, Retag},
primitive::Primitive,
rules::RulesTrait,
seg::{FixedSegWeight, LoneLooseSegWeight, SegWeight, SeqLooseSegWeight},
},
math::Circle,
};

View File

@ -1,9 +1,9 @@
use crate::{
geometry::{shape::ShapeTrait, GetWidth},
graph::GetNodeIndex,
layout::{
connectivity::{BandIndex, BandWeight, ConnectivityWeight, GetNet},
dot::{DotIndex, FixedDotIndex},
geometry::shape::ShapeTrait,
graph::{GeometryIndex, MakePrimitive},
loose::{GetNextLoose, LooseIndex},
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 index: BandIndex,

View File

@ -1,10 +1,10 @@
use enum_dispatch::enum_dispatch;
use crate::{
geometry::{BendWeightTrait, GetOffset, GetWidth, SetOffset},
graph::{GenericIndex, GetNodeIndex},
layout::{
connectivity::{BandIndex, ContinentIndex},
geometry::{BendWeightTrait, GetOffset, GetWidth},
graph::{
GeometryIndex, GeometryWeight, GetBandIndex, GetContinentIndex, GetContinentIndexMut,
MakePrimitive, Retag,
@ -17,8 +17,6 @@ use crate::{
use petgraph::stable_graph::NodeIndex;
use super::geometry::SetOffset;
#[enum_dispatch(GetNodeIndex, MakePrimitive)]
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum BendIndex {

View File

@ -4,10 +4,10 @@ use geo::Point;
use petgraph::stable_graph::NodeIndex;
use crate::{
geometry::{DotWeightTrait, GetPos, GetWidth, SetPos},
graph::{GenericIndex, GetNodeIndex},
layout::{
connectivity::{BandIndex, ContinentIndex},
geometry::{DotWeightTrait, GetPos, GetWidth},
graph::{
GeometryIndex, GeometryWeight, GetBandIndex, GetContinentIndex, GetContinentIndexMut,
MakePrimitive, Retag,
@ -19,8 +19,6 @@ use crate::{
math::Circle,
};
use super::geometry::SetPos;
#[enum_dispatch(GetNodeIndex, MakePrimitive)]
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum DotIndex {

View File

@ -2,11 +2,11 @@ use enum_dispatch::enum_dispatch;
use geo::Line;
use crate::{
geometry::shape::{Shape, ShapeTrait},
layout::{
bend::BendIndex,
connectivity::BandIndex,
dot::{DotIndex, FixedDotIndex, LooseDotIndex},
geometry::shape::{Shape, ShapeTrait},
graph::{GetBandIndex, MakePrimitive},
primitive::{GetCore, GetInnerOuter, GetOtherJoint, GetWeight, MakeShape},
rules::GetConditions,

View File

@ -11,25 +11,25 @@ use super::connectivity::{
BandIndex, BandWeight, ConnectivityGraph, ConnectivityLabel, ConnectivityWeight,
ContinentIndex, ContinentWeight, GetNet,
};
use super::geometry::with_rtree::GeometryWithRtree;
use super::loose::{GetNextLoose, Loose, LooseIndex};
use super::rules::RulesTrait;
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::layout::bend::BendIndex;
use crate::layout::collect::Collect;
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::primitive::GetLimbs;
use crate::layout::rules::GetConditions;
use crate::layout::{
bend::{FixedBendIndex, LooseBendIndex, LooseBendWeight},
dot::{DotIndex, FixedDotIndex, FixedDotWeight, LooseDotIndex, LooseDotWeight},
geometry::shape::{Shape, ShapeTrait},
graph::{GeometryIndex, GeometryWeight, GetContinentIndex, MakePrimitive},
primitive::{GenericPrimitive, GetCore, GetInnerOuter, GetJoints, GetOtherJoint, MakeShape},
seg::{

View File

@ -5,7 +5,6 @@ pub mod bend;
pub mod collect;
pub mod connectivity;
pub mod dot;
pub mod geometry;
pub mod guide;
mod layout;
pub mod loose;

View File

@ -1,20 +1,21 @@
use enum_dispatch::enum_dispatch;
use petgraph::stable_graph::NodeIndex;
use crate::geometry::{
shape::{Shape, ShapeTrait},
GetOffset, GetWidth,
};
use crate::graph::{GenericIndex, GetNodeIndex};
use crate::layout::dot::DotWeight;
use crate::layout::seg::{
FixedSegWeight, LoneLooseSegIndex, LoneLooseSegWeight, SegIndex, SeqLooseSegIndex,
SeqLooseSegWeight,
};
use crate::layout::{
bend::{BendIndex, FixedBendWeight, LooseBendIndex, LooseBendWeight},
connectivity::{BandIndex, ContinentIndex, GetNet},
dot::{DotIndex, FixedDotIndex, FixedDotWeight, LooseDotIndex, LooseDotWeight},
geometry::{
shape::{Shape, ShapeTrait},
GetOffset, GetWidth,
},
graph::{GeometryIndex, GeometryWeight, GetBandIndex, GetContinentIndex, Retag},
loose::LooseIndex,
Layout,

View File

@ -1,10 +1,10 @@
use enum_dispatch::enum_dispatch;
use crate::{
geometry::{GetWidth, SegWeightTrait},
graph::{GenericIndex, GetNodeIndex},
layout::{
connectivity::{BandIndex, ContinentIndex},
geometry::{GetWidth, SegWeightTrait},
graph::{
GeometryIndex, GeometryWeight, GetBandIndex, GetContinentIndex, GetContinentIndexMut,
MakePrimitive, Retag,

View File

@ -6,6 +6,7 @@ pub mod graph;
#[macro_use]
pub mod layout;
pub mod dsn;
pub mod geometry;
pub mod math;
pub mod mesh;
pub mod router;

View File

@ -10,14 +10,14 @@ use spade::{HasPosition, InsertionError, Point2};
use crate::layout::rules::RulesTrait;
use crate::triangulation::TriangulationEdgeReference;
use crate::{
geometry::shape::ShapeTrait,
graph::GetNodeIndex,
layout::Layout,
layout::{
bend::{FixedBendIndex, LooseBendIndex},
dot::FixedDotIndex,
geometry::shape::ShapeTrait,
graph::{GeometryIndex, MakePrimitive},
primitive::{GetCore, MakeShape, Primitive},
Layout,
},
triangulation::{GetVertexIndex, Triangulation},
};

View File

@ -6,14 +6,13 @@ use thiserror::Error;
use crate::astar::{astar, AstarStrategy, PathTracker};
use crate::draw::DrawException;
use crate::layout::geometry::GetWidth;
use crate::geometry::{shape::ShapeTrait, GetWidth};
use crate::layout::guide::HeadTrait;
use crate::layout::rules::RulesTrait;
use crate::layout::Layout;
use crate::layout::{
connectivity::BandIndex,
dot::FixedDotIndex,
geometry::shape::ShapeTrait,
graph::{GeometryIndex, MakePrimitive},
primitive::MakeShape,
};