X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModel%2FModel_Session.cpp;h=04229f2c2257af2b46404547d8a463d4c23fe384;hb=refs%2Ftags%2FV_1.2.1;hp=9618362e823e60de18874e85d6efd33650ca7035;hpb=7fae04b57c4e7ba6f4e077a1ac8aeddb314b3239;p=modules%2Fshaper.git diff --git a/src/Model/Model_Session.cpp b/src/Model/Model_Session.cpp index 9618362e8..04229f2c2 100644 --- a/src/Model/Model_Session.cpp +++ b/src/Model/Model_Session.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -19,6 +20,7 @@ #include #include #include +#include #include #include @@ -35,7 +37,7 @@ static Model_Session* myImpl = new Model_Session(); bool Model_Session::load(const char* theFileName) { - bool aRes = ROOT_DOC->load(theFileName); + bool aRes = ROOT_DOC->load(theFileName, ROOT_DOC); return aRes; } @@ -46,7 +48,6 @@ bool Model_Session::save(const char* theFileName, std::list& theRes void Model_Session::closeAll() { - ROOT_DOC->close(true); Model_Application::getApplication()->deleteAllDocuments(); } @@ -130,10 +131,10 @@ std::list Model_Session::redoList() return ROOT_DOC->redoList(); } -FeaturePtr Model_Session::createFeature(string theFeatureID) +FeaturePtr Model_Session::createFeature(string theFeatureID, Model_Document* theDocOwner) { if (this != myImpl) { - return myImpl->createFeature(theFeatureID); + return myImpl->createFeature(theFeatureID, theDocOwner); } // load all information about plugins, features and attributes @@ -141,7 +142,7 @@ FeaturePtr Model_Session::createFeature(string theFeatureID) if (myPlugins.find(theFeatureID) != myPlugins.end()) { std::pair& aPlugin = myPlugins[theFeatureID]; // plugin and doc kind - if (!aPlugin.second.empty() && aPlugin.second != activeDocument()->kind()) { + if (!aPlugin.second.empty() && aPlugin.second != theDocOwner->kind()) { Events_Error::send( string("Feature '") + theFeatureID + "' can be created only in document '" + aPlugin.second + "' by the XML definition"); @@ -215,7 +216,7 @@ void Model_Session::setActiveDocument( if (aDoc.get()) { bool aWasChecked = myCheckTransactions; setCheckTransactions(false); - aDoc->synchronizeFeatures(false, true); + aDoc->objects()->synchronizeFeatures(false, true, true); if (aWasChecked) setCheckTransactions(true); } @@ -248,6 +249,11 @@ std::list > Model_Session::allOpenedDocuments return aResult; } +bool Model_Session::isLoadByDemand(const std::string theDocID) +{ + return Model_Application::getApplication()->isLoadByDemand(theDocID); +} + std::shared_ptr Model_Session::copy( std::shared_ptr theSource, std::string theID) { @@ -265,7 +271,7 @@ std::shared_ptr Model_Session::copy( aRT->SetRelocation(aSourceRoot, aTargetRoot); TDF_CopyTool::Copy(aDS, aRT); - aNew->synchronizeFeatures(false, true); + aNew->objects()->synchronizeFeatures(false, true, true); return aNew; } @@ -351,8 +357,15 @@ void Model_Session::LoadPluginsInfo() return; // Read plugins information from XML files - Config_ModuleReader aXMLReader(Config_FeatureMessage::MODEL_EVENT()); - aXMLReader.readAll(); + Config_ModuleReader aModuleReader(Config_FeatureMessage::MODEL_EVENT()); + aModuleReader.readAll(); + std::set aFiles = aModuleReader.modulePluginFiles(); + std::set::iterator it = aFiles.begin(); + for ( ; it != aFiles.end(); it++ ) { + Config_ValidatorReader aValidatorReader (*it); + aValidatorReader.readAll(); + }; + } void Model_Session::registerPlugin(ModelAPI_Plugin* thePlugin)