mirror of https://codeberg.org/topola/topola.git
autorouter: as a starter, route the endpoints of only the first ratline
This commit is contained in:
parent
9c332bdde3
commit
531bc6d22c
|
|
@ -29,7 +29,7 @@ impl<R: RulesTrait> Autorouter<R> {
|
||||||
// For now, let's only take the first ratline.
|
// For now, let's only take the first ratline.
|
||||||
let ratline = self.ratsnest.graph().edge_references().next().unwrap();
|
let ratline = self.ratsnest.graph().edge_references().next().unwrap();
|
||||||
|
|
||||||
/*self.route(
|
self.route(
|
||||||
self.ratsnest
|
self.ratsnest
|
||||||
.graph()
|
.graph()
|
||||||
.node_weight(ratline.source())
|
.node_weight(ratline.source())
|
||||||
|
|
@ -41,7 +41,7 @@ impl<R: RulesTrait> Autorouter<R> {
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.vertex_index(),
|
.vertex_index(),
|
||||||
observer,
|
observer,
|
||||||
);*/
|
);
|
||||||
|
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
@ -55,7 +55,7 @@ impl<R: RulesTrait> Autorouter<R> {
|
||||||
let from_dot = self.terminating_dot(from);
|
let from_dot = self.terminating_dot(from);
|
||||||
let to_dot = self.terminating_dot(to);
|
let to_dot = self.terminating_dot(to);
|
||||||
|
|
||||||
self.router.route_band(from_dot, to_dot, 3.0, observer)
|
self.router.route_band(from_dot, to_dot, 100.0, observer)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn terminating_dot(&mut self, vertex: RatsnestVertexIndex) -> FixedDotIndex {
|
fn terminating_dot(&mut self, vertex: RatsnestVertexIndex) -> FixedDotIndex {
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,12 @@ use std::{
|
||||||
|
|
||||||
use topola::{
|
use topola::{
|
||||||
autorouter::Autorouter,
|
autorouter::Autorouter,
|
||||||
drawing::{graph::MakePrimitive, primitive::MakePrimitiveShape, rules::RulesTrait, Drawing},
|
drawing::{
|
||||||
|
graph::{MakePrimitive, PrimitiveIndex},
|
||||||
|
primitive::MakePrimitiveShape,
|
||||||
|
rules::RulesTrait,
|
||||||
|
Drawing,
|
||||||
|
},
|
||||||
dsn::{design::DsnDesign, rules::DsnRules},
|
dsn::{design::DsnDesign, rules::DsnRules},
|
||||||
geometry::{
|
geometry::{
|
||||||
compound::CompoundManagerTrait,
|
compound::CompoundManagerTrait,
|
||||||
|
|
@ -69,9 +74,13 @@ impl App {
|
||||||
|
|
||||||
struct EmptyRouterObserver;
|
struct EmptyRouterObserver;
|
||||||
|
|
||||||
impl<R: RulesTrait> RouterObserverTrait<R> for EmptyRouterObserver {
|
impl<R: RulesTrait + std::fmt::Debug> RouterObserverTrait<R> for EmptyRouterObserver {
|
||||||
fn on_rework(&mut self, _tracer: &Tracer<R>, _trace: &Trace) {}
|
fn on_rework(&mut self, _tracer: &Tracer<R>, _trace: &Trace) {
|
||||||
fn before_probe(&mut self, _tracer: &Tracer<R>, _trace: &Trace, _edge: NavmeshEdgeReference) {}
|
//dbg!(_tracer, _trace);
|
||||||
|
}
|
||||||
|
fn before_probe(&mut self, _tracer: &Tracer<R>, _trace: &Trace, _edge: NavmeshEdgeReference) {
|
||||||
|
//dbg!(_tracer, _trace, _edge);
|
||||||
|
}
|
||||||
fn on_probe(
|
fn on_probe(
|
||||||
&mut self,
|
&mut self,
|
||||||
_tracer: &Tracer<R>,
|
_tracer: &Tracer<R>,
|
||||||
|
|
@ -79,8 +88,11 @@ impl<R: RulesTrait> RouterObserverTrait<R> for EmptyRouterObserver {
|
||||||
_edge: NavmeshEdgeReference,
|
_edge: NavmeshEdgeReference,
|
||||||
_result: Result<(), DrawException>,
|
_result: Result<(), DrawException>,
|
||||||
) {
|
) {
|
||||||
|
//dbg!(_tracer, _trace, _edge, _result);
|
||||||
|
}
|
||||||
|
fn on_estimate(&mut self, _tracer: &Tracer<R>, _vertex: VertexIndex) {
|
||||||
|
//dbg!(_tracer, _vertex);
|
||||||
}
|
}
|
||||||
fn on_estimate(&mut self, _tracer: &Tracer<R>, _vertex: VertexIndex) {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl eframe::App for App {
|
impl eframe::App for App {
|
||||||
|
|
|
||||||
|
|
@ -392,7 +392,7 @@ fn render_times(
|
||||||
maybe_navmesh = None;
|
maybe_navmesh = None;
|
||||||
}
|
}
|
||||||
|
|
||||||
router.layout.drawing()
|
router.layout().drawing()
|
||||||
}
|
}
|
||||||
RouterOrLayout::Layout(layout) => layout,
|
RouterOrLayout::Layout(layout) => layout,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -216,7 +216,7 @@ impl<R: RulesTrait> Layout<R> {
|
||||||
FixedDotWeight {
|
FixedDotWeight {
|
||||||
circle: Circle {
|
circle: Circle {
|
||||||
pos: self.zone(zone).shape().center(),
|
pos: self.zone(zone).shape().center(),
|
||||||
r: 0.0,
|
r: 100.0,
|
||||||
},
|
},
|
||||||
layer: self.zone(zone).layer(),
|
layer: self.zone(zone).layer(),
|
||||||
maybe_net: None,
|
maybe_net: None,
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ pub struct Trace {
|
||||||
pub width: f64,
|
pub width: f64,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct Tracer<'a, R: RulesTrait> {
|
pub struct Tracer<'a, R: RulesTrait> {
|
||||||
pub layout: &'a mut Layout<R>,
|
pub layout: &'a mut Layout<R>,
|
||||||
pub mesh: &'a Navmesh,
|
pub mesh: &'a Navmesh,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue