SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
smtk::view::AvailableOperations Class Reference

Maintain a list of operations that may be applied to a selection. More...

#include <AvailableOperations.h>

Inheritance diagram for smtk::view::AvailableOperations:
[legend]
Collaboration diagram for smtk::view::AvailableOperations:
[legend]

Public Types

using Index = smtk::operation::Operation::Index
 
using Observer = std::function< void(AvailableOperations::Ptr)>
 
using Observers = smtk::common::Observers< Observer >
 
using OperationManager = smtk::operation::ManagerPtr
 
using OperationIndexSet = std::set< Index >
 
using OperationIndexArray = std::vector< Index >
 
using OperationFilterSort = smtk::workflow::OperationFilterSortPtr
 
using Data = smtk::workflow::OperationFilterSort::Data
 

Public Member Functions

 smtkTypeMacroBase (smtk::view::AvailableOperations)
 
 smtkCreateMacro (AvailableOperations)
 
SelectionPtr selection () const
 The selection for which we should list applicable operations.
 
void setSelection (SelectionPtr seln)
 Set the selection for which we should list applicable operations.
 
bool useSelection () const
 Return whether or not the selection should be considered when listing operations. More...
 
void setUseSelection (bool useSeln)
 Set whether the selection should be considered when listing operations.
 
smtk::operation::ManagerPtr operationManager () const
 The operator manager from which we draw candidate operations.
 
void setOperationManager (smtk::operation::ManagerPtr mgr)
 Set the operator manager from which we draw candidate operations.
 
OperationFilterSort workflowFilter () const
 Return an object maintained by the workflow that filters and sorts candidate operations.
 
void setWorkflowFilter (OperationFilterSort wf)
 
Observersobservers ()
 Return the observers notified when the availableOperations() array changes.
 
const Observersobservers () const
 
void operationMetadataChanged (const smtk::operation::Metadata &operMeta, bool adding)
 Called when operations are registered/unregistered from the operation manager.
 
void selectionModified (const std::string &src, SelectionPtr seln)
 Called when the selection is modified; computes a new list of operations.
 
void workflowFilterModified ()
 Called when the workflow filter settings change.
 
OperationIndexSet & workingSet ()
 Return the intermediate working set of available but unfiltered operations.
 
OperationIndexSet workingSet () const
 
OperationIndexArray & availableOperations ()
 Return the list of operations.
 
OperationIndexArray availableOperations () const
 
const Data * operationData (const Index &opIdx) const
 Return data describing how to present an operation (a convenience from the OperationFilterSort).
 

Static Public Member Functions

static void workingSet (smtk::operation::ManagerPtr operationsIn, smtk::view::SelectionPtr selectionIn, int selectionMaskIn, bool exactSelectionIn, OperationIndexSet &workingSet)
 Core functionality of the class as a static method to find operations that apply to a selection. More...
 
static void availableOperations (const OperationIndexSet &workingSetIn, OperationFilterSort filterIn, OperationIndexArray &out)
 Core functionality of the class as a static method to filter operations for presentation:
 

Protected Member Functions

void computeFromSelection ()
 When the selection or operation manager signal changes, update both the working set and final output.
 
void computeFromWorkingSet ()
 When the workflow signals a change, use the existing working set to compute a new final output.
 

Protected Attributes

OperationManager m_operationManager
 
smtk::operation::MetadataObservers::Key m_operationManagerObserverId
 
SelectionPtr m_selection
 
SelectionObservers::Key m_selectionObserverId
 
int m_selectionMask { 1 }
 
bool m_selectionExact { true }
 
bool m_useSelection { true }
 
OperationFilterSort m_workflowFilter
 
smtk::workflow::OperationFilterSort::Observers::Key m_workflowFilterObserverId
 
OperationIndexSet m_workingSet
 
OperationIndexArray m_available
 
Observers m_observers
 

Detailed Description

Maintain a list of operations that may be applied to a selection.

Member Function Documentation

◆ useSelection()

bool smtk::view::AvailableOperations::useSelection ( ) const
inline

Return whether or not the selection should be considered when listing operations.

The default is true. If false, then all operations that the workflow filter chooses to expose will be listed as available. Otherwise, only the subset which may be directly applied to the current selection are listed as available.

◆ workingSet()

void AvailableOperations::workingSet ( smtk::operation::ManagerPtr  operationsIn,
smtk::view::SelectionPtr  selectionIn,
int  selectionMaskIn,
bool  exactSelectionIn,
OperationIndexSet &  workingSet 
)
static

Core functionality of the class as a static method to find operations that apply to a selection.

Note that it is valid to pass a null pointer to selectionIn. In this case, all operations in the manager are returned.


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