Inviwo 0.9.12-pre
Inviwo documentation
Loading...
Searching...
No Matches
inviwo::BrushingAndLinkingManager Class Reference

#include <brushingandlinkingmanager.h>

+ Inheritance diagram for inviwo::BrushingAndLinkingManager:

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< BrushingTargetgetModifiedTargets () const
 
const std::unordered_map< BrushingTarget, BrushingModifications > & getModified () 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 BitSetgetIndices (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< BrushingTargetgetTargets (BrushingAction action) const
 
const BitSetgetFilteredIndices (BrushingTarget target=BrushingTarget::Row) const
 
const BitSetgetSelectedIndices (BrushingTarget target=BrushingTarget::Row) const
 
const BitSetgetHighlightedIndices (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< BrushingTargetAnyBrushingTarget
 Helper for invalidation level initialization.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ BrushingAndLinkingManager() [1/2]

inviwo::BrushingAndLinkingManager::BrushingAndLinkingManager ( BrushingAndLinkingInport * inport,
std::vector< BrushingTargetsInvalidationLevel > invalidationLevels = { {AnyBrushingTarget, BrushingModifications(flags::any), InvalidationLevel::InvalidOutput}} )
// Only invalidate processor on row filtering and column selection.
{
{{BrushingTarget::Row}, BrushingModification::Filtered, InvalidationLevel::InvalidOutput},
{{BrushingTarget::Column}, BrushingModification::Selected,
InvalidationLevel::InvalidOutput}
}
);
// Invalidate processor on filtering or selection for any target.
{
{AnyBrushingTarget, BrushingModification::Filtered | BrushingModification::Selected,
InvalidationLevel::InvalidOutput}
}
);
BrushingAndLinkingManager(BrushingAndLinkingInport *inport, std::vector< BrushingTargetsInvalidationLevel > invalidationLevels={ {AnyBrushingTarget, BrushingModifications(flags::any), InvalidationLevel::InvalidOutput}})
static const std::vector< BrushingTarget > AnyBrushingTarget
Helper for invalidation level initialization.
Definition brushingandlinkingmanager.h:103
Parameters
inportowner of the manager.
invalidationLevelsfor 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).

◆ BrushingAndLinkingManager() [2/2]

inviwo::BrushingAndLinkingManager::BrushingAndLinkingManager ( BrushingAndLinkingOutport * outport,
std::vector< BrushingTargetsInvalidationLevel > invalidationLevels = { {AnyBrushingTarget, BrushingModifications(flags::any), InvalidationLevel::InvalidOutput}} )
// Only invalidate processor on row filtering and column selection.
{
{{BrushingTarget::Row}, BrushingModification::Filtered, InvalidationLevel::InvalidOutput},
{{BrushingTarget::Column}, BrushingModification::Selected,
InvalidationLevel::InvalidOutput}
}
);
// Invalidate processor on filtering or selection for any target.
{
{AnyBrushingTarget, BrushingModification::Filtered | BrushingModification::Selected,
InvalidationLevel::InvalidOutput}
}
);
Parameters
outportowner of the manager.
invalidationLevelsfor 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).

Member Function Documentation

◆ brush()

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.

  • filter action A filters 1-5
  • filter action B filters 3-6 This results in indices {7, 8, 9, 10} remaining. If then action A is updated to filter out indices 2-4, the overall result for filtering should be {1, 7, ..., 10}. Without different sources it would not be possible to update the result accordingly.
Parameters
actiontype of brushing action
targettarget of the action, determines which brushing and linking state to update
indicesset of selected/filtered indices
sourcemust be provided if action is equal to BrushingAction::Filter
Exceptions
Exceptionif action is BrushingAction::Filter and no source is given
See also
BrushingAction

◆ clearIndices()

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.

Exceptions
Exceptionif action is equal to BrushingAction::Filter since this may lead to an inconsistent state

◆ clearModifications()

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.

◆ contains()

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

◆ deserialize()

virtual void inviwo::BrushingAndLinkingManager::deserialize ( Deserializer & d)
overridevirtual

Implements inviwo::Serializable.

◆ getIndices()

const BitSet & inviwo::BrushingAndLinkingManager::getIndices ( BrushingAction action,
BrushingTarget target = BrushingTarget::Row ) const

access indices for the given combination of action and target

Parameters
actiontype of brushing action
targettarget of the action
Returns
bitset corresponding to action and target
Exceptions
Exceptionif target does not exist for action
See also
hasIndices

◆ getInvalidationLevel()

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.

See also
setInvalidationLevels, getInvalidationLevels

◆ getInvalidationLevels()

const std::vector< BrushingTargetsInvalidationLevel > & inviwo::BrushingAndLinkingManager::getInvalidationLevels ( ) const

Returns the targets and their actions causing the owner (BrusingAndLinking port) to invalidate.

◆ getModified()

const std::unordered_map< BrushingTarget, BrushingModifications > & inviwo::BrushingAndLinkingManager::getModified ( ) const

return which targets were changed by action since the last network evaluation

◆ getModifiedActions()

BrushingModifications inviwo::BrushingAndLinkingManager::getModifiedActions ( ) const

return which actions were performed since the last network evaluation

◆ getModifiedTargets()

std::vector< BrushingTarget > inviwo::BrushingAndLinkingManager::getModifiedTargets ( ) const

return which targets were changed since the last network evaluation

◆ hasIndices()

bool inviwo::BrushingAndLinkingManager::hasIndices ( BrushingAction action,
BrushingTarget target = BrushingTarget::Row ) const

check whether the manager has an index set for target and action

Parameters
actiontype of brushing action
targettarget of the action
Returns
true if indices exist

◆ isFiltered()

bool inviwo::BrushingAndLinkingManager::isFiltered ( uint32_t idx,
BrushingTarget target = BrushingTarget::Row ) const

convenience function for contains(idx, BrushingAction::Filter, target)

See also
contains

◆ isFilteringModified()

bool inviwo::BrushingAndLinkingManager::isFilteringModified ( BrushingTarget target = BrushingTarget::Row) const

return whether there was a filter action on target since the last network evaluation

Returns
isTargetModified(target, BrushingModification::Filtered)

◆ isHighlighted()

bool inviwo::BrushingAndLinkingManager::isHighlighted ( uint32_t idx,
BrushingTarget target = BrushingTarget::Row ) const

convenience function for contains(idx, BrushingAction::Highlight, target)

See also
contains

◆ isHighlightModified()

bool inviwo::BrushingAndLinkingManager::isHighlightModified ( BrushingTarget target = BrushingTarget::Row) const

return whether there was a highlight action on target since the last network evaluation

Returns
isTargetModified(target, BrushingModification::Highlighted)

◆ isModified()

bool inviwo::BrushingAndLinkingManager::isModified ( ) const

check if the state of the manager was changed since the last network evaluation

Returns
true if there have been recent changes
See also
getModifiedActions

◆ isSelected()

bool inviwo::BrushingAndLinkingManager::isSelected ( uint32_t idx,
BrushingTarget target = BrushingTarget::Row ) const

convenience function for contains(idx, BrushingAction::Select, target)

See also
contains

◆ isSelectionModified()

bool inviwo::BrushingAndLinkingManager::isSelectionModified ( BrushingTarget target = BrushingTarget::Row) const

return whether there was a select action on target since the last network evaluation

Returns
isTargetModified(target, BrushingModification::Selected)

◆ isTargetModified() [1/2]

bool inviwo::BrushingAndLinkingManager::isTargetModified ( BrushingTarget target,
BrushingAction action ) const

return whether target was modified by action since the last network evaluation

◆ isTargetModified() [2/2]

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

◆ onBrush()

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.

Remarks
{Only one callback can be registered at the same time.}
Parameters
callbackgets called with the same arguments as brush()
See also
brush(BrushingAction, BrushingTarget, const BitSet&, std::string_view)

◆ propagateModifications()

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.

See also
getInvalidationLevel

◆ serialize()

virtual void inviwo::BrushingAndLinkingManager::serialize ( Serializer & s) const
overridevirtual

Implements inviwo::Serializable.

◆ setInvalidationLevels()

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.

// Only invalidate processor on row filtering and column selection.
{
{{BrushingTarget::Row}, BrushingModification::Filtered, InvalidationLevel::InvalidOutput},
{{BrushingTarget::Column}, BrushingModification::Selected,
InvalidationLevel::InvalidOutput}
}
);
// Invalidate processor on filtering or selection for any target.
{
{AnyBrushingTarget, BrushingModification::Filtered | BrushingModification::Selected,
InvalidationLevel::InvalidOutput}
}
);
void setInvalidationLevels(std::vector< BrushingTargetsInvalidationLevel > invalidationLevels)

◆ setParent()

void inviwo::BrushingAndLinkingManager::setParent ( BrushingAndLinkingManager * parent)

register a parent manager for the propagation of brushing actions

Member Data Documentation

◆ AnyBrushingTarget

const std::vector<BrushingTarget> inviwo::BrushingAndLinkingManager::AnyBrushingTarget
inlinestatic
Initial value:
=
{}

Helper for invalidation level initialization.


The documentation for this class was generated from the following file: