GroupManager

Struct GroupManager 

Source
pub struct GroupManager { /* private fields */ }
Expand description

Group manager for handling group operations

Implementations§

Source§

impl GroupManager

Source

pub fn new() -> Self

Create a new group manager

Source

pub fn create_group( &mut self, group_id: GroupId, members: HashSet<NodeId>, ) -> Result<()>

Create a new group with the given members

Source

pub fn get_group(&self, group_id: &GroupId) -> Option<&Group>

Get a group by ID

Source

pub fn get_group_mut(&mut self, group_id: &GroupId) -> Option<&mut Group>

Get a mutable reference to a group by ID

Source

pub fn get_node_group(&self, node_id: &NodeId) -> Option<&GroupId>

Get the group ID for a node

Source

pub fn dissolve_group(&mut self, group_id: &GroupId) -> Result<HashSet<NodeId>>

Dissolve a group and return its members

Source

pub fn all_groups(&self) -> &HashMap<GroupId, Group>

Get all groups

Source

pub fn node_mappings(&self) -> &HashMap<NodeId, GroupId>

Get all node-to-group mappings

Source

pub fn add_node_to_group( &mut self, group_id: &GroupId, node_id: NodeId, ) -> Result<()>

Add a node to an existing group

Source

pub fn remove_node_from_group( &mut self, group_id: &GroupId, node_id: &NodeId, ) -> Result<()>

Remove a node from a group

Source

pub fn set_group_name( &mut self, group_id: &GroupId, name: Option<String>, ) -> Result<()>

Set the name of a group

Source

pub fn calculate_group_bounds<N, E>( &mut self, group_id: &GroupId, graph: &Graph<N, E>, ) -> Result<()>
where N: Clone, E: Clone,

Calculate the bounding rectangle for a group based on its member positions

Source

pub fn update_group_bounds<N, E>( &mut self, group_id: &GroupId, graph: &Graph<N, E>, ) -> Result<()>
where N: Clone, E: Clone,

Update group bounds based on current member positions

Source

pub fn group_ids(&self) -> Vec<GroupId>

Get all group IDs

Source

pub fn has_group(&self, group_id: &GroupId) -> bool

Check if a group exists

Source

pub fn group_count(&self) -> usize

Get the number of groups

Source

pub fn is_node_grouped(&self, node_id: &NodeId) -> bool

Check if a node is in any group

Source

pub fn start_group_drag<N, E>( &mut self, group_id: &GroupId, start_position: Position, graph: &Graph<N, E>, ) -> Result<()>
where N: Clone, E: Clone,

Start a group drag operation

Source

pub fn update_group_drag<N, E>( &mut self, new_position: Position, graph: &mut Graph<N, E>, ) -> Result<Position>
where N: Clone, E: Clone,

Update group drag position

Source

pub fn complete_group_drag(&mut self) -> Result<GroupId>

Complete group drag operation

Source

pub fn cancel_group_drag<N, E>( &mut self, graph: &mut Graph<N, E>, ) -> Result<GroupId>
where N: Clone, E: Clone,

Cancel group drag operation and restore original positions

Source

pub fn is_group_dragging(&self) -> bool

Check if a group is currently being dragged

Source

pub fn get_dragging_group(&self) -> Option<&GroupId>

Get the current dragging group ID (if any)

Source

pub fn get_drag_delta(&self) -> Option<Position>

Get the current drag delta (if any)

Source

pub fn has_active_drag(&self) -> bool

Check if there’s an active drag operation

Source

pub fn move_group<N, E>( &mut self, group_id: &GroupId, delta: Position, graph: &mut Graph<N, E>, ) -> Result<()>
where N: Clone,

Move a group by the given delta

Trait Implementations§

Source§

impl Clone for GroupManager

Source§

fn clone(&self) -> GroupManager

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GroupManager

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.