mirror of https://codeberg.org/topola/topola.git
Only remove node when collision is detected during placement
As the node is inserted into the R-tree only afterwards.
This commit is contained in:
parent
cd5365c26f
commit
1ac8dd2828
|
|
@ -1,10 +1,10 @@
|
||||||
use geo::Point;
|
use geo::Point;
|
||||||
use petgraph::stable_graph::{StableDiGraph};
|
use petgraph::stable_graph::StableDiGraph;
|
||||||
use petgraph::visit::EdgeRef;
|
use petgraph::visit::EdgeRef;
|
||||||
use petgraph::Direction::Incoming;
|
use petgraph::Direction::Incoming;
|
||||||
use rstar::primitives::GeomWithData;
|
use rstar::primitives::GeomWithData;
|
||||||
use rstar::RTree;
|
use rstar::RTree;
|
||||||
use spade::{Triangulation};
|
use spade::Triangulation;
|
||||||
|
|
||||||
use crate::bow::Bow;
|
use crate::bow::Bow;
|
||||||
use crate::graph::{
|
use crate::graph::{
|
||||||
|
|
@ -233,7 +233,7 @@ impl Layout {
|
||||||
except: &[TaggedIndex],
|
except: &[TaggedIndex],
|
||||||
) -> Result<(), ()> {
|
) -> Result<(), ()> {
|
||||||
if let Some(..) = self.detect_collision_except(index, except) {
|
if let Some(..) = self.detect_collision_except(index, except) {
|
||||||
self.remove(index);
|
self.graph.remove_node(index.index);
|
||||||
return Err(());
|
return Err(());
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue