From: jfa Date: Mon, 18 Dec 2023 18:14:04 +0000 (+0000) Subject: [bos #39269] Do not integrate this commit, it is just to test performance. X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d1c940a92aa84be87f6250ac241d13009d9108a6;p=modules%2Fshaper.git [bos #39269] Do not integrate this commit, it is just to test performance. --- diff --git a/src/Model/Model_Document.cpp b/src/Model/Model_Document.cpp index 5f8b9fe53..b3406a4bc 100644 --- a/src/Model/Model_Document.cpp +++ b/src/Model/Model_Document.cpp @@ -1660,6 +1660,11 @@ bool Model_Document::removeFromFolder( return myObjs->removeFromFolder(theFeatures, theBefore); } +void Model_Document::setCreateHistory(const bool isToCreateHistory) +{ + myObjs->myCreateHistory = isToCreateHistory; +} + std::shared_ptr Model_Document::feature( const std::shared_ptr& theResult) { diff --git a/src/Model/Model_Document.h b/src/Model/Model_Document.h index 1dec08f14..f66824e25 100644 --- a/src/Model/Model_Document.h +++ b/src/Model/Model_Document.h @@ -267,6 +267,10 @@ class Model_Document : public ModelAPI_Document const std::list >& theFeatures, const bool theBefore = true); + //! Set create or not history flag (for performance reasons) + //! If flag is false, history in not created and Object Browser will not contain any objects + MODEL_EXPORT virtual void setCreateHistory(const bool isToCreateHistory); + ///! Returns true if parametric updater need to execute feature on recomputation ///! On abort, undo or redo it is not necessary: results in document are updated automatically bool executeFeatures() {return myExecuteFeatures;} diff --git a/src/Model/Model_Objects.cpp b/src/Model/Model_Objects.cpp index ea1c271df..7a0dad95a 100644 --- a/src/Model/Model_Objects.cpp +++ b/src/Model/Model_Objects.cpp @@ -96,7 +96,7 @@ static const int TAG_FEATURE_RESULTS = 2; ///< where the results are located /// 0:1:2:N:1 - data of the feature N /// 0:1:2:N:2:K:1 - data of the K result of the feature N -Model_Objects::Model_Objects(TDF_Label theMainLab) : myMain(theMainLab) +Model_Objects::Model_Objects(TDF_Label theMainLab) : myMain(theMainLab), myCreateHistory(true) { } @@ -452,6 +452,9 @@ void Model_Objects::clearHistory(ObjectPtr theObj) void Model_Objects::createHistory(const std::string& theGroupID) { + if (!myCreateHistory) + return; + std::map >::iterator aHIter = myHistory.find(theGroupID); if (aHIter == myHistory.end()) { std::vector aResult; diff --git a/src/Model/Model_Objects.h b/src/Model/Model_Objects.h index 627d3900e..594eae0da 100644 --- a/src/Model/Model_Objects.h +++ b/src/Model/Model_Objects.h @@ -309,6 +309,9 @@ class Model_Objects /// Each array is updated by demand from scratch, by browsing all the features in the history. std::map > myHistory; + /// Flag to create or not history (for performance reason) + bool myCreateHistory; + friend class Model_Document; friend class Model_Session; friend class Model_Update; diff --git a/src/ModelAPI/ModelAPI_Document.h b/src/ModelAPI/ModelAPI_Document.h index 216ab09f8..e29e11990 100644 --- a/src/ModelAPI/ModelAPI_Document.h +++ b/src/ModelAPI/ModelAPI_Document.h @@ -223,6 +223,10 @@ public: const std::list >& theFeatures, const bool theBefore = true) = 0; + //! Set create or not history flag (for performance reasons) + //! If flag is false, history in not created and Object Browser will not contain any objects + virtual void setCreateHistory(const bool isToCreateHistory) = 0; + //! Informs the document that it becomes active and some actions must be performed virtual void setActive(const bool theFlag) = 0; //! Returns true if this document is currently active