SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit
|
10 #ifndef smtk_view_AvailableOperations_h
11 #define smtk_view_AvailableOperations_h
13 #include "smtk/CoreExports.h"
17 #include "smtk/common/Observers.h"
19 #include "smtk/workflow/OperationFilterSort.h"
21 #include "smtk/operation/Manager.h"
22 #include "smtk/operation/MetadataObserver.h"
24 #include "smtk/resource/Component.h"
26 #include "smtk/view/SelectionObserver.h"
42 using Index = smtk::operation::Operation::Index;
43 using Observer = std::function<void(AvailableOperations::Ptr)>;
47 using OperationIndexSet = std::set<Index>;
48 using OperationIndexArray = std::vector<Index>;
51 using Data = smtk::workflow::OperationFilterSort::Data;
68 void setUseSelection(
bool useSeln);
77 void setWorkflowFilter(OperationFilterSort wf);
81 const Observers& observers()
const {
return m_observers; }
86 void selectionModified(
const std::string& src,
SelectionPtr seln);
88 void workflowFilterModified();
92 OperationIndexSet workingSet()
const {
return m_workingSet; }
96 OperationIndexArray availableOperations()
const {
return m_available; }
99 const Data* operationData(
const Index& opIdx)
const;
106 static void workingSet(
110 bool exactSelectionIn,
111 OperationIndexSet& workingSet);
114 static void availableOperations(
115 const OperationIndexSet& workingSetIn,
116 OperationFilterSort filterIn,
117 OperationIndexArray& out);
120 AvailableOperations();
123 void computeFromSelection();
125 void computeFromWorkingSet();
127 OperationManager m_operationManager;
130 SelectionObservers::Key m_selectionObserverId;
131 int m_selectionMask{ 1 };
132 bool m_selectionExact{
true };
133 bool m_useSelection{
true };
134 OperationFilterSort m_workflowFilter;
135 smtk::workflow::OperationFilterSort::Observers::Key m_workflowFilterObserverId;
136 OperationIndexSet m_workingSet;
137 OperationIndexArray m_available;
The main namespace for the Simulation Modeling Tool Kit (SMTK).
Definition: doc.h:33
SelectionPtr selection() const
The selection for which we should list applicable operations.
Definition: AvailableOperations.h:55
Definition: Observers.h:106
OperationIndexSet & workingSet()
Return the intermediate working set of available but unfiltered operations.
Definition: AvailableOperations.h:91
smtk::shared_ptr< smtk::view::Selection > SelectionPtr
Definition: PublicPointerDefs.h:641
smtk::shared_ptr< smtk::workflow::OperationFilterSort > OperationFilterSortPtr
Definition: PublicPointerDefs.h:667
#define smtkCreateMacro(...)
Add static create() methods to a class.
Definition: SharedFromThis.h:173
#define smtkEnableSharedPtr(...)
An abbreviation for enabling shared pointers.
Definition: SharedFromThis.h:214
smtk::common::Observers< Observer > Observers
Operation observers are a specialization of the common SMTK observer pattern.
Definition: Observer.h:45
Observers & observers()
Return the observers notified when the availableOperations() array changes.
Definition: AvailableOperations.h:80
bool useSelection() const
Return whether or not the selection should be considered when listing operations.
Definition: AvailableOperations.h:66
smtk::shared_ptr< smtk::operation::Manager > ManagerPtr
Definition: PublicPointerDefs.h:355
Maintain a list of operations that may be applied to a selection.
Definition: AvailableOperations.h:37
OperationIndexArray & availableOperations()
Return the list of operations.
Definition: AvailableOperations.h:95
smtk::operation::ManagerPtr operationManager() const
The operator manager from which we draw candidate operations.
Definition: AvailableOperations.h:71
Macros for dealing with shared-pointer classes.
#define smtkTypeMacroBase(...)
Add typedefs to a class for identifcation.
Definition: SharedFromThis.h:131
OperationFilterSort workflowFilter() const
Return an object maintained by the workflow that filters and sorts candidate operations.
Definition: AvailableOperations.h:76