[][src]Struct pathfinder::Group

pub struct Group {
    pub nodes: Vec<Node>,
    // some fields omitted
}

Holds a set of nodes and applies properties to all child nodes when drawn. The group itself has no displayed output and is not visible. It contains a Node used for Group meta data.

Fields

nodes: Vec<Node>

Methods

impl Group
[src]

pub fn new(name: &str, coordinates: Coordinate) -> Self
[src]

Constructs a new Group

pub fn new_node(&mut self)
[src]

Adds a Node dynamically to the Group.

pub fn radius(&mut self, radius: u32)
[src]

Set the radius for the group's meta-data.

pub fn nodes(&self) -> &Vec<Node>
[src]

Retrieves the nodes drawing in the group. Positions are relative to the group.

pub fn set(&mut self) -> &mut Node
[src]

Retrieves a mutable group meta data.

pub fn add(&mut self, nr: u32)
[src]

Adds a set of nodes randomly located inside the group.

pub fn each(&mut self, func: &dyn Fn(&mut Node))
[src]

Applies the closure over each mutable child node.

pub fn color(&mut self, rgba: Rgba<u8>)
[src]

Sets the color of the Group.

pub fn node_plot(&mut self, calc: &dyn Fn(usize) -> Coordinate)
[src]

Plots node according to the fn provided. The closure parameter is the number of children the group has.

pub fn new_node_min_max(&mut self, min: u32, max: u32)
[src]

Adds a Node with a specific minimum and maximum distance from the center of the Group.

pub fn new_simple(x: i16, y: i16) -> Self
[src]

Removes all non-essentials from the standard implementation.

pub fn push(&mut self, node: Node)
[src]

Pushes a Node to the Group.

pub fn dynamic_radius(&self) -> u32
[src]

Returns a dynamic radius based on the number of Nodes in the Group.

pub fn rotate(&mut self, rad: f64)
[src]

Rotates all the nodes inside the group.

pub fn gen_color(&self, coordinates: Coordinate) -> Rgba<u8>
[src]

Generates an image::Rgba based on the color of the Group and the distance from center.

pub fn from_list(list: &[(i16, i16)]) -> Vec<Self>
[src]

Converts a list of tuples (x,y) to a Vector of Groups. Names are assigned from "A" and upwards automatically.

use pathfinder::Group;
let list = [(0, 0), (10, 10), (15, 15)];
let groups = Group::from_list(&list);
assert_eq!(groups.len(), 3);

Links together two groups.

use pathfinder::{Coordinate, Group, Location};
let b: Group = Group::new("B", Coordinate::new(100, 100));
let mut a: Group = Group::new("A", Coordinate::new(0, 0));
a.link(&b);

Trait Implementations

impl Hash for Group
[src]

impl Find for Group
[src]

fn find<H: Hash>(&self, hash: H) -> Option<Coordinate>
[src]

Recursively calls find as the group contains sets of Nodes.

impl MinMax for Group
[src]

impl Location for Group
[src]

fn eq<L: Location>(&self, other: &L) -> bool
[src]

Returns if the positions are equal or not.

fn x(&self) -> i16
[src]

Retrieves the X coordinate.

fn y(&self) -> i16
[src]

Retrieves the Y coordinate.

fn sum(&self) -> i16
[src]

Returns the sum of the x and y value.

impl Draw for Group
[src]

fn draw<S: Shape>(&self, image: IW, offset: Coordinate, shape: &S) -> IW
[src]

Draws the Nodes inside that Group. If none the Group is draw as blank.

impl Clone for Group
[src]

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

Performs copy-assignment from source. Read more

impl From<Group> for Node
[src]

impl From<Coordinate> for Group
[src]

impl From<Node> for Group
[src]

impl From<Group> for Coordinate
[src]

impl Debug for Group
[src]

Auto Trait Implementations

impl Send for Group

impl Sync for Group

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.