pub struct LayoutEngine { /* private fields */ }Expand description
Layout engine for managing component placement on a schematic.
Implementations§
Source§impl LayoutEngine
impl LayoutEngine
Sourcepub fn set_sheet_bounds(&mut self, bounds: CoordRect)
pub fn set_sheet_bounds(&mut self, bounds: CoordRect)
Set the sheet bounds.
Sourcepub fn set_component_spacing(&mut self, spacing: Coord)
pub fn set_component_spacing(&mut self, spacing: Coord)
Set minimum component spacing.
Sourcepub fn clear_cache(&mut self)
pub fn clear_cache(&mut self)
Clear cached bounds.
Sourcepub fn calculate_component_bounds(
&self,
component: &SchComponent,
primitives: &[SchRecord],
component_index: usize,
) -> CoordRect
pub fn calculate_component_bounds( &self, component: &SchComponent, primitives: &[SchRecord], component_index: usize, ) -> CoordRect
Calculate the bounding box for a component and its child primitives.
Sourcepub fn get_placed_components(
&self,
primitives: &[SchRecord],
) -> Vec<PlacedComponent>
pub fn get_placed_components( &self, primitives: &[SchRecord], ) -> Vec<PlacedComponent>
Get placed components from primitives.
Sourcepub fn check_collision(
&self,
rect: CoordRect,
primitives: &[SchRecord],
exclude_index: Option<usize>,
) -> bool
pub fn check_collision( &self, rect: CoordRect, primitives: &[SchRecord], exclude_index: Option<usize>, ) -> bool
Check if a rectangle collides with any existing component.
Sourcepub fn suggest_placement(
&self,
component_bounds: CoordRect,
primitives: &[SchRecord],
near_component: Option<&str>,
) -> Vec<PlacementSuggestion>
pub fn suggest_placement( &self, component_bounds: CoordRect, primitives: &[SchRecord], near_component: Option<&str>, ) -> Vec<PlacementSuggestion>
Find placement suggestions for a component with given bounds.
Sourcepub fn find_best_position(
&self,
component_bounds: CoordRect,
primitives: &[SchRecord],
) -> Option<CoordPoint>
pub fn find_best_position( &self, component_bounds: CoordRect, primitives: &[SchRecord], ) -> Option<CoordPoint>
Find the best position for a new component.
Sourcepub fn snap_to_grid(&self, point: CoordPoint) -> CoordPoint
pub fn snap_to_grid(&self, point: CoordPoint) -> CoordPoint
Align components to grid.
Sourcepub fn is_on_grid(&self, point: CoordPoint) -> bool
pub fn is_on_grid(&self, point: CoordPoint) -> bool
Check if a point is on the grid.
Sourcepub fn get_all_bounds(&self, primitives: &[SchRecord]) -> Vec<CoordRect>
pub fn get_all_bounds(&self, primitives: &[SchRecord]) -> Vec<CoordRect>
Get all component bounds as rectangles for collision detection.
Sourcepub fn local_to_absolute(
&self,
local: CoordPoint,
component_location: CoordPoint,
orientation: Orientation,
) -> CoordPoint
pub fn local_to_absolute( &self, local: CoordPoint, component_location: CoordPoint, orientation: Orientation, ) -> CoordPoint
Transform a point from component-local to absolute coordinates.
Sourcepub fn absolute_to_local(
&self,
absolute: CoordPoint,
component_location: CoordPoint,
orientation: Orientation,
) -> CoordPoint
pub fn absolute_to_local( &self, absolute: CoordPoint, component_location: CoordPoint, orientation: Orientation, ) -> CoordPoint
Transform a point from absolute to component-local coordinates.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LayoutEngine
impl RefUnwindSafe for LayoutEngine
impl Send for LayoutEngine
impl Sync for LayoutEngine
impl Unpin for LayoutEngine
impl UnwindSafe for LayoutEngine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more