SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit
|
10 #ifndef smtk_view_PhraseModel_h
11 #define smtk_view_PhraseModel_h
13 #include "smtk/CoreExports.h"
17 #include "smtk/common/Deprecation.h"
18 #include "smtk/common/ThreadPool.h"
19 #include "smtk/common/TypeContainer.h"
22 #include "smtk/view/BadgeSet.h"
23 #include "smtk/view/PhraseContent.h"
24 #include "smtk/view/PhraseModelObserver.h"
25 #include "smtk/view/Selection.h"
27 #include "smtk/resource/Manager.h"
28 #include "smtk/resource/Resource.h"
30 #include "smtk/operation/Manager.h"
31 #include "smtk/operation/Operation.h"
36 #include <unordered_map>
45 typedef std::unordered_map<
48 std::weak_ptr<smtk::view::DescriptivePhrase>,
49 std::owner_less<std::weak_ptr<smtk::view::DescriptivePhrase>>>>
56 bool operator()(
const std::vector<int>& a,
const std::vector<int>& b)
const
58 if (a.size() < b.size())
62 else if (a.size() > b.size())
127 using OperationPtr = smtk::operation::Operation::Ptr;
144 static std::multimap<std::string, std::string> configureFilterStrings(
163 virtual bool resetSources();
182 virtual void updateChildren(
185 const std::vector<int>& idx);
188 virtual void triggerDataChanged();
195 const Observers& observers()
const {
return m_observers; }
224 BadgeSet& badges() {
return m_badges; }
233 PhraseModel(
const Configuration* config, Manager* manager);
253 handleOperationEvent(
const Operation& op,
operation::EventType e,
const Operation::Result& res);
264 virtual void processResource(
265 const std::shared_ptr<smtk::resource::Resource>& resource,
273 void removeChildren(
const std::vector<int>& parentIdx,
int childRange[2]);
298 virtual void redecorate();
310 virtual void trigger(
313 const std::vector<int>& src,
314 const std::vector<int>& dst,
315 const std::vector<int>& refs);
336 smtk::operation::Observers::Key m_operHandle;
340 [[deprecated(
"PhraseModel::Source::Source now accepts managers held in a const "
346 smtk::operation::Observers::Key&& oh,
349 std::list<Source> m_sources;
351 UUIDsToPhrasesMap m_objectMap;
363 bool m_updatingChildren =
false;
367 std::atomic<bool> m_pending{
false };
Observers & observers()
Return the observers associated with this phrase model.
Definition: PhraseModel.h:194
The main namespace for the Simulation Modeling Tool Kit (SMTK).
Definition: doc.h:33
const BadgeSet & badges() const
Return the badges that may apply to phrases in this model.
Definition: PhraseModel.h:223
Definition: Observers.h:106
std::function< bool(const smtk::resource::ManagerPtr &, const smtk::operation::ManagerPtr &, const smtk::view::ManagerPtr &, const smtk::view::SelectionPtr &)> SourceVisitor
Subclasses (and others) may wish to invoke functions on the sources of data for the phrases.
Definition: PhraseModel.h:116
A container for the badges that apply to a view.
Definition: BadgeSet.h:32
smtk::shared_ptr< smtk::view::Selection > SelectionPtr
Definition: PublicPointerDefs.h:641
A view Manager is responsible for creating new views (eventually) as well as view components such as ...
Definition: Manager.h:43
Definition: PhraseModel.h:332
smtk::shared_ptr< smtk::attribute::ComponentItem > ComponentItemPtr
Definition: PublicPointerDefs.h:546
PhraseModelEvent
Events that can be observed on an smtk::view::PhraseModel.
Definition: PhraseModelObserver.h:26
void setMutableAspects(int mutableAspects)
Set what aspects of top-level phrases should be user-editable.
Definition: PhraseModel.h:210
ManagerPtr manager() const
PhraseModels that are managed have a non-null pointer to their manager.
Definition: PhraseModel.h:219
An Observer is a functor that is called when certain actions are performed.
Definition: Observers.h:66
std::vector< smtk::view::DescriptivePhrasePtr > DescriptivePhrases
Definition: PublicPointerDefs.h:631
smtk::common::Observers< PhraseModelObserver > PhraseModelObservers
A class for holding PhraseModelObserver functors that observe phrase model events.
Definition: PhraseModelObserver.h:47
int mutableAspects() const
Get what aspects of top-level phrases should be user-editable.
Definition: PhraseModel.h:216
EventType
Enumerate events that the resource manager may encounter.
Definition: Observer.h:23
#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
Visit
Return values common to most visitor methods.
Definition: Visit.h:23
smtk::shared_ptr< smtk::operation::Manager > ManagerPtr
Definition: PublicPointerDefs.h:355
smtk::shared_ptr< smtk::view::Manager > ManagerPtr
Definition: PublicPointerDefs.h:633
const UUIDsToPhrasesMap & uuidPhraseMap() const
Return the map between persistent object IDs and Descriptive Phrases.
Definition: PhraseModel.h:227
Definition: PhraseModel.h:83
std::function< void(DescriptivePhrasePtr, PhraseModelEvent, const std::vector< int > &, const std::vector< int > &, const std::vector< int > &)> PhraseModelObserver
Events that alter the phrase model trigger callbacks of this type.
Definition: PhraseModelObserver.h:44
PhraseModelObserver Observer
Events that alter the phrase model trigger callbacks of this type.
Definition: PhraseModel.h:105
Hold and maintain a descriptive phrase hierarchy.
Definition: PhraseModel.h:101
Operation is a base class for all SMTK operations.
Definition: Operation.h:61
@ EVERYTHING
Every aspect of the phrase content.
Definition: PhraseContent.h:54
Configure a view, specifying types and attributes, without specifying a UI library.
Definition: Configuration.h:28
smtk::weak_ptr< smtk::view::Manager > WeakManagerPtr
Definition: PublicPointerDefs.h:635
smtk::shared_ptr< smtk::view::SubphraseGenerator > SubphraseGeneratorPtr
Definition: PublicPointerDefs.h:645
std::function< smtk::common::Visit(const smtk::resource::ManagerPtr &, const smtk::operation::ManagerPtr &, const smtk::view::ManagerPtr &, const smtk::view::SelectionPtr &)> SourceVisitorFunction
Subclasses (and others) may wish to invoke functions on the sources of data for the phrases.
Definition: PhraseModel.h:124
virtual void handleResourceEvent(const Resource &, smtk::resource::EventType)
A method called when a resource manager adds or removes a resource.
Definition: PhraseModel.h:243
An abstract base class for SMTK resources.
Definition: Resource.h:72
std::set< smtk::resource::PersistentObjectPtr > PersistentObjectSet
Definition: PublicPointerDefs.h:298
smtk::shared_ptr< smtk::view::DescriptivePhrase > DescriptivePhrasePtr
Definition: PublicPointerDefs.h:627
int Priority
A value to indicate the relative order in which an observer should be called.
Definition: Observers.h:73
Macros for dealing with shared-pointer classes.
#define smtkTypeMacroBase(...)
Add typedefs to a class for identifcation.
Definition: SharedFromThis.h:131
EventType
Enumerate events that an operation may encounter.
Definition: Observer.h:30
Definition: PhraseModel.h:54
smtk::shared_ptr< smtk::resource::Manager > ManagerPtr
Definition: PublicPointerDefs.h:288
smtk::shared_ptr< smtk::resource::Component > ComponentPtr
Definition: PublicPointerDefs.h:304
std::function< void(smtk::view::DescriptivePhrasePtr)> PhraseDecorator
Applications may have a model decorate its phrases by providing a method with this signature.
Definition: PhraseModel.h:109
A container for caching and retrieving instances of types.
Definition: TypeContainer.h:42