SHAPER  9.12.0
Model_Update.h
1 // Copyright (C) 2014-2023 CEA, EDF
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 #ifndef Model_Update_H_
21 #define Model_Update_H_
22 
23 #include "Model.h"
24 #include <ModelAPI_Data.h>
25 #include "Events_Listener.h"
26 #include <memory>
27 #include <set>
28 #include <map>
29 
30 class ModelAPI_Object;
31 class ModelAPI_Feature;
33 class Model_Objects;
34 
40 {
43  std::map<std::shared_ptr<ModelAPI_Feature>, std::set<std::shared_ptr<ModelAPI_Feature> > >
44  myModified;
48  std::map<std::shared_ptr<ModelAPI_Feature>, std::set<std::shared_ptr<ModelAPI_Feature> > >
49  myNotPersistentRefs;
51  std::set<std::shared_ptr<ModelAPI_Feature> > myWaitForFinish;
53  bool myIsParamUpdated;
55  bool myIsFinish;
57  bool myIsProcessed;
60  std::map<std::shared_ptr<ModelAPI_Feature>, std::set<std::shared_ptr<ModelAPI_Feature> > >
61  myProcessOnFinish;
63  std::map<std::shared_ptr<ModelAPI_Feature>, int > myProcessed;
65  bool myIsPreviewBlocked;
67  bool myUpdateBlocked;
68 
69  public:
71  Model_Update();
72 
74  MODEL_EXPORT virtual void processEvent(const std::shared_ptr<Events_Message>& theMessage);
75 
76 protected:
81  bool addModified(
82  std::shared_ptr<ModelAPI_Feature> theFeature, std::shared_ptr<ModelAPI_Feature> theReason);
83 
86  bool processFeature(std::shared_ptr<ModelAPI_Feature> theFeature);
87 
90  void updateArguments(std::shared_ptr<ModelAPI_Feature> theFeature);
91 
93  void redisplayWithResults(std::shared_ptr<ModelAPI_Feature> theFeature,
94  const ModelAPI_ExecState theState, bool theUpdateState = true);
95 
98  void processFeatures(const bool theFlushRedisplay = true);
99 
102  void executeFeature(std::shared_ptr<ModelAPI_Feature> theFeature);
103 
105  void updateStability(void* theSender);
106 
109  bool isReason(
110  std::shared_ptr<ModelAPI_Feature>& theFeature, std::shared_ptr<ModelAPI_Object> theReason);
111 
114  void updateSelection(const std::set<std::shared_ptr<ModelAPI_Object> >& theObjects);
115 
116 };
117 
118 #endif
Base interface for any event listener.
Definition: Events_Listener.h:37
Feature that consists of other features: like sketcher with edges inside.
Definition: ModelAPI_CompositeFeature.h:33
Feature function that represents the particular functionality of this operation.
Definition: ModelAPI_Feature.h:39
Represents any object in the data model and in the object browser.
Definition: ModelAPI_Object.h:45
Manager of objects of the document.
Definition: Model_Objects.h:46
Updates the results of features when it is needed.
Definition: Model_Update.h:40
Model_Update()
Is called only once, on startup of the application.
Definition: Model_Update.cpp:58
void updateSelection(const std::set< std::shared_ptr< ModelAPI_Object > > &theObjects)
Updates a selection attributes for the features that possible were affected by creation or reorder of...
Definition: Model_Update.cpp:1078
void redisplayWithResults(std::shared_ptr< ModelAPI_Feature > theFeature, const ModelAPI_ExecState theState, bool theUpdateState=true)
Sends the redisplay events for feature and results, updates the updated status.
Definition: Model_Update.cpp:752
bool isReason(std::shared_ptr< ModelAPI_Feature > &theFeature, std::shared_ptr< ModelAPI_Object > theReason)
Returns true if theFeature modification was caused by theReason (may be feature of result of this fea...
Definition: Model_Update.cpp:958
virtual void processEvent(const std::shared_ptr< Events_Message > &theMessage)
Processes the feature argument update: executes the results.
Definition: Model_Update.cpp:233
bool addModified(std::shared_ptr< ModelAPI_Feature > theFeature, std::shared_ptr< ModelAPI_Feature > theReason)
Appends the new modified feature to the myModified, clears myProcessed if needed Returns true if some...
Definition: Model_Update.cpp:94
bool processFeature(std::shared_ptr< ModelAPI_Feature > theFeature)
Recoursively checks and updates features if needed (calls the execute method) Returns true if feature...
Definition: Model_Update.cpp:521
void processFeatures(const bool theFlushRedisplay=true)
On operation start/end/abort the "Just" fileds must be cleared and processed in the right way.
Definition: Model_Update.cpp:452
void updateStability(void *theSender)
Updates the properties of object because of stability state changes.
Definition: Model_Update.cpp:1024
void executeFeature(std::shared_ptr< ModelAPI_Feature > theFeature)
Performs the feature execution.
Definition: Model_Update.cpp:993
void updateArguments(std::shared_ptr< ModelAPI_Feature > theFeature)
Updates the selection and parametrical arguments before the later feature analysis Returns true if so...
Definition: Model_Update.cpp:795