use crate::pdk::layers::LayerId;
use geometry::prelude::*;
use geometry::union::BoundingUnion;
pub trait LayerBbox: Bbox {
fn layer_bbox(&self, layer: LayerId) -> Option<Rect>;
}
impl<T: LayerBbox> LayerBbox for Vec<T> {
fn layer_bbox(&self, layer: LayerId) -> Option<Rect> {
let mut bbox = None;
for item in self {
bbox = bbox.bounding_union(&item.layer_bbox(layer));
}
bbox
}
}
impl<T: LayerBbox> LayerBbox for &T {
fn layer_bbox(&self, layer: LayerId) -> Option<Rect> {
(*self).layer_bbox(layer)
}
}