pipeline builders for sequence to grid with simple horizontal / vertical layout
This commit is contained in:
parent
e7d1763369
commit
f2fdaa687b
2 changed files with 30 additions and 2 deletions
nested/src/index
|
@ -14,7 +14,8 @@ pub use {
|
|||
InnerViewPort,
|
||||
OuterViewPort
|
||||
},
|
||||
index::{IndexView}
|
||||
index::{IndexView},
|
||||
grid::{GridView}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -40,6 +41,24 @@ where SrcKey: Clone + Send + Sync + 'static,
|
|||
}
|
||||
}
|
||||
|
||||
impl<Item> OuterViewPort<dyn IndexView<usize, Item = Item>>
|
||||
where Item: 'static
|
||||
{
|
||||
pub fn to_grid_horizontal(&self) -> OuterViewPort<dyn GridView<Item = Item>> {
|
||||
self.map_key(
|
||||
|idx| cgmath::Point2::new(*idx as i16, 0),
|
||||
|pt| if pt.y == 0 { Some(pt.x as usize) } else { None }
|
||||
)
|
||||
}
|
||||
|
||||
pub fn to_grid_vertical(&self) -> OuterViewPort<dyn GridView<Item = Item>> {
|
||||
self.map_key(
|
||||
|idx| cgmath::Point2::new(0, *idx as i16),
|
||||
|pt| if pt.x == 0 { Some(pt.y as usize) } else { None }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct MapIndexKey<DstKey, SrcKey, SrcView, F1, F2>
|
||||
where DstKey: Clone + Send + Sync,
|
||||
SrcKey: Clone + Send + Sync,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue