// 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
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))
if (!CORBA::is_nil(anEngine)) {
// try to load
SALOMEDS::StudyBuilder_ptr aStudyBuilder = aStudy->NewBuilder();
- //aStudyBuilder->LoadWith(aSComp, aDriverIOR.in());
aStudyBuilder->LoadWith(aSComp, anEngine);
}
}
QApplication::restoreOverrideCursor();
}
+void VisuGUI::OnLoadComponentData()
+{
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+ if (CheckLock(aCStudy,GetDesktop(this)))
+ return;
+ SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
+
+ LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects(aListIO);
+
+ SALOME_ListIteratorOfListIO It (aListIO);
+ QApplication::setOverrideCursor(Qt::waitCursor);
+ for (; It.More(); It.Next()) {
+ 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();
+ CORBA::String_var aCompIOR;
+ if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
+ CORBA::String_var aCompDataType = aSComp->ComponentDataType();
+
+ QString anInfo ("Loading ");
+ anInfo = anInfo + aCompDataType.in() + " Component Data ...";
+ application()->putInfo( anInfo );
+
+ // 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);
+ if (CORBA::is_nil(anEngineObj))
+ 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, anEngine);
+ }
+
+ application()->putInfo( anInfo + tr("INF_DONE"));
+ }
+ catch (...) {
+ application()->putInfo( anInfo + tr("INF_FAILED"));
+ }
+ }
+ }
+ }
+ }
+ QApplication::restoreOverrideCursor();
+}
+
void
CreateCurves( SalomeApp_Module* theModule,
VISU::CutLines_i* thePrs,
tr("MEN_IMPORT_MED_FIELD"), "", 0, aParent, false,
this, SLOT(OnImportMedField()));
+ createAction( VISU_LOAD_COMPONENT_DATA, tr("MEN_LOAD_COMPONENT_DATA"), QIconSet(),
+ tr("MEN_LOAD_COMPONENT_DATA"), "", 0, aParent, false,
+ this, SLOT(OnLoadComponentData()));
+
createAction( VISU_CREATE_PRS, tr("MEN_CREATE_PRS"), QIconSet(),
tr("MEN_CREATE_PRS"), "", 0, aParent, false,
this, SLOT(OnCreateMesh()));
_PTR(SObject) SO = aCStudy->FindObjectID(anIO->getEntry());
if ( !SO )
return;
+
+ // Check if the object's data is loaded
+ _PTR(SComponent) aSComp = SO->GetFatherComponent();
+ std::string aCompIOR;
+ if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
+ //std::string aCompDataType = aSComp->ComponentDataType();
+ action( VISU_LOAD_COMPONENT_DATA )->addTo(theMenu); // "Load Component Data"
+ }
+
bool isExist;
VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
if (!CORBA::is_nil(anObject)) {
SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
if (!CORBA::is_nil(aMED.in())) {
- action( VISU_IMPORT_MED_STRUCTURE )->addTo(theMenu);
+ action( VISU_IMPORT_MED_STRUCTURE )->addTo(theMenu); // "Import Structure"
}
- SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject); // "Import Structure"
+ SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
if (!CORBA::is_nil(aField)) {
action( VISU_IMPORT_MED_TIMESTAMP )->addTo(theMenu); // "Import TimeStamp"
}
} else {
- _PTR(SObject) aSFather = SO->GetFather();
- if (aSFather) {
- _PTR(GenericAttribute) anAttr;
- aSFather->FindAttribute(anAttr, "AttributeName");
- if (anAttr) {
- _PTR(AttributeName) aName (anAttr);
- std::string aValue = aName->Value();
- if (strcmp(aValue.c_str(), "MEDFIELD") == 0) {
- action( VISU_IMPORT_MED_FIELD )->addTo(theMenu); // "Import Field"
- }
+ _PTR(SObject) aSFather1 = SO->GetFather();
+ if (aSFather1) {
+ std::string aValue = aSFather1->GetName();
+ if (strcmp(aValue.c_str(), "MEDFIELD") == 0) {
+ action( VISU_IMPORT_MED_FIELD )->addTo(theMenu); // "Import Field"
}
}
}