Salome HOME
Hotfix to make source compilable under linux.
[modules/shaper.git] / src / Model / Model_Application.cpp
index 40704967e8de9cef5e8a568dac24330bd0fc5f37..df32ef977d7c599acfbb7dbadc23c99492533fb7 100644 (file)
@@ -19,13 +19,19 @@ Handle(Model_Application) Model_Application::getApplication()
 }
 
 //=======================================================================
-const std::shared_ptr<Model_Document>& Model_Application::getDocument(string theDocID)
+const boost::shared_ptr<Model_Document>& Model_Application::getDocument(string theDocID)
 {
   if (myDocs.find(theDocID) != myDocs.end())
     return myDocs[theDocID];
 
-  std::shared_ptr<Model_Document> aNew(new Model_Document(theDocID));
+  boost::shared_ptr<Model_Document> 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()
 {