1 // File: Model_Update.hxx
2 // Created: 25 Jun 2014
3 // Author: Mikhail PONIKAROV
5 #ifndef Model_Update_H_
6 #define Model_Update_H_
9 #include <ModelAPI_Data.h>
10 #include "Events_Listener.h"
15 class ModelAPI_Object;
16 class ModelAPI_Feature;
18 /**\class Model_Update
20 * \brief Updates the results of features when it is needed.
22 class Model_Update : public Events_Listener
24 /// initial set of updated features that must be processed
25 std::set<std::shared_ptr<ModelAPI_Object> > myInitial;
26 /// already updated and processed features and modificated feature flag
27 std::map<std::shared_ptr<ModelAPI_Object>, bool> myUpdated;
28 /// to know that all next updates are caused by this execution
30 /// to know execute or not automatically all update
32 /// just created features: they must be updated immideately even in not-automatic mode for
33 /// preview; cleared on commit operations
34 std::set<std::shared_ptr<ModelAPI_Object> > myJustCreatedOrUpdated;
37 /// Is called only once, on startup of the application
40 /// Processes the feature argument update: executes the results
41 MODEL_EXPORT virtual void processEvent(const std::shared_ptr<Events_Message>& theMessage);
44 /// updates all features in the document and then - in sub-documents
45 void updateInDoc(std::shared_ptr<ModelAPI_Document> theDoc);
46 /// Recoursively checks and updates the feature if needed (calls the execute method)
47 /// Returns true if feature was updated.
48 bool updateFeature(std::shared_ptr<ModelAPI_Feature> theFeature);
50 /// Recoursively checks and updates the object (result or feature) if needed (calls updateFeature)
51 /// Returns true if object was updated.
52 bool updateObject(std::shared_ptr<ModelAPI_Object> theObject, const bool theCyclic = true);
53 /// Sends the redisplay events for feature and results, updates the updated status
54 void redisplayWithResults(std::shared_ptr<ModelAPI_Feature> theFeature,
55 const ModelAPI_ExecState theState);