[][src]Trait broccoli::query::draw::DrawQuery

pub trait DrawQuery<'a>: Queries<'a> {
    pub fn draw_divider(
        &self,
        line: impl FnMut(AxisDyn, &Node<'_, Self::T>, &Rect<Self::Num>, usize),
        rect: Rect<Self::Num>
    ) { ... } }

Draw functions that can be called on a tree.

Provided methods

pub fn draw_divider(
    &self,
    line: impl FnMut(AxisDyn, &Node<'_, Self::T>, &Rect<Self::Num>, usize),
    rect: Rect<Self::Num>
)
[src]

Examples

use broccoli::{prelude::*,bbox,rect};
use axgeom::Rect;

let dim=rect(0,100,0,100);
let mut bots =[rect(0,10,0,10)];
let tree=broccoli::new(&mut bots);

let mut rects=Vec::new();
tree.draw_divider(
    |axis,node,rect,_|
    {
        if !node.range.is_empty(){    
            rects.push(
                axis.map_val(
                    Rect {x: node.cont.into(),y: rect.y.into()},
                    Rect {x: rect.x.into(),y: node.cont.into()}
                )   
            );
        }
    },
    dim
);

//rects now contains a bunch of rectangles that can be drawn to visualize
//where all the dividers are and how thick they each are.
Loading content...

Implementors

impl<'a, T: Aabb> DrawQuery<'a> for Tree<'a, T>[src]

Loading content...