Class SelectionManager

java.lang.Object
com.j3d.engine.interact.selection.SelectionManager

public class SelectionManager extends Object
Manages the selection of GObjects within a collection of Layers and Things. Provides functionality to filter and retrieve selected objects based on various criteria.
Author:
Lehlogonolo Poole
See Also:
  • Field Details

  • Constructor Details

    • SelectionManager

      public SelectionManager(ArrayList<Layer> objects, SelectionQuery selectionQuery)
      Constructs a SelectionManager and initializes the selection based on the provided layers and a Selection object.
      Parameters:
      objects - An ArrayList of Layer objects to iterate through for potential selections.
      selectionQuery - A Selection object defining the criteria for initial selection.
    • SelectionManager

      public SelectionManager()
      Constructs an empty SelectionManager with no selected GObjects.
  • Method Details

    • isNothingSelected

      public boolean isNothingSelected()
      Checks if no GObjects are currently selected.
      Returns:
      true if no GObjects are selected, false otherwise.
    • include

      public SelectionManager include(SelectionManager other)
      Includes the selected GObjects from another SelectionManager into this one.

      Typically used when the SelectionType is SelectionType.INCLUDE.

      Parameters:
      other - The other SelectionManager whose selected GObjects are to be included.
      Returns:
      This SelectionManager instance, allowing for method chaining.
    • exclude

      public SelectionManager exclude(SelectionManager other)
      Excludes the selected GObjects from another SelectionManager from this one.

      Typically used when the SelectionType is SelectionType.EXCLUDE.

      Parameters:
      other - The other SelectionManager whose selected GObjects are to be excluded.
      Returns:
      This SelectionManager instance, allowing for method chaining.
    • filter

      public SelectionManager filter(Predicate<GObject> predicate)
      Filters the currently selected GObjects based on a given predicate.
      Parameters:
      predicate - The predicate to apply for filtering. Objects for which the predicate returns true will be removed.
      Returns:
      This SelectionManager instance, allowing for method chaining.
    • getSelected

      public HashSet<GObject> getSelected()
      Returns the currently selected GObjects.
      Returns:
      An ArrayList of GObjects that are currently selected.
    • clear

      public void clear()