X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModel%2FModel_Application.cpp;h=df32ef977d7c599acfbb7dbadc23c99492533fb7;hb=afaf6f0d254de478da37f984674a71e296cb3404;hp=40704967e8de9cef5e8a568dac24330bd0fc5f37;hpb=912b947536177180af5bd6d620d84e9ebc05be66;p=modules%2Fshaper.git diff --git a/src/Model/Model_Application.cpp b/src/Model/Model_Application.cpp index 40704967e..df32ef977 100644 --- a/src/Model/Model_Application.cpp +++ b/src/Model/Model_Application.cpp @@ -19,13 +19,19 @@ Handle(Model_Application) Model_Application::getApplication() } //======================================================================= -const std::shared_ptr& Model_Application::getDocument(string theDocID) +const boost::shared_ptr& Model_Application::getDocument(string theDocID) { if (myDocs.find(theDocID) != myDocs.end()) return myDocs[theDocID]; - std::shared_ptr aNew(new Model_Document(theDocID)); + boost::shared_ptr aNew(new Model_Document(theDocID)); myDocs[theDocID] = aNew; + // 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 + } + return myDocs[theDocID]; } @@ -40,6 +46,18 @@ bool Model_Application::hasDocument(std::string theDocID) return myDocs.find(theDocID) != myDocs.end(); } +//======================================================================= +void Model_Application::setLoadPath(std::string thePath) +{ + myPath = thePath; +} + +//======================================================================= +void Model_Application::setLoadByDemand(std::string theID) +{ + myLoadedByDemand.insert(theID); +} + //======================================================================= Model_Application::Model_Application() {