Handle(SALOME_InteractiveObject) anIO = It.Value();
SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
if (!aSObject->_is_nil()) {
+
+ // try to load a component data from an opened (presumably) study
+ // The same in SUPERVISION: NPAL14522
+ {
+ SALOMEDS::SComponent_ptr aSComp = aSObject->GetFatherComponent();
+ //std::string aCompIOR;
+ CORBA::String_var aCompIOR;
+ if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
+ CORBA::String_var aCompDataType = aSComp->ComponentDataType();
+ //std::string aCompDataType = aSComp->ComponentDataType();
+
+ // obtain a driver by a component data type
+ // like it is done in SALOMEDS_DriverFactory_i::GetDriverByType
+ SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_nil();
+ SALOME_LifeCycleCORBA * LCC = getApp()->lcc();
+ try {
+ CORBA::Object_var
+ //anEngineObj = LCC->FindOrLoad_Component("FactoryServer", aCompDataType.c_str());
+ anEngineObj = LCC->FindOrLoad_Component("FactoryServer", aCompDataType);
+ if (CORBA::is_nil(anEngineObj))
+ //anEngineObj = LCC->FindOrLoad_Component("FactoryServerPy", aCompDataType.c_str());
+ anEngineObj = LCC->FindOrLoad_Component("FactoryServerPy", aCompDataType);
+
+ if (!CORBA::is_nil(anEngineObj))
+ anEngine = SALOMEDS::Driver::_narrow(anEngineObj);
+
+ if (!CORBA::is_nil(anEngine)) {
+ // try to load
+ SALOMEDS::StudyBuilder_ptr aStudyBuilder = aStudy->NewBuilder();
+ //aStudyBuilder->LoadWith(aSComp, aDriverIOR.in());
+ aStudyBuilder->LoadWith(aSComp, anEngine);
+ }
+ }
+ catch (...) {
+ }
+ }
+ }
+
CORBA::Object_var anObject = VISU::SObjectToObject(aSObject);
if (!CORBA::is_nil(anObject)) {
SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
if(!CORBA::is_nil(aMedEngine))
{
SALOMEDS::StudyBuilder_var aStudyBuilder = myStudyDocument->NewBuilder();
- aStudyBuilder->LoadWith( myStudyDocument->FindComponent( "MED" ), aMedEngine );
+ try {
+ aStudyBuilder->LoadWith( myStudyDocument->FindComponent( "MED" ), aMedEngine );
+ }
+ catch( const SALOME::SALOME_Exception& ) {
+ // Oops, something went wrong while loading
+ // See also SalomeApp_Study::openDataModel()
+ }
}
}
} else {
using namespace std;
#ifdef _DEBUG_
-static int MYDEBUG = 0;
+static int MYDEBUG = 1;
static int MYTIMEDEBUG = 0;
#else
static int MYDEBUG = 0;
SALOMEDS::StudyBuilder_var aStudyBuilder = myStudyDocument->NewBuilder();
SALOMEDS::Driver_var aDriver = SALOMEDS::Driver::_narrow(aEngComp);
aStudyBuilder->LoadWith(aCompRefSObj, aDriver);
+ /*
if (strcmp(aDataType, "MED") == 0){
// create field or MED converter
CORBA::Object_var aMedObject = VISU::SObjectToObject(aTargetRefSObj);
myInput->Build();
}else
throw std::runtime_error("GetInput - There is no convertor for the aDataType !!!");
+ //*/
+
+ // create field or MED converter
+ CORBA::Object_var aMedObject = VISU::SObjectToObject(aTargetRefSObj);
+ SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(aMedObject);
+ if (!CORBA::is_nil(aField)) {
+ // create field converter
+ myInput = CreateMEDFieldConvertor(aField);
+ myInput->Build();
+ }
+ else if (strcmp(aDataType, "MED") == 0) {
+ // create MED converter
+ myInput = CreateMEDConvertor(aTargetRefSObj);
+ myInput->Build();
+ }
+ else {
+ throw std::runtime_error("GetInput - There is no convertor for the aDataType !!!");
+ }
} else {
myFileInfo.setFile(thePrefix.c_str());