mirror of https://codeberg.org/topola/topola.git
geometry: move shape to geometry module
This commit is contained in:
parent
8b1d95491d
commit
410b029eb3
|
|
@ -2,18 +2,18 @@ use enum_dispatch::enum_dispatch;
|
||||||
use geo::Line;
|
use geo::Line;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
layout::Layout,
|
|
||||||
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},
|
||||||
|
Layout,
|
||||||
},
|
},
|
||||||
math::{self, Circle, NoTangents},
|
math::{self, Circle, NoTangents},
|
||||||
rules::{Conditions, Rules},
|
rules::{Conditions, Rules},
|
||||||
segbend::Segbend,
|
segbend::Segbend,
|
||||||
shape::{Shape, ShapeTrait},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[enum_dispatch]
|
#[enum_dispatch]
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,14 @@
|
||||||
use super::{
|
|
||||||
connectivity::{BandIndex, BandWeight, ConnectivityWeight, GetNet},
|
|
||||||
loose::{GetNextLoose, LooseIndex},
|
|
||||||
};
|
|
||||||
use crate::{
|
use crate::{
|
||||||
graph::GetNodeIndex,
|
graph::GetNodeIndex,
|
||||||
layout::{
|
layout::{
|
||||||
|
connectivity::{BandIndex, BandWeight, ConnectivityWeight, GetNet},
|
||||||
dot::{DotIndex, FixedDotIndex},
|
dot::{DotIndex, FixedDotIndex},
|
||||||
|
geometry::shape::ShapeTrait,
|
||||||
graph::{GeometryIndex, MakePrimitive},
|
graph::{GeometryIndex, MakePrimitive},
|
||||||
|
loose::{GetNextLoose, LooseIndex},
|
||||||
primitive::{GetJoints, GetOtherJoint, MakeShape},
|
primitive::{GetJoints, GetOtherJoint, MakeShape},
|
||||||
Layout,
|
Layout,
|
||||||
},
|
},
|
||||||
shape::ShapeTrait,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct Band<'a> {
|
pub struct Band<'a> {
|
||||||
|
|
|
||||||
|
|
@ -13,10 +13,10 @@ use crate::{
|
||||||
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},
|
||||||
},
|
},
|
||||||
math::Circle,
|
math::Circle,
|
||||||
shape::{BendShape, DotShape, SegShape, Shape},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[enum_dispatch]
|
#[enum_dispatch]
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
mod geometry;
|
mod geometry;
|
||||||
|
pub mod shape;
|
||||||
|
|
||||||
pub use geometry::*;
|
pub use geometry::*;
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ use crate::layout::geometry::{
|
||||||
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, GetComponentIndex, MakePrimitive, Retag},
|
graph::{GeometryIndex, GeometryWeight, GetComponentIndex, MakePrimitive, Retag},
|
||||||
primitive::{
|
primitive::{
|
||||||
GenericPrimitive, GetConnectable, GetCore, GetInnerOuter, GetJoints, GetLimbs,
|
GenericPrimitive, GetConnectable, GetCore, GetInnerOuter, GetJoints, GetLimbs,
|
||||||
|
|
@ -35,7 +36,6 @@ use crate::layout::{
|
||||||
};
|
};
|
||||||
use crate::math::NoTangents;
|
use crate::math::NoTangents;
|
||||||
use crate::segbend::Segbend;
|
use crate::segbend::Segbend;
|
||||||
use crate::shape::{Shape, ShapeTrait};
|
|
||||||
use crate::wraparoundable::{GetWraparound, Wraparoundable, WraparoundableIndex};
|
use crate::wraparoundable::{GetWraparound, Wraparoundable, WraparoundableIndex};
|
||||||
|
|
||||||
use super::bend::BendWeight;
|
use super::bend::BendWeight;
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,9 @@ pub mod bend;
|
||||||
pub mod connectivity;
|
pub mod connectivity;
|
||||||
pub mod dot;
|
pub mod dot;
|
||||||
pub mod geometry;
|
pub mod geometry;
|
||||||
|
mod layout;
|
||||||
pub mod loose;
|
pub mod loose;
|
||||||
pub mod primitive;
|
pub mod primitive;
|
||||||
pub mod seg;
|
pub mod seg;
|
||||||
|
|
||||||
mod layout;
|
|
||||||
pub use layout::*;
|
pub use layout::*;
|
||||||
|
|
|
||||||
|
|
@ -11,14 +11,15 @@ use crate::layout::{
|
||||||
bend::{BendIndex, FixedBendWeight, LooseBendIndex, LooseBendWeight},
|
bend::{BendIndex, FixedBendWeight, LooseBendIndex, LooseBendWeight},
|
||||||
connectivity::{BandIndex, ComponentIndex, GetNet},
|
connectivity::{BandIndex, ComponentIndex, GetNet},
|
||||||
dot::{DotIndex, FixedDotIndex, FixedDotWeight, LooseDotIndex, LooseDotWeight},
|
dot::{DotIndex, FixedDotIndex, FixedDotWeight, LooseDotIndex, LooseDotWeight},
|
||||||
geometry::{GetOffset, GetWidth},
|
geometry::{
|
||||||
|
shape::{Shape, ShapeTrait},
|
||||||
|
GetOffset, GetWidth,
|
||||||
|
},
|
||||||
graph::{GeometryIndex, GeometryWeight, GetBandIndex, GetComponentIndex, MakePrimitive, Retag},
|
graph::{GeometryIndex, GeometryWeight, GetBandIndex, GetComponentIndex, MakePrimitive, Retag},
|
||||||
loose::{Loose, LooseIndex},
|
loose::{Loose, LooseIndex},
|
||||||
Layout,
|
Layout,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::shape::{Shape, ShapeTrait};
|
|
||||||
|
|
||||||
#[enum_dispatch]
|
#[enum_dispatch]
|
||||||
pub trait GetLayout {
|
pub trait GetLayout {
|
||||||
fn layout(&self) -> &Layout;
|
fn layout(&self) -> &Layout;
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ mod mesh;
|
||||||
mod router;
|
mod router;
|
||||||
mod rules;
|
mod rules;
|
||||||
mod segbend;
|
mod segbend;
|
||||||
mod shape;
|
|
||||||
mod tracer;
|
mod tracer;
|
||||||
mod triangulation;
|
mod triangulation;
|
||||||
mod wraparoundable;
|
mod wraparoundable;
|
||||||
|
|
@ -28,6 +27,7 @@ use draw::DrawException;
|
||||||
use geo::point;
|
use geo::point;
|
||||||
use layout::connectivity::BandIndex;
|
use layout::connectivity::BandIndex;
|
||||||
use layout::dot::FixedDotWeight;
|
use layout::dot::FixedDotWeight;
|
||||||
|
use layout::geometry::shape::{Shape, ShapeTrait};
|
||||||
use layout::graph::{GeometryIndex, MakePrimitive};
|
use layout::graph::{GeometryIndex, MakePrimitive};
|
||||||
use layout::primitive::MakeShape;
|
use layout::primitive::MakeShape;
|
||||||
use layout::seg::FixedSegWeight;
|
use layout::seg::FixedSegWeight;
|
||||||
|
|
@ -40,7 +40,6 @@ use sdl2::event::Event;
|
||||||
use sdl2::keyboard::Keycode;
|
use sdl2::keyboard::Keycode;
|
||||||
use sdl2::video::{GLProfile, Window};
|
use sdl2::video::{GLProfile, Window};
|
||||||
use sdl2::EventPump;
|
use sdl2::EventPump;
|
||||||
use shape::{Shape, ShapeTrait};
|
|
||||||
|
|
||||||
use pathfinder_canvas::{ArcDirection, CanvasRenderingContext2D, ColorU, FillRule};
|
use pathfinder_canvas::{ArcDirection, CanvasRenderingContext2D, ColorU, FillRule};
|
||||||
use pathfinder_canvas::{Canvas, CanvasFontContext, Path2D};
|
use pathfinder_canvas::{Canvas, CanvasFontContext, Path2D};
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,10 @@ use crate::{
|
||||||
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},
|
||||||
},
|
},
|
||||||
shape::ShapeTrait,
|
|
||||||
triangulation::{GetVertexIndex, Triangulation},
|
triangulation::{GetVertexIndex, Triangulation},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ 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,
|
||||||
};
|
};
|
||||||
|
|
@ -18,7 +19,6 @@ use crate::layout::{
|
||||||
use crate::mesh::{Mesh, MeshEdgeReference, VertexIndex};
|
use crate::mesh::{Mesh, MeshEdgeReference, VertexIndex};
|
||||||
|
|
||||||
use crate::rules::Rules;
|
use crate::rules::Rules;
|
||||||
use crate::shape::ShapeTrait;
|
|
||||||
use crate::tracer::{Trace, Tracer};
|
use crate::tracer::{Trace, Tracer};
|
||||||
|
|
||||||
#[derive(Error, Debug, Clone, Copy)]
|
#[derive(Error, Debug, Clone, Copy)]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue