GetResult(SALOMEDS::Study_ptr theStudy,
const std::string& theResultEntry)
{
- if(CORBA::is_nil(theStudy))
- return NULL;
-
- SALOMEDS::SObject_var aSObject = theStudy->FindObjectID(theResultEntry.c_str());
- CORBA::Object_var anObject = SObjectToObject(aSObject);
- return dynamic_cast<VISU::Result_i*>(GetServant(anObject).in());
+ Result_i* result = NULL;
+ if (!CORBA::is_nil(theStudy)) {
+ SALOMEDS::SComponent_var aSComponent = theStudy->FindComponent("VISU");
+ if (!CORBA::is_nil(aSComponent)) {
+ std::string compid = aSComponent->GetID();
+ std::string aResultEntry = theResultEntry;
+ if (theResultEntry.substr(0, compid.length()) != compid) aResultEntry = compid + theResultEntry.substr(compid.length());
+ SALOMEDS::SObject_var aSObject = theStudy->FindObjectID(aResultEntry.c_str());
+ CORBA::Object_var anObject = SObjectToObject(aSObject);
+ result = dynamic_cast<VISU::Result_i*>(GetServant(anObject).in());
+ }
+ }
+ return result;
}