sdl2-demo: fix compilation errors

This commit is contained in:
Mikolaj Wielgus 2024-06-25 15:31:21 +02:00
parent b6cfcc8518
commit 3fe305b99a
1 changed files with 15 additions and 6 deletions

View File

@ -11,6 +11,7 @@ macro_rules! dbg_dot {
use geo::point; use geo::point;
use painter::Painter; use painter::Painter;
use petgraph::graph::NodeIndex;
use petgraph::visit::{EdgeRef, IntoEdgeReferences}; use petgraph::visit::{EdgeRef, IntoEdgeReferences};
use topola::autorouter::selection::Selection; use topola::autorouter::selection::Selection;
use topola::autorouter::{Autorouter, AutorouterStatus}; use topola::autorouter::{Autorouter, AutorouterStatus};
@ -25,7 +26,7 @@ use topola::geometry::shape::ShapeTrait;
use topola::layout::zone::MakePolyShape; use topola::layout::zone::MakePolyShape;
use topola::layout::Layout; use topola::layout::Layout;
use topola::router::draw::DrawException; use topola::router::draw::DrawException;
use topola::router::navmesh::{Navmesh, NavmeshEdgeReference, NavvertexNodeIndex}; use topola::router::navmesh::Navmesh;
use topola::router::tracer::{Trace, Tracer}; use topola::router::tracer::{Trace, Tracer};
use topola::specctra::design::SpecctraDesign; use topola::specctra::design::SpecctraDesign;
use topola::specctra::mesadata::SpecctraMesadata; use topola::specctra::mesadata::SpecctraMesadata;
@ -145,7 +146,7 @@ fn main() -> Result<(), anyhow::Error> {
}));*/ }));*/
let design = SpecctraDesign::load_from_file( let design = SpecctraDesign::load_from_file(
"tests/data/de9_tht_female_to_tht_female/de9_tht_female_to_tht_female.dsn", "tests/single_layer/data/de9_tht_female_to_tht_female/de9_tht_female_to_tht_female.dsn",
)?; )?;
//let design = DsnDesign::load_from_file("tests/data/test/test.dsn")?; //let design = DsnDesign::load_from_file("tests/data/test/test.dsn")?;
//dbg!(&design); //dbg!(&design);
@ -225,7 +226,7 @@ fn render_times(
mut router_or_layout: RouterOrLayout<impl RulesTrait>, mut router_or_layout: RouterOrLayout<impl RulesTrait>,
_unused: Option<()>, _unused: Option<()>,
mut maybe_navmesh: Option<Navmesh>, mut maybe_navmesh: Option<Navmesh>,
path: &[NavvertexNodeIndex], path: &[NodeIndex<usize>],
ghosts: &[PrimitiveShape], ghosts: &[PrimitiveShape],
highlighteds: &[PrimitiveIndex], highlighteds: &[PrimitiveIndex],
times: i64, times: i64,
@ -334,9 +335,17 @@ fn render_times(
} }
if let Some(ref navmesh) = maybe_navmesh { if let Some(ref navmesh) = maybe_navmesh {
for edge in navmesh.edge_references() { for edge in navmesh.graph().edge_references() {
let from = edge.source().primitive(layout.drawing()).shape().center(); let from =
let to = edge.target().primitive(layout.drawing()).shape().center(); PrimitiveIndex::from(navmesh.graph().node_weight(edge.source()).unwrap().node)
.primitive(layout.drawing())
.shape()
.center();
let to =
PrimitiveIndex::from(navmesh.graph().node_weight(edge.target()).unwrap().node)
.primitive(layout.drawing())
.shape()
.center();
let color = 'blk: { let color = 'blk: {
if let (Some(source_pos), Some(target_pos)) = ( if let (Some(source_pos), Some(target_pos)) = (