From 59d1fb7d2e01dbe3fef0247ea45afaa5ce92b029 Mon Sep 17 00:00:00 2001 From: mpv Date: Thu, 20 Aug 2015 17:46:31 +0300 Subject: [PATCH] Stabilization of the process of activization of part: when document is loaded, it must be immediately appeared in the result part. --- src/Model/Model_Data.cpp | 3 +-- src/Model/Model_ResultPart.cpp | 9 ++++++++- src/Model/Model_ResultPart.h | 1 + 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Model/Model_Data.cpp b/src/Model/Model_Data.cpp index aeb1489c4..45779f4c8 100644 --- a/src/Model/Model_Data.cpp +++ b/src/Model/Model_Data.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -400,8 +401,6 @@ void Model_Data::updateConcealmentFlag() } } -#include - std::set set_union(const std::set& theLeft, const std::set& theRight) { diff --git a/src/Model/Model_ResultPart.cpp b/src/Model/Model_ResultPart.cpp index 12361eb33..c01d714f4 100644 --- a/src/Model/Model_ResultPart.cpp +++ b/src/Model/Model_ResultPart.cpp @@ -41,12 +41,17 @@ std::shared_ptr Model_ResultPart::partDoc() if (myTrsf.get()) { return baseRef()->partDoc(); } - return data()->document("PartDocument")->value(); + DocumentPtr aRes = data()->document(DOC_REF())->value(); + if (!aRes.get() && myIsInLoad) { // trying to get this document from the session + aRes = document()->subDocument(data()->name()); + } + return aRes; } Model_ResultPart::Model_ResultPart() { myIsDisabled = true; // by default it is not initialized and false to be after created + myIsInLoad = false; setIsConcealed(false); } @@ -60,7 +65,9 @@ void Model_ResultPart::activate() std::shared_ptr aDocRef = data()->document(DOC_REF()); if (!aDocRef->value().get()) { // create (or open) a document if it is not yet created + myIsInLoad = true; std::shared_ptr aDoc = document()->subDocument(data()->name()); + myIsInLoad = false; if (aDoc) { aDocRef->setValue(aDoc); } diff --git a/src/Model/Model_ResultPart.h b/src/Model/Model_ResultPart.h index b4a147bc9..f53ac5e85 100644 --- a/src/Model/Model_ResultPart.h +++ b/src/Model/Model_ResultPart.h @@ -23,6 +23,7 @@ class Model_ResultPart : public ModelAPI_ResultPart { TopoDS_Shape myShape; ///< shape of this part created from bodies (updated only of Part deactivation) std::shared_ptr myTrsf; ///< if it is just copy of original shape, keep just transformation + bool myIsInLoad; ///< true if document of this part is in the loading process, so, it may be already received public: /// the reference to the base result document, may be null if this is the root, others make sequence of references -- 2.30.2