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 /// Recoursively checks and updates the feature if needed (calls the execute method)
45 /// Returns true if feature was updated.
46 bool updateFeature(std::shared_ptr<ModelAPI_Feature> theFeature);
48 /// Recoursively checks and updates the object (result or feature) if needed (calls updateFeature)
49 /// Returns true if object was updated.
50 bool updateObject(std::shared_ptr<ModelAPI_Object> theObject, const bool theCyclic = true);
51 /// Sends the redisplay events for feature and results, updates the updated status
52 void redisplayWithResults(std::shared_ptr<ModelAPI_Feature> theFeature,
53 const ModelAPI_ExecState theState);