mirror of https://codeberg.org/topola/topola.git
contracts: Fix R-tree envelope invariance test
Violations were not detected if shape changed but not the envelope (which is the case when bends are flipped).
This commit is contained in:
parent
12e37e0e91
commit
abf92c7f43
|
|
@ -316,10 +316,13 @@ impl Layout {
|
||||||
impl Layout {
|
impl Layout {
|
||||||
fn test_envelopes(&self) -> bool {
|
fn test_envelopes(&self) -> bool {
|
||||||
!self.rtree.iter().any(|wrapper| {
|
!self.rtree.iter().any(|wrapper| {
|
||||||
|
let index = wrapper.data;
|
||||||
|
let shape = untag!(index, Primitive::new(index, &self.graph).shape());
|
||||||
|
let wrapper = RTreeWrapper::new(shape, index);
|
||||||
!self
|
!self
|
||||||
.rtree
|
.rtree
|
||||||
.locate_in_envelope(&wrapper.geom().envelope())
|
.locate_in_envelope(&shape.envelope())
|
||||||
.any(|w| w == wrapper)
|
.any(|w| *w == wrapper)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ impl BendShape {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, EnumAsInner, PartialEq)]
|
#[derive(Debug, Clone, Copy, EnumAsInner, PartialEq)]
|
||||||
pub enum Shape {
|
pub enum Shape {
|
||||||
// Intentionally in different order to reorder `self.intersects(...)` properly.
|
// Intentionally in different order to reorder `self.intersects(...)` properly.
|
||||||
Dot(DotShape),
|
Dot(DotShape),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue