Class PathObjectHierarchyEvent
java.lang.Object
qupath.lib.objects.hierarchy.events.PathObjectHierarchyEvent
An event class for passing on information about modifications to a PathObjectHierarchy.
- Author:
- Pete Bankhead
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Enum representing different ways in which the hierarchy may have been updated. -
Method Summary
Modifier and TypeMethodDescriptionstatic PathObjectHierarchyEvent
createObjectAddedEvent
(Object source, PathObjectHierarchy hierarchy, PathObject parentObject, PathObject pathObjectAdded) Create a hierarchy event indicated objects were added.static PathObjectHierarchyEvent
createObjectRemovedEvent
(Object source, PathObjectHierarchy hierarchy, PathObject parentObject, PathObject pathObjectRemoved) Create a hierarchy event indicating objects were removed.static PathObjectHierarchyEvent
createObjectsChangedEvent
(Object source, PathObjectHierarchy hierarchy, PathObjectHierarchyEvent.HierarchyEventType type, Collection<? extends PathObject> pathObjects, boolean isChanging) Create a hierarchy event indicating objects have changed in a way consistent with the specified event type.static PathObjectHierarchyEvent
createStructureChangeEvent
(Object source, PathObjectHierarchy hierarchy, PathObject parentObject) Create a hierarchy event indicating that the hierarchy structure has been changed.The objects that were affected by whichever changes were made.Get the hierarchy event type.The hierarchy to which this event refers.Get the source that triggered the event.If this is a structure change event, return the base object, i.e.boolean
Returns true if objects have been added or removed from the hierarchy.boolean
Returns true if changes are still being made, so more events will be fired.boolean
Returns true if the event indicates that object classifications have changed.boolean
Returns true if the event indicates that object measurements have changed.boolean
Returns true if the hierarchy structure has changed, e.g.toString()
-
Method Details
-
toString
-
createStructureChangeEvent
public static PathObjectHierarchyEvent createStructureChangeEvent(Object source, PathObjectHierarchy hierarchy, PathObject parentObject) Create a hierarchy event indicating that the hierarchy structure has been changed.- Parameters:
source
-hierarchy
-parentObject
-- Returns:
-
createObjectAddedEvent
public static PathObjectHierarchyEvent createObjectAddedEvent(Object source, PathObjectHierarchy hierarchy, PathObject parentObject, PathObject pathObjectAdded) Create a hierarchy event indicated objects were added.- Parameters:
source
-hierarchy
-parentObject
-pathObjectAdded
-- Returns:
-
createObjectRemovedEvent
public static PathObjectHierarchyEvent createObjectRemovedEvent(Object source, PathObjectHierarchy hierarchy, PathObject parentObject, PathObject pathObjectRemoved) Create a hierarchy event indicating objects were removed.- Parameters:
source
-hierarchy
-parentObject
-pathObjectRemoved
-- Returns:
-
createObjectsChangedEvent
public static PathObjectHierarchyEvent createObjectsChangedEvent(Object source, PathObjectHierarchy hierarchy, PathObjectHierarchyEvent.HierarchyEventType type, Collection<? extends PathObject> pathObjects, boolean isChanging) Create a hierarchy event indicating objects have changed in a way consistent with the specified event type.- Parameters:
source
-hierarchy
-type
-pathObjects
-isChanging
-- Returns:
-
isChanging
public boolean isChanging()Returns true if changes are still being made, so more events will be fired. This enables listeners to postpone expensive operations that could be called often until this flag is false.- Returns:
-
getHierarchy
The hierarchy to which this event refers.- Returns:
-
getChangedObjects
The objects that were affected by whichever changes were made.- Returns:
-
getEventType
Get the hierarchy event type.- Returns:
-
getSource
Get the source that triggered the event.- Returns:
-
isStructureChangeEvent
public boolean isStructureChangeEvent()Returns true if the hierarchy structure has changed, e.g. with objects added or removed- Returns:
-
isAddedOrRemovedEvent
public boolean isAddedOrRemovedEvent()Returns true if objects have been added or removed from the hierarchy.- Returns:
-
isObjectClassificationEvent
public boolean isObjectClassificationEvent()Returns true if the event indicates that object classifications have changed.- Returns:
-
isObjectMeasurementEvent
public boolean isObjectMeasurementEvent()Returns true if the event indicates that object measurements have changed.- Returns:
-
getStructureChangeBase
If this is a structure change event, return the base object, i.e. below which the structure differs from previously. In the case that an object was added or removed, this will return the parent of the added/removed object. For more thorough changes, the root object is returned.For events that do not correspond to structural changes, this returns null.
- Returns:
-