Inviwo 0.9.12-pre
Inviwo documentation
|
#include <brushingandlinkingmanager.h>
Public Member Functions | |
BrushingAndLinkingManager (BrushingAndLinkingInport *inport, std::vector< BrushingTargetsInvalidationLevel > invalidationLevels={ {AnyBrushingTarget, BrushingModifications(flags::any), InvalidationLevel::InvalidOutput}}) | |
BrushingAndLinkingManager (BrushingAndLinkingOutport *outport, std::vector< BrushingTargetsInvalidationLevel > invalidationLevels={ {AnyBrushingTarget, BrushingModifications(flags::any), InvalidationLevel::InvalidOutput}}) | |
void | brush (BrushingAction action, BrushingTarget target, const BitSet &indices, std::string_view source={}) |
void | filter (const BitSet &idx, BrushingTarget target, std::string_view source) |
convenience function for brush(BrushingAction::Filter, target, idx, source) | |
void | select (const BitSet &idx, BrushingTarget target=BrushingTarget::Row) |
convenience function for brush(BrushingAction::Select, target, idx) | |
void | highlight (const BitSet &idx, BrushingTarget target=BrushingTarget::Row) |
convenience function for brush(BrushingAction::Highlight, target, idx) | |
bool | isModified () const |
BrushingModifications | getModifiedActions () const |
bool | isFilteringModified (BrushingTarget target=BrushingTarget::Row) const |
bool | isSelectionModified (BrushingTarget target=BrushingTarget::Row) const |
bool | isHighlightModified (BrushingTarget target=BrushingTarget::Row) const |
std::vector< BrushingTarget > | getModifiedTargets () const |
bool | isTargetModified (BrushingTarget target, BrushingModifications modifications=BrushingModifications(flags::any)) const |
bool | isTargetModified (BrushingTarget target, BrushingAction action) const |
bool | hasIndices (BrushingAction action, BrushingTarget target=BrushingTarget::Row) const |
const BitSet & | getIndices (BrushingAction action, BrushingTarget target=BrushingTarget::Row) const |
size_t | getNumber (BrushingAction action, BrushingTarget target=BrushingTarget::Row) const |
convenience function for getIndices(action, target).size() | |
size_t | getNumberOfFiltered (BrushingTarget target=BrushingTarget::Row) const |
convenience function for getIndices(BrushingAction::Filter, target).size() | |
size_t | getNumberOfSelected (BrushingTarget target=BrushingTarget::Row) const |
convenience function for getIndices(BrushingAction::Select, target).size() | |
size_t | getNumberOfHighlighted (BrushingTarget target=BrushingTarget::Row) const |
convenience function for getIndices(BrushingAction::Highlight, target).size() | |
uint32_t | getMax (std::span< const BrushingAction > actions=BrushingActions, BrushingTarget target=BrushingTarget::Row) const |
uint32_t | getMin (std::span< const BrushingAction > actions=BrushingActions, BrushingTarget target=BrushingTarget::Row) const |
void | clearIndices (BrushingAction action, BrushingTarget target) |
void | clearFiltered () |
void | clearSelected (BrushingTarget target=BrushingTarget::Row) |
convenience function for clearIndices(BrushingAction::Select, target) | |
void | clearHighlighted (BrushingTarget target=BrushingTarget::Row) |
convenience function for clearIndices(BrushingAction::Highlight, target) | |
bool | contains (uint32_t idx, BrushingAction action, BrushingTarget target=BrushingTarget::Row) const |
bool | isFiltered (uint32_t idx, BrushingTarget target=BrushingTarget::Row) const |
bool | isSelected (uint32_t idx, BrushingTarget target=BrushingTarget::Row) const |
bool | isHighlighted (uint32_t idx, BrushingTarget target=BrushingTarget::Row) const |
std::vector< std::pair< BrushingAction, std::vector< BrushingTarget > > > | getTargets () const |
std::vector< BrushingTarget > | getTargets (BrushingAction action) const |
const BitSet & | getFilteredIndices (BrushingTarget target=BrushingTarget::Row) const |
const BitSet & | getSelectedIndices (BrushingTarget target=BrushingTarget::Row) const |
const BitSet & | getHighlightedIndices (BrushingTarget target=BrushingTarget::Row) const |
void | setParent (BrushingAndLinkingManager *parent) |
void | onBrush (std::function< void(BrushingAction, BrushingTarget, const BitSet &, std::string_view)> callback) |
InvalidationLevel | getInvalidationLevel () const |
const std::vector< BrushingTargetsInvalidationLevel > & | getInvalidationLevels () const |
void | setInvalidationLevels (std::vector< BrushingTargetsInvalidationLevel > invalidationLevels) |
void | propagateModifications () |
void | clearModifications () |
virtual void | serialize (Serializer &s) const override |
virtual void | deserialize (Deserializer &d) override |
Public Member Functions inherited from inviwo::Serializable |
Static Public Attributes | |
static const std::vector< BrushingTarget > | AnyBrushingTarget |
Helper for invalidation level initialization. | |
Manages brushing and linking events for filtering, selecting, and highlighting. When initialized with a BrushingAndLinking inport, changes are propagated using this port if connected.
Use setInvalidationLevels if you only want Processor::process to be called for a subset of brushing targets or actions. Use getModifiedActions if you want to know which BrushingModifications caused a Processor::process call.
inviwo::BrushingAndLinkingManager::BrushingAndLinkingManager | ( | BrushingAndLinkingInport * | inport, |
std::vector< BrushingTargetsInvalidationLevel > | invalidationLevels = { {AnyBrushingTarget, BrushingModifications(flags::any), InvalidationLevel::InvalidOutput}} ) |
inport | owner of the manager. |
invalidationLevels | for brushing targets and actions that should invalidate the port (Processor::process will be called for those). Defaults to InvalidOutput for all targets (row, column) and all actions (filtering/selection/highlight). |
inviwo::BrushingAndLinkingManager::BrushingAndLinkingManager | ( | BrushingAndLinkingOutport * | outport, |
std::vector< BrushingTargetsInvalidationLevel > | invalidationLevels = { {AnyBrushingTarget, BrushingModifications(flags::any), InvalidationLevel::InvalidOutput}} ) |
outport | owner of the manager. |
invalidationLevels | for brushing targets and actions that should invalidate the port (Processor::process will be called for those). Defaults to InvalidOutput for all targets (row, column) and all actions (filtering/selection/highlight). |
void inviwo::BrushingAndLinkingManager::brush | ( | BrushingAction | action, |
BrushingTarget | target, | ||
const BitSet & | indices, | ||
std::string_view | source = {} ) |
Based on action
update the internal selection with the given indices
. For target
matching BrushingAction::Select or BrushingAction::Highlight, the indices will replace the previous selection.
In case of BrushingAction::Filter, a source
must be provided. The indices are subsequently marked as removed. Note that multiple filter actions might overlap hence the need for a source.
For example, given indices {1, ..., 10} and two filter actions.
action | type of brushing action |
target | target of the action, determines which brushing and linking state to update |
indices | set of selected/filtered indices |
source | must be provided if action is equal to BrushingAction::Filter |
Exception | if action is BrushingAction::Filter and no source is given |
void inviwo::BrushingAndLinkingManager::clearIndices | ( | BrushingAction | action, |
BrushingTarget | target ) |
clear the selection for action
and target
. action
must be different from BrushingAction::Filter. Does nothing if target
does not exist.
Exception | if action is equal to BrushingAction::Filter since this may lead to an inconsistent state |
void inviwo::BrushingAndLinkingManager::clearModifications | ( | ) |
resets the modification state. Should only be called by the brushing and linking ports after the process() function has been called.
bool inviwo::BrushingAndLinkingManager::contains | ( | uint32_t | idx, |
BrushingAction | action, | ||
BrushingTarget | target = BrushingTarget::Row ) const |
check whether the selection for action
and target
contains index idx
|
overridevirtual |
Implements inviwo::Serializable.
const BitSet & inviwo::BrushingAndLinkingManager::getIndices | ( | BrushingAction | action, |
BrushingTarget | target = BrushingTarget::Row ) const |
access indices for the given combination of action
and target
action | type of brushing action |
target | target of the action |
action
and target
Exception | if target does not exist for action |
InvalidationLevel inviwo::BrushingAndLinkingManager::getInvalidationLevel | ( | ) | const |
Returns the highest InvalidationLevel for the currently modified targets and actions, or Valid if no matching target/action was found.
const std::vector< BrushingTargetsInvalidationLevel > & inviwo::BrushingAndLinkingManager::getInvalidationLevels | ( | ) | const |
Returns the targets and their actions causing the owner (BrusingAndLinking port) to invalidate.
BrushingModifications inviwo::BrushingAndLinkingManager::getModifiedActions | ( | ) | const |
return which actions were performed since the last network evaluation
std::vector< BrushingTarget > inviwo::BrushingAndLinkingManager::getModifiedTargets | ( | ) | const |
return which targets were changed since the last network evaluation
bool inviwo::BrushingAndLinkingManager::hasIndices | ( | BrushingAction | action, |
BrushingTarget | target = BrushingTarget::Row ) const |
check whether the manager has an index set for target
and action
action | type of brushing action |
target | target of the action |
bool inviwo::BrushingAndLinkingManager::isFiltered | ( | uint32_t | idx, |
BrushingTarget | target = BrushingTarget::Row ) const |
convenience function for contains(idx, BrushingAction::Filter, target)
bool inviwo::BrushingAndLinkingManager::isFilteringModified | ( | BrushingTarget | target = BrushingTarget::Row | ) | const |
return whether there was a filter action on target
since the last network evaluation
bool inviwo::BrushingAndLinkingManager::isHighlighted | ( | uint32_t | idx, |
BrushingTarget | target = BrushingTarget::Row ) const |
convenience function for contains(idx, BrushingAction::Highlight, target)
bool inviwo::BrushingAndLinkingManager::isHighlightModified | ( | BrushingTarget | target = BrushingTarget::Row | ) | const |
return whether there was a highlight action on target
since the last network evaluation
bool inviwo::BrushingAndLinkingManager::isModified | ( | ) | const |
check if the state of the manager was changed since the last network evaluation
bool inviwo::BrushingAndLinkingManager::isSelected | ( | uint32_t | idx, |
BrushingTarget | target = BrushingTarget::Row ) const |
convenience function for contains(idx, BrushingAction::Select, target)
bool inviwo::BrushingAndLinkingManager::isSelectionModified | ( | BrushingTarget | target = BrushingTarget::Row | ) | const |
return whether there was a select action on target
since the last network evaluation
bool inviwo::BrushingAndLinkingManager::isTargetModified | ( | BrushingTarget | target, |
BrushingAction | action ) const |
return whether target
was modified by action
since the last network evaluation
bool inviwo::BrushingAndLinkingManager::isTargetModified | ( | BrushingTarget | target, |
BrushingModifications | modifications = BrushingModifications(flags::any) ) const |
return whether target
was modified by any of modifications
since the last network evaluation
void inviwo::BrushingAndLinkingManager::onBrush | ( | std::function< void(BrushingAction, BrushingTarget, const BitSet &, std::string_view)> | callback | ) |
Add a callback
to the manager that gets called when a brushing action is triggered.
callback | gets called with the same arguments as brush() |
void inviwo::BrushingAndLinkingManager::propagateModifications | ( | ) |
propagates the modified state to all child managers. Needs to be called by the brushing and linking ports before the invalidation level is queried.
|
overridevirtual |
Implements inviwo::Serializable.
void inviwo::BrushingAndLinkingManager::setInvalidationLevels | ( | std::vector< BrushingTargetsInvalidationLevel > | invalidationLevels | ) |
Set the types of brushing targets and actions that should invalidate the owner (BrushingAndLinking port). Enables processors to only handle certain types of row/column targets and filter/selection/highlight actions.
void inviwo::BrushingAndLinkingManager::setParent | ( | BrushingAndLinkingManager * | parent | ) |
register a parent manager for the propagation of brushing actions
|
inlinestatic |
Helper for invalidation level initialization.