mirror of https://codeberg.org/topola/topola.git
cleanup,layout: make connectivity and geometry private and clean up
This commit is contained in:
parent
1af5b96768
commit
0c6190e235
|
|
@ -4,9 +4,8 @@ use thiserror::Error;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
geometry::{
|
geometry::{
|
||||||
BendIndex, DotIndex, FixedDotIndex, FixedSegWeight, GetBandIndex, GetNet, LooseBendIndex,
|
BendIndex, DotIndex, FixedDotIndex, FixedSegWeight, GetBandIndex, GetNet, LooseBendWeight,
|
||||||
LooseBendWeight, LooseDotIndex, LooseDotWeight, LooseSegWeight, MakePrimitive,
|
LooseDotIndex, LooseDotWeight, LooseSegWeight, MakePrimitive, WraparoundableIndex,
|
||||||
WraparoundableIndex,
|
|
||||||
},
|
},
|
||||||
guide::{Guide, Head, HeadTrait, SegbendHead},
|
guide::{Guide, Head, HeadTrait, SegbendHead},
|
||||||
layout::{Infringement, Layout, LayoutException},
|
layout::{Infringement, Layout, LayoutException},
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,9 @@
|
||||||
use enum_dispatch::enum_dispatch;
|
use enum_dispatch::enum_dispatch;
|
||||||
use petgraph::stable_graph::{NodeIndex, StableDiGraph};
|
use petgraph::stable_graph::{NodeIndex, StableDiGraph};
|
||||||
use std::marker::PhantomData;
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
connectivity::{BandIndex, BandWeight, ComponentWeight, ConnectivityWeight},
|
connectivity::{BandIndex, BandWeight, ComponentWeight, ConnectivityWeight},
|
||||||
graph::{GenericIndex, GetNodeIndex},
|
graph::GenericIndex,
|
||||||
layout::Layout,
|
layout::Layout,
|
||||||
math::Circle,
|
math::Circle,
|
||||||
primitive::{GenericPrimitive, Primitive},
|
primitive::{GenericPrimitive, Primitive},
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ use enum_dispatch::enum_dispatch;
|
||||||
use petgraph::stable_graph::NodeIndex;
|
use petgraph::stable_graph::NodeIndex;
|
||||||
|
|
||||||
// Due to apparent limitations of enum_dispatch we're forced to import some types backwards.
|
// Due to apparent limitations of enum_dispatch we're forced to import some types backwards.
|
||||||
use crate::connectivity::{BandWeight, ComponentWeight, ConnectivityWeight};
|
|
||||||
use crate::geometry::{BendIndex, DotIndex, Index, SegIndex, WraparoundableIndex};
|
use crate::geometry::{BendIndex, DotIndex, Index, SegIndex, WraparoundableIndex};
|
||||||
|
|
||||||
#[enum_dispatch]
|
#[enum_dispatch]
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use contracts::debug_invariant;
|
use contracts::{debug_ensures, debug_invariant};
|
||||||
use enum_dispatch::enum_dispatch;
|
use enum_dispatch::enum_dispatch;
|
||||||
use geo::Point;
|
use geo::Point;
|
||||||
use petgraph::stable_graph::StableDiGraph;
|
use petgraph::stable_graph::StableDiGraph;
|
||||||
|
|
@ -8,7 +8,7 @@ use rstar::primitives::GeomWithData;
|
||||||
use rstar::{RTree, RTreeObject};
|
use rstar::{RTree, RTreeObject};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
use crate::connectivity::{BandIndex, ConnectivityLabel, ConnectivityWeight};
|
use crate::connectivity::{BandIndex, BandWeight, ConnectivityGraph, ConnectivityWeight};
|
||||||
use crate::geometry::{
|
use crate::geometry::{
|
||||||
BendWeight, DotIndex, DotWeight, FixedBendIndex, FixedDotIndex, FixedDotWeight, FixedSegIndex,
|
BendWeight, DotIndex, DotWeight, FixedBendIndex, FixedDotIndex, FixedDotWeight, FixedSegIndex,
|
||||||
FixedSegWeight, GeometryGraph, GeometryLabel, GeometryWeight, GetNet, Index, LooseBendIndex,
|
FixedSegWeight, GeometryGraph, GeometryLabel, GeometryWeight, GetNet, Index, LooseBendIndex,
|
||||||
|
|
@ -19,8 +19,8 @@ use crate::graph::{GenericIndex, GetNodeIndex};
|
||||||
use crate::guide::Guide;
|
use crate::guide::Guide;
|
||||||
use crate::math::NoTangents;
|
use crate::math::NoTangents;
|
||||||
use crate::primitive::{
|
use crate::primitive::{
|
||||||
GenericPrimitive, GetConnectable, GetCore, GetEnds, GetFirstRail, GetInnerOuter, GetInterior,
|
GenericPrimitive, GetConnectable, GetCore, GetEnds, GetFirstRail, GetInnerOuter, GetOtherEnd,
|
||||||
GetOtherEnd, GetWeight, GetWraparound, MakeShape,
|
GetWeight, GetWraparound, MakeShape,
|
||||||
};
|
};
|
||||||
use crate::segbend::Segbend;
|
use crate::segbend::Segbend;
|
||||||
use crate::shape::{Shape, ShapeTrait};
|
use crate::shape::{Shape, ShapeTrait};
|
||||||
|
|
@ -56,8 +56,8 @@ pub struct AlreadyConnected(pub i64, pub Index);
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Layout {
|
pub struct Layout {
|
||||||
rtree: RTree<RTreeWrapper>,
|
rtree: RTree<RTreeWrapper>,
|
||||||
pub connectivity: StableDiGraph<ConnectivityWeight, ConnectivityLabel, usize>,
|
connectivity: ConnectivityGraph,
|
||||||
pub geometry: GeometryGraph,
|
geometry: GeometryGraph,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[debug_invariant(self.geometry.node_count() == self.rtree.size())]
|
#[debug_invariant(self.geometry.node_count() == self.rtree.size())]
|
||||||
|
|
@ -103,6 +103,18 @@ impl Layout {
|
||||||
self.geometry.remove_node(index.node_index());
|
self.geometry.remove_node(index.node_index());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[debug_ensures(self.geometry.node_count() == old(self.geometry.node_count()))]
|
||||||
|
#[debug_ensures(self.geometry.edge_count() == old(self.geometry.edge_count()))]
|
||||||
|
pub fn add_band(&mut self, from: FixedDotIndex, width: f64) -> BandIndex {
|
||||||
|
BandIndex::new(
|
||||||
|
self.connectivity
|
||||||
|
.add_node(ConnectivityWeight::Band(BandWeight {
|
||||||
|
width,
|
||||||
|
net: self.primitive(from).net(),
|
||||||
|
})),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
#[debug_ensures(ret.is_ok() -> self.geometry.node_count() == old(self.geometry.node_count() + 1))]
|
#[debug_ensures(ret.is_ok() -> self.geometry.node_count() == old(self.geometry.node_count() + 1))]
|
||||||
#[debug_ensures(ret.is_err() -> self.geometry.node_count() == old(self.geometry.node_count()))]
|
#[debug_ensures(ret.is_err() -> self.geometry.node_count() == old(self.geometry.node_count()))]
|
||||||
#[debug_ensures(self.geometry.edge_count() == old(self.geometry.edge_count()))]
|
#[debug_ensures(self.geometry.edge_count() == old(self.geometry.edge_count()))]
|
||||||
|
|
@ -770,12 +782,6 @@ impl Layout {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[debug_ensures(self.geometry.node_count() == old(self.geometry.node_count()))]
|
|
||||||
#[debug_ensures(self.geometry.edge_count() == old(self.geometry.edge_count()))]
|
|
||||||
pub fn primitive<W>(&self, index: GenericIndex<W>) -> GenericPrimitive<W> {
|
|
||||||
GenericPrimitive::new(index, self)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[debug_ensures(self.geometry.node_count() == old(self.geometry.node_count()))]
|
#[debug_ensures(self.geometry.node_count() == old(self.geometry.node_count()))]
|
||||||
#[debug_ensures(self.geometry.edge_count() == old(self.geometry.edge_count()))]
|
#[debug_ensures(self.geometry.edge_count() == old(self.geometry.edge_count()))]
|
||||||
fn detect_infringement_except(&self, index: Index, except: &[Index]) -> Option<Infringement> {
|
fn detect_infringement_except(&self, index: Index, except: &[Index]) -> Option<Infringement> {
|
||||||
|
|
@ -829,6 +835,24 @@ impl Layout {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Layout {
|
impl Layout {
|
||||||
|
#[debug_ensures(self.geometry.node_count() == old(self.geometry.node_count()))]
|
||||||
|
#[debug_ensures(self.geometry.edge_count() == old(self.geometry.edge_count()))]
|
||||||
|
pub fn connectivity(&self) -> &ConnectivityGraph {
|
||||||
|
&self.connectivity
|
||||||
|
}
|
||||||
|
|
||||||
|
#[debug_ensures(self.geometry.node_count() == old(self.geometry.node_count()))]
|
||||||
|
#[debug_ensures(self.geometry.edge_count() == old(self.geometry.edge_count()))]
|
||||||
|
pub fn geometry(&self) -> &GeometryGraph {
|
||||||
|
&self.geometry
|
||||||
|
}
|
||||||
|
|
||||||
|
#[debug_ensures(self.geometry.node_count() == old(self.geometry.node_count()))]
|
||||||
|
#[debug_ensures(self.geometry.edge_count() == old(self.geometry.edge_count()))]
|
||||||
|
pub fn primitive<W>(&self, index: GenericIndex<W>) -> GenericPrimitive<W> {
|
||||||
|
GenericPrimitive::new(index, self)
|
||||||
|
}
|
||||||
|
|
||||||
fn test_envelopes(&self) -> bool {
|
fn test_envelopes(&self) -> bool {
|
||||||
!self.rtree.iter().any(|wrapper| {
|
!self.rtree.iter().any(|wrapper| {
|
||||||
let index = wrapper.data;
|
let index = wrapper.data;
|
||||||
|
|
|
||||||
12
src/main.rs
12
src/main.rs
|
|
@ -32,7 +32,7 @@ use layout::{Infringement, Layout, LayoutException};
|
||||||
use mesh::{Mesh, MeshEdgeReference, VertexIndex};
|
use mesh::{Mesh, MeshEdgeReference, VertexIndex};
|
||||||
use petgraph::visit::{EdgeRef, IntoEdgeReferences};
|
use petgraph::visit::{EdgeRef, IntoEdgeReferences};
|
||||||
use primitive::MakeShape;
|
use primitive::MakeShape;
|
||||||
use router::{RouterObserver, RoutingError};
|
use router::RouterObserver;
|
||||||
|
|
||||||
use sdl2::event::Event;
|
use sdl2::event::Event;
|
||||||
use sdl2::keyboard::Keycode;
|
use sdl2::keyboard::Keycode;
|
||||||
|
|
@ -68,14 +68,14 @@ enum RouterOrLayout<'a> {
|
||||||
struct EmptyRouterObserver;
|
struct EmptyRouterObserver;
|
||||||
|
|
||||||
impl RouterObserver for EmptyRouterObserver {
|
impl RouterObserver for EmptyRouterObserver {
|
||||||
fn on_rework(&mut self, tracer: &Tracer, trace: &Trace) {}
|
fn on_rework(&mut self, _tracer: &Tracer, _trace: &Trace) {}
|
||||||
fn before_probe(&mut self, tracer: &Tracer, trace: &Trace, edge: MeshEdgeReference) {}
|
fn before_probe(&mut self, _tracer: &Tracer, _trace: &Trace, _edge: MeshEdgeReference) {}
|
||||||
fn on_probe(
|
fn on_probe(
|
||||||
&mut self,
|
&mut self,
|
||||||
tracer: &Tracer,
|
_tracer: &Tracer,
|
||||||
trace: &Trace,
|
_trace: &Trace,
|
||||||
_edge: MeshEdgeReference,
|
_edge: MeshEdgeReference,
|
||||||
result: Result<(), DrawException>,
|
_result: Result<(), DrawException>,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
fn on_estimate(&mut self, _tracer: &Tracer, _vertex: VertexIndex) {}
|
fn on_estimate(&mut self, _tracer: &Tracer, _vertex: VertexIndex) {}
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ impl Mesh {
|
||||||
vertex_to_triangulation_vertex: Vec::new(),
|
vertex_to_triangulation_vertex: Vec::new(),
|
||||||
};
|
};
|
||||||
this.vertex_to_triangulation_vertex
|
this.vertex_to_triangulation_vertex
|
||||||
.resize(layout.geometry.node_bound(), None);
|
.resize(layout.geometry().node_bound(), None);
|
||||||
this
|
this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,15 +66,15 @@ pub trait GetWraparound: GetLayout + GetNodeIndex {
|
||||||
pub trait GetFirstRail: GetLayout + GetNodeIndex {
|
pub trait GetFirstRail: GetLayout + GetNodeIndex {
|
||||||
fn first_rail(&self) -> Option<LooseBendIndex> {
|
fn first_rail(&self) -> Option<LooseBendIndex> {
|
||||||
self.layout()
|
self.layout()
|
||||||
.geometry
|
.geometry()
|
||||||
.neighbors_directed(self.node_index(), Incoming)
|
.neighbors_directed(self.node_index(), Incoming)
|
||||||
.filter(|ni| {
|
.filter(|ni| {
|
||||||
matches!(
|
matches!(
|
||||||
self.layout()
|
self.layout()
|
||||||
.geometry
|
.geometry()
|
||||||
.edge_weight(
|
.edge_weight(
|
||||||
self.layout()
|
self.layout()
|
||||||
.geometry
|
.geometry()
|
||||||
.find_edge(*ni, self.node_index())
|
.find_edge(*ni, self.node_index())
|
||||||
.unwrap()
|
.unwrap()
|
||||||
)
|
)
|
||||||
|
|
@ -90,15 +90,15 @@ pub trait GetFirstRail: GetLayout + GetNodeIndex {
|
||||||
pub trait GetCore: GetLayout + GetNodeIndex {
|
pub trait GetCore: GetLayout + GetNodeIndex {
|
||||||
fn core(&self) -> FixedDotIndex {
|
fn core(&self) -> FixedDotIndex {
|
||||||
self.layout()
|
self.layout()
|
||||||
.geometry
|
.geometry()
|
||||||
.neighbors(self.node_index())
|
.neighbors(self.node_index())
|
||||||
.filter(|ni| {
|
.filter(|ni| {
|
||||||
matches!(
|
matches!(
|
||||||
self.layout()
|
self.layout()
|
||||||
.geometry
|
.geometry()
|
||||||
.edge_weight(
|
.edge_weight(
|
||||||
self.layout()
|
self.layout()
|
||||||
.geometry
|
.geometry()
|
||||||
.find_edge(self.node_index(), *ni)
|
.find_edge(self.node_index(), *ni)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
)
|
)
|
||||||
|
|
@ -115,15 +115,15 @@ pub trait GetCore: GetLayout + GetNodeIndex {
|
||||||
pub trait GetInnerOuter: GetLayout + GetNodeIndex {
|
pub trait GetInnerOuter: GetLayout + GetNodeIndex {
|
||||||
fn inner(&self) -> Option<LooseBendIndex> {
|
fn inner(&self) -> Option<LooseBendIndex> {
|
||||||
self.layout()
|
self.layout()
|
||||||
.geometry
|
.geometry()
|
||||||
.neighbors_directed(self.node_index(), Incoming)
|
.neighbors_directed(self.node_index(), Incoming)
|
||||||
.filter(|ni| {
|
.filter(|ni| {
|
||||||
matches!(
|
matches!(
|
||||||
self.layout()
|
self.layout()
|
||||||
.geometry
|
.geometry()
|
||||||
.edge_weight(
|
.edge_weight(
|
||||||
self.layout()
|
self.layout()
|
||||||
.geometry
|
.geometry()
|
||||||
.find_edge(*ni, self.node_index())
|
.find_edge(*ni, self.node_index())
|
||||||
.unwrap()
|
.unwrap()
|
||||||
)
|
)
|
||||||
|
|
@ -137,15 +137,15 @@ pub trait GetInnerOuter: GetLayout + GetNodeIndex {
|
||||||
|
|
||||||
fn outer(&self) -> Option<LooseBendIndex> {
|
fn outer(&self) -> Option<LooseBendIndex> {
|
||||||
self.layout()
|
self.layout()
|
||||||
.geometry
|
.geometry()
|
||||||
.neighbors_directed(self.node_index(), Outgoing)
|
.neighbors_directed(self.node_index(), Outgoing)
|
||||||
.filter(|ni| {
|
.filter(|ni| {
|
||||||
matches!(
|
matches!(
|
||||||
self.layout()
|
self.layout()
|
||||||
.geometry
|
.geometry()
|
||||||
.edge_weight(
|
.edge_weight(
|
||||||
self.layout()
|
self.layout()
|
||||||
.geometry
|
.geometry()
|
||||||
.find_edge(self.node_index(), *ni)
|
.find_edge(self.node_index(), *ni)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
)
|
)
|
||||||
|
|
@ -191,7 +191,7 @@ macro_rules! impl_loose_primitive {
|
||||||
impl<'a> GetNet for $primitive_struct<'a> {
|
impl<'a> GetNet for $primitive_struct<'a> {
|
||||||
fn net(&self) -> i64 {
|
fn net(&self) -> i64 {
|
||||||
self.layout()
|
self.layout()
|
||||||
.connectivity
|
.connectivity()
|
||||||
.node_weight(self.weight().band().node_index())
|
.node_weight(self.weight().band().node_index())
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.net()
|
.net()
|
||||||
|
|
@ -224,22 +224,22 @@ impl<'a, W> GenericPrimitive<'a, W> {
|
||||||
fn tagged_weight(&self) -> GeometryWeight {
|
fn tagged_weight(&self) -> GeometryWeight {
|
||||||
*self
|
*self
|
||||||
.layout
|
.layout
|
||||||
.geometry
|
.geometry()
|
||||||
.node_weight(self.index.node_index())
|
.node_weight(self.index.node_index())
|
||||||
.unwrap()
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn adjacents(&self) -> Vec<NodeIndex<usize>> {
|
fn adjacents(&self) -> Vec<NodeIndex<usize>> {
|
||||||
self.layout
|
self.layout
|
||||||
.geometry
|
.geometry()
|
||||||
.neighbors_undirected(self.index.node_index())
|
.neighbors_undirected(self.index.node_index())
|
||||||
.filter(|ni| {
|
.filter(|ni| {
|
||||||
matches!(
|
matches!(
|
||||||
self.layout
|
self.layout
|
||||||
.geometry
|
.geometry()
|
||||||
.edge_weight(
|
.edge_weight(
|
||||||
self.layout
|
self.layout
|
||||||
.geometry
|
.geometry()
|
||||||
.find_edge_undirected(self.index.node_index(), *ni)
|
.find_edge_undirected(self.index.node_index(), *ni)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.0,
|
.0,
|
||||||
|
|
@ -308,15 +308,15 @@ impl_loose_primitive!(LooseDot, LooseDotWeight);
|
||||||
impl<'a> LooseDot<'a> {
|
impl<'a> LooseDot<'a> {
|
||||||
pub fn seg(&self) -> Option<LooseSegIndex> {
|
pub fn seg(&self) -> Option<LooseSegIndex> {
|
||||||
self.layout
|
self.layout
|
||||||
.geometry
|
.geometry()
|
||||||
.neighbors_undirected(self.index.node_index())
|
.neighbors_undirected(self.index.node_index())
|
||||||
.filter(|ni| {
|
.filter(|ni| {
|
||||||
matches!(
|
matches!(
|
||||||
self.layout
|
self.layout
|
||||||
.geometry
|
.geometry()
|
||||||
.edge_weight(
|
.edge_weight(
|
||||||
self.layout
|
self.layout
|
||||||
.geometry
|
.geometry()
|
||||||
.find_edge_undirected(self.index.node_index(), *ni)
|
.find_edge_undirected(self.index.node_index(), *ni)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.0,
|
.0,
|
||||||
|
|
@ -327,7 +327,7 @@ impl<'a> LooseDot<'a> {
|
||||||
})
|
})
|
||||||
.filter(|ni| {
|
.filter(|ni| {
|
||||||
matches!(
|
matches!(
|
||||||
self.layout.geometry.node_weight(*ni).unwrap(),
|
self.layout.geometry().node_weight(*ni).unwrap(),
|
||||||
GeometryWeight::LooseSeg(..)
|
GeometryWeight::LooseSeg(..)
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
@ -337,15 +337,15 @@ impl<'a> LooseDot<'a> {
|
||||||
|
|
||||||
pub fn bend(&self) -> LooseBendIndex {
|
pub fn bend(&self) -> LooseBendIndex {
|
||||||
self.layout
|
self.layout
|
||||||
.geometry
|
.geometry()
|
||||||
.neighbors_undirected(self.index.node_index())
|
.neighbors_undirected(self.index.node_index())
|
||||||
.filter(|ni| {
|
.filter(|ni| {
|
||||||
matches!(
|
matches!(
|
||||||
self.layout
|
self.layout
|
||||||
.geometry
|
.geometry()
|
||||||
.edge_weight(
|
.edge_weight(
|
||||||
self.layout
|
self.layout
|
||||||
.geometry
|
.geometry()
|
||||||
.find_edge_undirected(self.index.node_index(), *ni)
|
.find_edge_undirected(self.index.node_index(), *ni)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.0,
|
.0,
|
||||||
|
|
@ -356,7 +356,7 @@ impl<'a> LooseDot<'a> {
|
||||||
})
|
})
|
||||||
.filter(|ni| {
|
.filter(|ni| {
|
||||||
matches!(
|
matches!(
|
||||||
self.layout.geometry.node_weight(*ni).unwrap(),
|
self.layout.geometry().node_weight(*ni).unwrap(),
|
||||||
GeometryWeight::LooseBend(..)
|
GeometryWeight::LooseBend(..)
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
@ -423,9 +423,10 @@ impl<'a> GetWidth for LooseSeg<'a> {
|
||||||
impl<'a> GetEnds<DotIndex, LooseDotIndex> for LooseSeg<'a> {
|
impl<'a> GetEnds<DotIndex, LooseDotIndex> for LooseSeg<'a> {
|
||||||
fn ends(&self) -> (DotIndex, LooseDotIndex) {
|
fn ends(&self) -> (DotIndex, LooseDotIndex) {
|
||||||
let v = self.adjacents();
|
let v = self.adjacents();
|
||||||
if let GeometryWeight::FixedDot(..) = self.layout.geometry.node_weight(v[0]).unwrap() {
|
if let GeometryWeight::FixedDot(..) = self.layout.geometry().node_weight(v[0]).unwrap() {
|
||||||
(FixedDotIndex::new(v[0]).into(), LooseDotIndex::new(v[1]))
|
(FixedDotIndex::new(v[0]).into(), LooseDotIndex::new(v[1]))
|
||||||
} else if let GeometryWeight::FixedDot(..) = self.layout.geometry.node_weight(v[1]).unwrap()
|
} else if let GeometryWeight::FixedDot(..) =
|
||||||
|
self.layout.geometry().node_weight(v[1]).unwrap()
|
||||||
{
|
{
|
||||||
(FixedDotIndex::new(v[1]).into(), LooseDotIndex::new(v[0]))
|
(FixedDotIndex::new(v[1]).into(), LooseDotIndex::new(v[0]))
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,10 @@
|
||||||
use contracts::debug_ensures;
|
use contracts::debug_ensures;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
connectivity::{BandIndex, BandWeight, ConnectivityWeight},
|
|
||||||
draw::{Draw, DrawException},
|
draw::{Draw, DrawException},
|
||||||
geometry::{FixedDotIndex, GetNet, LooseBendIndex},
|
geometry::{FixedDotIndex, LooseBendIndex},
|
||||||
guide::{BareHead, Head, SegbendHead},
|
guide::{BareHead, Head, SegbendHead},
|
||||||
layout::{Layout, LayoutException},
|
layout::Layout,
|
||||||
mesh::{Mesh, VertexIndex},
|
mesh::{Mesh, VertexIndex},
|
||||||
rules::Rules,
|
rules::Rules,
|
||||||
};
|
};
|
||||||
|
|
@ -32,12 +31,7 @@ impl<'a> Tracer<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn start(&mut self, from: FixedDotIndex, width: f64) -> Trace {
|
pub fn start(&mut self, from: FixedDotIndex, width: f64) -> Trace {
|
||||||
let band = BandIndex::new(self.layout.connectivity.add_node(ConnectivityWeight::Band(
|
let band = self.layout.add_band(from, width);
|
||||||
BandWeight {
|
|
||||||
width,
|
|
||||||
net: self.layout.primitive(from).net(),
|
|
||||||
},
|
|
||||||
)));
|
|
||||||
Trace {
|
Trace {
|
||||||
path: vec![from.into()],
|
path: vec![from.into()],
|
||||||
head: BareHead { dot: from, band }.into(),
|
head: BareHead { dot: from, band }.into(),
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ impl<I: Copy + PartialEq + GetNodeIndex, W: GetVertexIndex<I> + HasPosition<Scal
|
||||||
index_marker: PhantomData,
|
index_marker: PhantomData,
|
||||||
};
|
};
|
||||||
this.vertex_to_handle
|
this.vertex_to_handle
|
||||||
.resize(layout.geometry.node_bound(), None);
|
.resize(layout.geometry().node_bound(), None);
|
||||||
this
|
this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue