class ModelAPI_Object;
class ModelAPI_Feature;
class ModelAPI_CompositeFeature;
+class Model_Objects;
/**\class Model_Update
* \ingroup DataModel
*/
class Model_Update : public Events_Listener
{
- /// updated features during this transaction: must be updated immediately
- std::set<std::shared_ptr<ModelAPI_Object> > myJustUpdated;
+ /// Features and results that were modified and not yet processed.
+ /// The second set is the objects that causes this object is modified
+ std::map<std::shared_ptr<ModelAPI_Feature>, std::set<std::shared_ptr<ModelAPI_Feature> > >
+ myModified;
+ /// Features which arguments were modified by not-persistent changes.
+ /// So, these referencing arguments must be updated
+ /// due to these features info also before execution).
+ std::map<std::shared_ptr<ModelAPI_Feature>, std::set<std::shared_ptr<ModelAPI_Feature> > >
+ myNotPersistentRefs;
/// features that must be additionally processed after execution of finish operation
- std::set<std::shared_ptr<ModelAPI_Object> > myWaitForFinish;
- /// to know that all next updates are caused by this execution
- bool myIsExecuted;
- /// to know execute or not automatically all update
- bool myIsAutomatic;
- /// to know that some parameter was changed during this operation
+ std::set<std::shared_ptr<ModelAPI_Feature> > myWaitForFinish;
+ /// to know that some parameter was changed during this operation (to enable update expressions)
bool myIsParamUpdated;
- /// to execute features of finish if perview is not needed
+ /// to execute features on finish if preview is needed only on finish operation
bool myIsFinish;
- /// Set of already processed features in the "processOperation" method
- std::set<std::shared_ptr<ModelAPI_Feature> > myProcessed;
-
- /// internal structure that contains the updating iteration information:
- /// which object and subobject is iterated, t ocontinue iteration
- struct IterationItem {
- /// the main object, subs of it are iterated
- std::shared_ptr<ModelAPI_CompositeFeature> myMain;
- /// the currently iterated sub-object
- std::shared_ptr<ModelAPI_Feature> mySub;
- };
- /// List of iterated features: composite feature to the currently iterated sub.
- /// The first element in the list has no "main": the root document is not feature.
- std::list<IterationItem> myProcessIterator;
+ /// try if processing is currently performed
+ bool myIsProcessed;
+ /// set that contains features that must be executed only on finish of the operation
+ std::set<std::shared_ptr<ModelAPI_Feature> > myProcessOnFinish;
+ /// to avoid infinitive cycling: feature -> count of the processing periods during this update
+ std::map<std::shared_ptr<ModelAPI_Feature>, int > myProcessed;
+ /// if preview in hte property panel is blocked and
+ /// any update is postponed until the end of operation
+ bool myIsPreviewBlocked;
public:
/// Is called only once, on startup of the application
MODEL_EXPORT virtual void processEvent(const std::shared_ptr<Events_Message>& theMessage);
protected:
- /// Recoursively checks and updates the feature if needed (calls the execute method)
+ /// Appends the new modified feature to the myModified, clears myProcessed if needed
+ /// Returns true if some feature really was marked as modified
+ /// theReason is the object that causes modification of this feature
+ /// returns true if something reallsy was added to the modified and must be processed
+ bool addModified(
+ std::shared_ptr<ModelAPI_Feature> theFeature, std::shared_ptr<ModelAPI_Feature> theReason);
+
+ /// Recoursively checks and updates features if needed (calls the execute method)
/// Returns true if feature was updated.
- void updateFeature(std::shared_ptr<ModelAPI_Feature> theFeature);
+ bool processFeature(std::shared_ptr<ModelAPI_Feature> theFeature);
/// Updates the selection and parametrical arguments before the later feature analysis
/// Returns true if something really was updated
const ModelAPI_ExecState theState);
/// On operation start/end/abort the "Just" fileds must be cleared and processed in the right way
- /// \param theTotalUpdate force to updates everything that has been changed in this operation
- void processOperation(const bool theTotalUpdate, const bool theFinish = false);
+ //! \param theFlushRedisplay a boolean value if the redisplay signal should be flushed
+ void processFeatures(const bool theFlushRedisplay = true);
/// Performs the feature execution
/// \returns the status of execution
void executeFeature(std::shared_ptr<ModelAPI_Feature> theFeature);
- /// Iterates and updates features from theFeature by managing myProcessIterator.
- /// Returns only after the iteration is finished.
- /// \param theFeature is null for iteration of root document (which is not composite)
- /// \returns false if this feature should not be updated: iteration was moved much upper
- bool iterateUpdate(std::shared_ptr<ModelAPI_CompositeFeature> theFeature);
+ /// Updates the properties of object because of stability state changes
+ void updateStability(void* theSender);
+
+ /// Returns true if theFeature modification was caused by theReason
+ /// (may be feature of result of this feature)
+ bool isReason(
+ std::shared_ptr<ModelAPI_Feature>& theFeature, std::shared_ptr<ModelAPI_Object> theReason);
+
+ /// Updates a selection attributes for the features that possible were affected by creation
+ /// or reorder of features upper in the history line (issue #1757)
+ void updateSelection(const std::set<std::shared_ptr<ModelAPI_Object> >& theObjects);
+
};
#endif