[][src]Struct pathfinder::Map

pub struct Map { /* fields omitted */ }

High abstraction Map which helps position objects.

Methods

impl Map
[src]

pub fn new() -> Self
[src]

Creates a new map, no min_max are intially required and are generated automatically when calling Map::map.

pub fn save(self, path: &Path) -> Result<(), Error>
[src]

Saves the image to disk. Can be absolute or relative path.

Examples

let nodes = Node::from_list(&[(0, 0), (10, 10)]);
Map::new()
    .map(&nodes)
    .save(Path::new("/tmp/example.png"))
    .unwrap();

pub fn consume(self) -> IW
[src]

Unwraps the image wrapper

pub fn map<T: Draw + Location + Hash + MinMax>(self, element: &[T]) -> Self
[src]

Maps any struct that has implemented Draw, on to an ImageBuffer.

Examples

let nodes: Vec<Node> = vec![
    Node::new("1", Coordinate::new(0, 0)),
    Node::new("2", Coordinate::new(100, 100)),
];
// Add content to vectors.
let mut map = Map::new();
map = map.map(&nodes);

pub fn map_filter<T: Draw + Location + Hash + MinMax>(
    self,
    element: &[T],
    filter: &dyn Fn(&T) -> bool
) -> Self
[src]

Maps the elements but with an added filter parameter to exclude elements.

pub fn map_shape<T: Draw + Location + Hash + MinMax, S: Shape>(
    self,
    element: &[T],
    shape: &S
) -> Self
[src]

Maps the elements with a specified shape struct.

pub fn map_absolute<T: Draw + Location + Hash + MinMax>(
    self,
    element: &[T]
) -> Self
[src]

Maps the elements without stabalizing the positions on the canvas.

pub fn map_params<T: Draw + Location + Hash + MinMax, S: Shape>(
    self,
    element: &[T],
    filter: &dyn Fn(&T) -> bool,
    shape: &S
) -> Self
[src]

Maps the elements but with all added parameters.

Trait Implementations

impl Clone for Map
[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Default for Map
[src]

impl Debug for Map
[src]

Auto Trait Implementations

impl Send for Map

impl Sync for Map

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> SetParameter for T
[src]

fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
    T: Parameter<Self>, 
[src]

Sets value as a parameter of self.