#include <ModelAPI_Plugin.h>
#include <Model_Data.h>
#include <Model_Document.h>
+#include <Model_Objects.h>
#include <Model_Application.h>
#include <Model_Events.h>
#include <Model_Validator.h>
bool Model_Session::load(const char* theFileName)
{
- bool aRes = ROOT_DOC->load(theFileName);
+ bool aRes = ROOT_DOC->load(theFileName, ROOT_DOC);
return aRes;
}
void Model_Session::closeAll()
{
- ROOT_DOC->close(true);
Model_Application::getApplication()->deleteAllDocuments();
+ //ROOT_DOC->close(true);
}
void Model_Session::startOperation(const std::string& theId)
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
if (myPlugins.find(theFeatureID) != myPlugins.end()) {
std::pair<std::string, std::string>& 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");
if (aDoc.get()) {
bool aWasChecked = myCheckTransactions;
setCheckTransactions(false);
- aDoc->synchronizeFeatures(false, true, true);
+ aDoc->objects()->synchronizeFeatures(false, true, true);
if (aWasChecked)
setCheckTransactions(true);
}
return aResult;
}
+bool Model_Session::isLoadByDemand(const std::string theDocID)
+{
+ return Model_Application::getApplication()->isLoadByDemand(theDocID);
+}
+
std::shared_ptr<ModelAPI_Document> Model_Session::copy(
std::shared_ptr<ModelAPI_Document> theSource, std::string theID)
{
aRT->SetRelocation(aSourceRoot, aTargetRoot);
TDF_CopyTool::Copy(aDS, aRT);
- aNew->synchronizeFeatures(false, true, true);
+ aNew->objects()->synchronizeFeatures(false, true, true);
return aNew;
}