X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModel%2FModel_Application.cpp;h=a825e747104b6482f68a0b14a7bbbbcc4b13d182;hb=6a7e53a3d3b52f1f798b7e3aa3c48de9c870d92b;hp=f8955ce59d5da228b8bd276828f1a1a914f6a964;hpb=a5e05254be62b4bbb070e0b9e1659a6c68b587d7;p=modules%2Fshaper.git diff --git a/src/Model/Model_Application.cpp b/src/Model/Model_Application.cpp index f8955ce59..a825e7471 100644 --- a/src/Model/Model_Application.cpp +++ b/src/Model/Model_Application.cpp @@ -30,19 +30,21 @@ const std::shared_ptr& Model_Application::getDocument(string the static const std::string thePartSetKind("PartSet"); static const std::string thePartKind("Part"); + bool isRoot = theDocID == "root"; // the document is root std::shared_ptr aNew( - new Model_Document(theDocID, theDocID == "root" ? thePartSetKind : thePartKind)); + new Model_Document(theDocID, isRoot ? thePartSetKind : thePartKind)); myDocs[theDocID] = aNew; - Events_ID anId = ModelAPI_DocumentCreatedMessage::eventId(); - std::shared_ptr aMessage = - std::shared_ptr(new ModelAPI_DocumentCreatedMessage(anId, this)); - aMessage->setDocument(aNew); - Events_Loop::loop()->send(aMessage); // load it if it must be loaded by demand if (myLoadedByDemand.find(theDocID) != myLoadedByDemand.end() && !myPath.empty()) { aNew->load(myPath.c_str()); myLoadedByDemand.erase(theDocID); // done, don't do it anymore + } else { + static Events_ID anId = ModelAPI_DocumentCreatedMessage::eventId(); + std::shared_ptr aMessage = std::shared_ptr + (new ModelAPI_DocumentCreatedMessage(anId, this)); + aMessage->setDocument(aNew); + Events_Loop::loop()->send(aMessage); } return myDocs[theDocID];