[−][src]Struct pizarra::storage::Storage
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]
Auto Trait Implementations
impl !RefUnwindSafe for Storage
[src]
impl !Send for Storage
[src]
impl !Sync for Storage
[src]
impl Unpin for Storage
[src]
impl !UnwindSafe for Storage
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,