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