dsn: implement crude polygon importing

sdl2-demo now stack-overflows when zooming-in too much, probably for a
reason related to pathfinder.
This commit is contained in:
Mikolaj Wielgus 2024-03-16 18:43:03 +00:00
parent fe89226072
commit 14f3234b7b
1 changed files with 21 additions and 2 deletions

View File

@ -113,7 +113,15 @@ impl DsnDesign {
layer as u64,
*net_id as i64,
),
Shape::Polygon(_) => (),
Shape::Polygon(polygon) => Self::add_path(
&mut layout,
(place.x - pin.x) as f64,
-(place.y - pin.y) as f64,
&polygon.coord_vec,
polygon.width as f64,
layer as u64,
*net_id as i64,
),
};
}
}
@ -170,7 +178,18 @@ impl DsnDesign {
net_id as i64,
)
}
Shape::Polygon(_) => todo!(),
Shape::Polygon(polygon) => {
let layer = *layout.rules().layer_ids.get(&polygon.layer).unwrap();
Self::add_path(
&mut layout,
0.0,
0.0,
&polygon.coord_vec,
polygon.width as f64,
layer as u64,
net_id as i64,
)
}
};
}
}