Class PathObjectSelectionModel

java.lang.Object
qupath.lib.objects.hierarchy.events.PathObjectSelectionModel

public class PathObjectSelectionModel extends Object
Model for handling selection of single and multiple PathObjects.
Author:
Pete Bankhead
See Also:
  • Constructor Details

    • PathObjectSelectionModel

      public PathObjectSelectionModel()
  • Method Details

    • setSelectedObjects

      public void setSelectedObjects(Collection<? extends PathObject> pathObjects, PathObject primarySelectedObject)
      Specify a collection of objects to be selected, and which among them should be the primary.

      Any previous selection is reset.

      Parameters:
      pathObjects -
      primarySelectedObject -
    • getSelectedObjects

      public Set<PathObject> getSelectedObjects()
      Get an unmodifiable set containing all the currently-selected objects.
      Returns:
    • noSelection

      public boolean noSelection()
      Returns true if no objects are selected.
      Returns:
    • singleSelection

      public boolean singleSelection()
      Returns true if only one object has been selected, accessible by getSelectedObject();
      Returns:
    • setSelectedObject

      public void setSelectedObject(PathObject pathObject, boolean addToSelection)
      Select the specified object to be the primary selected object, optionally retaining the existing selected objects.
      Parameters:
      pathObject -
      addToSelection - add to the existing selection, rather than allowing only the specified object to be selected
      See Also:
    • deselectObject

      public void deselectObject(PathObject pathObject)
      Ensure that the specified object is removed from the selection.
      Parameters:
      pathObject -
    • deselectObjects

      public void deselectObjects(Collection<? extends PathObject> pathObjects)
      Ensure the specified objects are deselected.

      The selection state of other objects will not be modified.

      Parameters:
      pathObjects -
    • selectObjects

      public void selectObjects(Collection<? extends PathObject> pathObjects)
      Ensure the specified objects are selected.

      The selection state of other objects will not be modified.

      Parameters:
      pathObjects -
    • setSelectedObject

      public void setSelectedObject(PathObject pathObject)
      Set the specified object to be selected, deselecting all others.
      Parameters:
      pathObject -
    • getSelectedObject

      public PathObject getSelectedObject()
      Get the current primary selected object.
      Returns:
    • isSelected

      public boolean isSelected(PathObject pathObject)
      Query whether a specific object is selected.
      Parameters:
      pathObject -
      Returns:
    • getSelectedROI

      public ROI getSelectedROI()
      Get the ROI of the selected object, if available, or null
      Returns:
    • clearSelection

      public void clearSelection()
      Clear selection so that no objects are selected.
    • addPathObjectSelectionListener

      public void addPathObjectSelectionListener(PathObjectSelectionListener listener)
      Add listener for selection changes.
      Parameters:
      listener -
    • removePathObjectSelectionListener

      public void removePathObjectSelectionListener(PathObjectSelectionListener listener)
      Remove listener for selection changes.
      Parameters:
      listener -