Class PathObjectSelectionModel
java.lang.Object
qupath.lib.objects.hierarchy.events.PathObjectSelectionModel
Model for handling selection of single and multiple PathObjects.
- Author:
- Pete Bankhead
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add listener for selection changes.void
Clear selection so that no objects are selected.void
deselectObject
(PathObject pathObject) Ensure that the specified object is removed from the selection.void
deselectObjects
(Collection<? extends PathObject> pathObjects) Ensure the specified objects are deselected.Get the current primary selected object.Get an unmodifiable set containing all the currently-selected objects.Get the ROI of the selected object, if available, or nullboolean
isSelected
(PathObject pathObject) Query whether a specific object is selected.boolean
Returns true if no objects are selected.void
Remove listener for selection changes.void
selectObjects
(Collection<? extends PathObject> pathObjects) Ensure the specified objects are selected.void
setSelectedObject
(PathObject pathObject) Set the specified object to be selected, deselecting all others.void
setSelectedObject
(PathObject pathObject, boolean addToSelection) Select the specified object to be the primary selected object, optionally retaining the existing selected objects.void
setSelectedObjects
(Collection<? extends PathObject> pathObjects, PathObject primarySelectedObject) Specify a collection of objects to be selected, and which among them should be the primary.boolean
Returns true if only one object has been selected, accessible by getSelectedObject();
-
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
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
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
Ensure that the specified object is removed from the selection.- Parameters:
pathObject
-
-
deselectObjects
Ensure the specified objects are deselected.The selection state of other objects will not be modified.
- Parameters:
pathObjects
-
-
selectObjects
Ensure the specified objects are selected.The selection state of other objects will not be modified.
- Parameters:
pathObjects
-
-
setSelectedObject
Set the specified object to be selected, deselecting all others.- Parameters:
pathObject
-
-
getSelectedObject
Get the current primary selected object.- Returns:
-
isSelected
Query whether a specific object is selected.- Parameters:
pathObject
-- Returns:
-
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
Add listener for selection changes.- Parameters:
listener
-
-
removePathObjectSelectionListener
Remove listener for selection changes.- Parameters:
listener
-
-