mirror of https://codeberg.org/topola/topola.git
primitive: slightly reduce code duplication by calling `.adjacents()`
This commit is contained in:
parent
3978802512
commit
2d5de212d2
|
|
@ -305,24 +305,8 @@ impl_loose_primitive!(LooseDot, LooseDotWeight);
|
||||||
|
|
||||||
impl<'a> LooseDot<'a> {
|
impl<'a> LooseDot<'a> {
|
||||||
pub fn seg(&self) -> Option<SeqLooseSegIndex> {
|
pub fn seg(&self) -> Option<SeqLooseSegIndex> {
|
||||||
self.layout
|
self.adjacents()
|
||||||
.geometry()
|
.into_iter()
|
||||||
.neighbors_undirected(self.index.node_index())
|
|
||||||
.filter(|ni| {
|
|
||||||
matches!(
|
|
||||||
self.layout
|
|
||||||
.geometry()
|
|
||||||
.edge_weight(
|
|
||||||
self.layout
|
|
||||||
.geometry()
|
|
||||||
.find_edge_undirected(self.index.node_index(), *ni)
|
|
||||||
.unwrap()
|
|
||||||
.0,
|
|
||||||
)
|
|
||||||
.unwrap(),
|
|
||||||
GeometryLabel::Adjacent
|
|
||||||
)
|
|
||||||
})
|
|
||||||
.filter(|ni| {
|
.filter(|ni| {
|
||||||
matches!(
|
matches!(
|
||||||
self.layout.geometry().node_weight(*ni).unwrap(),
|
self.layout.geometry().node_weight(*ni).unwrap(),
|
||||||
|
|
@ -334,24 +318,8 @@ impl<'a> LooseDot<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn bend(&self) -> LooseBendIndex {
|
pub fn bend(&self) -> LooseBendIndex {
|
||||||
self.layout
|
self.adjacents()
|
||||||
.geometry()
|
.into_iter()
|
||||||
.neighbors_undirected(self.index.node_index())
|
|
||||||
.filter(|ni| {
|
|
||||||
matches!(
|
|
||||||
self.layout
|
|
||||||
.geometry()
|
|
||||||
.edge_weight(
|
|
||||||
self.layout
|
|
||||||
.geometry()
|
|
||||||
.find_edge_undirected(self.index.node_index(), *ni)
|
|
||||||
.unwrap()
|
|
||||||
.0,
|
|
||||||
)
|
|
||||||
.unwrap(),
|
|
||||||
GeometryLabel::Adjacent
|
|
||||||
)
|
|
||||||
})
|
|
||||||
.filter(|ni| {
|
.filter(|ni| {
|
||||||
matches!(
|
matches!(
|
||||||
self.layout.geometry().node_weight(*ni).unwrap(),
|
self.layout.geometry().node_weight(*ni).unwrap(),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue