mirror of https://codeberg.org/topola/topola.git
Add methods to locate joints, segments, polygons at point (bbox-only for now)
This commit is contained in:
parent
95694ac931
commit
68eafc1059
|
|
@ -29,8 +29,8 @@ impl Viewport {
|
|||
.zoom_range(0.00001..=10000.0)
|
||||
.show(ui, &mut scene_rect, |ui| {
|
||||
if let Some(ref workspace) = workspace {
|
||||
let mut displayer = Display::new();
|
||||
displayer.update(ctx, ui, &self, workspace);
|
||||
let mut display = Display::new();
|
||||
display.update(ctx, ui, &self, workspace);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -185,6 +185,41 @@ impl Layout {
|
|||
Rectangle::from_corners([min_x, min_y, layer], [max_x, max_y, layer])
|
||||
}
|
||||
|
||||
pub fn locate_joints_at_point(
|
||||
&self,
|
||||
layer: usize,
|
||||
point: [i64; 2],
|
||||
) -> impl Iterator<Item = JointId> {
|
||||
self.joints_rtree
|
||||
.as_ref()
|
||||
.locate_all_at_point(&[point[0], point[1], layer as i64])
|
||||
.map(|geom_with_data| geom_with_data.data)
|
||||
}
|
||||
|
||||
pub fn locate_segments_at_point(
|
||||
&self,
|
||||
layer: usize,
|
||||
point: [i64; 2],
|
||||
) -> impl Iterator<Item = SegmentId> {
|
||||
self.segments_rtree
|
||||
.as_ref()
|
||||
.locate_all_at_point(&[point[0], point[1], layer as i64])
|
||||
.map(|geom_with_data| geom_with_data.data)
|
||||
}
|
||||
|
||||
// TODO: vias.
|
||||
|
||||
pub fn locate_polygons_at_point(
|
||||
&self,
|
||||
layer: usize,
|
||||
point: [i64; 2],
|
||||
) -> impl Iterator<Item = PolygonId> {
|
||||
self.polygons_rtree
|
||||
.as_ref()
|
||||
.locate_all_at_point(&[point[0], point[1], layer as i64])
|
||||
.map(|geom_with_data| geom_with_data.data)
|
||||
}
|
||||
|
||||
pub fn pin(&self, pin: PinId) -> &Pin {
|
||||
&self.pins[pin.id()]
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue