[][src]Struct pizarra::storage::Storage

pub struct Storage { /* fields omitted */ }

This struct handles storage and fast retrieval of shapes.

Implementations

impl Storage[src]

A storage struct that organizes shapes by their zoom level and allows for fast queries given a zoom and a bbox.

pub fn new() -> Storage[src]

pub fn nex_id(&mut self) -> ShapeId[src]

pub fn next_z_index(&mut self) -> usize[src]

pub fn add(&mut self, shape: Box<dyn ShapeTrait>) -> ShapeId[src]

Adds a new shape to the storage

pub fn restore(&mut self, shape: Shape) -> ShapeId[src]

Restores a deleted shape

pub fn flush(&mut self) -> Option<ShapeId>[src]

moves the last inserted shape to persistent storage. It will no longer be accesible through .last_mut()

pub fn remove(&mut self, id: ShapeId) -> Option<Shape>[src]

Deletes a shape from this storage given its id if such id exists

pub fn query_circle(&self, center: Point, radius: f64) -> Option<ShapeId>[src]

Returns the id of a shape intersecting the circle described by center and radius, if any.

pub fn last_mut(&mut self) -> Option<&mut Shape>[src]

gets a mutable reference to the last inserted shape for modifying

pub fn shape_count(&self) -> usize[src]

Returns the number of shapes in this storage

pub fn draw_commands(&self, bbox: [Point; 2]) -> Vec<DrawCommand>[src]

gets all the draw commands necessary to paint the portion of the screen indicated by bbox. Commands are cached to improve the performance of continuously drawing on the same portion of the screen

pub fn draw_commands_for_current_shape(&self) -> Option<DrawCommand>[src]

Returns the draw commands corresponding to the shape being edited, if any

pub fn get_bounds(&self) -> Option<[Point; 2]>[src]

Gets the bounding box that surrounds every shape drawn or returns None if there are no shapes

impl Storage[src]

pub fn from_svg(svg: &str) -> Result<Storage, Error>[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.