fix(geometry): don't check invariants on R-tree bbox init methods

This commit is contained in:
Mikolaj Wielgus 2024-11-28 06:34:49 +01:00
parent 9b1b135715
commit 66cdf6fe4e
1 changed files with 12 additions and 13 deletions

View File

@ -93,10 +93,6 @@ impl<
self.init_dot_bbox(dot);
}
fn init_dot_bbox(&mut self, dot: DI) {
self.rtree.insert(self.make_dot_bbox(dot));
}
pub fn add_seg<W: AccessSegWeight<PW> + GetLayer>(
&mut self,
from: DI,
@ -127,10 +123,6 @@ impl<
self.init_seg_bbox(seg);
}
fn init_seg_bbox(&mut self, seg: SI) {
self.rtree.insert(self.make_seg_bbox(seg));
}
pub fn add_bend<W: AccessBendWeight<PW> + GetLayer>(
&mut self,
from: DI,
@ -169,11 +161,6 @@ impl<
.add_compound_at_index(GenericIndex::<CW>::new(compound.petgraph_index()), weight);
}
fn init_bend_bbox(&mut self, bend: BI) {
self.rtree
.insert(self.make_bend_bbox(bend.into().try_into().unwrap_or_else(|_| unreachable!())));
}
pub fn add_to_compound<W>(&mut self, primitive: GenericIndex<W>, compound: GenericIndex<CW>) {
self.rtree.remove(&self.make_compound_bbox(compound));
self.geometry.add_to_compound(primitive, compound);
@ -289,6 +276,18 @@ impl<
BI: GetPetgraphIndex + Into<PI> + Copy,
> GeometryWithRtree<PW, DW, SW, BW, CW, PI, DI, SI, BI>
{
fn init_dot_bbox(&mut self, dot: DI) {
self.rtree.insert(self.make_dot_bbox(dot));
}
fn init_seg_bbox(&mut self, seg: SI) {
self.rtree.insert(self.make_seg_bbox(seg));
}
fn init_bend_bbox(&mut self, bend: BI) {
self.rtree.insert(self.make_bend_bbox(bend));
}
fn make_bbox(&self, primitive: PI) -> BboxedIndex<GenericNode<PI, GenericIndex<CW>>> {
if let Ok(dot) = <PI as TryInto<DI>>::try_into(primitive) {
self.make_dot_bbox(dot)