interface
MED_Gen : Engines::EngineComponent
{
- status addDatasourceToStudy(in SALOMEDS::Study study,
- in MEDCALC::DatasourceHandler datasourceHandler)
+ status addDatasourceToStudy(in MEDCALC::DatasourceHandler datasourceHandler)
raises (SALOME::SALOME_Exception);
- status registerPresentationField(in SALOMEDS::Study study,
- in long fieldId,
- in string name,
- in string type,
- in string ico,
- in long presentationId)
+ status registerPresentationField(in long fieldId,
+ in string name,
+ in string type,
+ in string ico,
+ in long presentationId)
raises (SALOME::SALOME_Exception);
- status registerPresentationMesh(in SALOMEDS::Study study,
- in long meshId,
+ status registerPresentationMesh(in long meshId,
in string name,
in string type,
in string ico,
in long presentationId)
raises (SALOME::SALOME_Exception);
- status unregisterPresentation(in SALOMEDS::Study study,
- in long presentationId)
+ status unregisterPresentation(in long presentationId)
raises (SALOME::SALOME_Exception);
-// PresentationsList getSiblingPresentations(in SALOMEDS::Study study,
-// in long presentationId)
+// PresentationsList getSiblingPresentations(in long presentationId)
// raises (SALOME::SALOME_Exception);
// Get all presentations in study:
- PresentationsList getStudyPresentations(in SALOMEDS::Study study)
+ PresentationsList getStudyPresentations()
raises (SALOME::SALOME_Exception);
- string getStudyPresentationEntry(in SALOMEDS::Study study,
- in long presentationId)
+ string getStudyPresentationEntry(in long presentationId)
raises (SALOME::SALOME_Exception);
void cleanUp();
#include <SALOME_LifeCycleCORBA.hxx>
#include <SALOME_NamingService.hxx>
#include <SALOME_KernelServices.hxx>
+#include <SALOMEDSImpl_AttributeParameter.hxx>
#include <string>
#include <sstream>
}
MED_ORB::status
-MED::addDatasourceToStudy(SALOMEDS::Study_ptr study,
- const MEDCALC::DatasourceHandler& datasourceHandler)
+MED::addDatasourceToStudy(const MEDCALC::DatasourceHandler& datasourceHandler)
{
// set exception handler to catch unexpected CORBA exceptions
Unexpect aCatch(SALOME_SalomeException);
+ SALOMEDS::Study_var aStudy = KERNEL::getStudyServant();
// check if reference to study is valid
- if (!CORBA::is_nil(study)) {
+ if (!CORBA::is_nil(aStudy)) {
// get full object path
std::string fullName = CORBA::string_dup(datasourceHandler.name);
// check if the object with the same name is already registered in the study
- SALOMEDS::SObject_var sobj = study->FindObjectByPath(fullName.c_str());
+ SALOMEDS::SObject_var sobj = aStudy->FindObjectByPath(fullName.c_str());
if (CORBA::is_nil(sobj)) {
// object is not registered yet -> register
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeParameter_var aParam;
- SALOMEDS::StudyBuilder_var studyBuilder = study->NewBuilder();
- SALOMEDS::UseCaseBuilder_var useCaseBuilder = study->GetUseCaseBuilder();
+ SALOMEDS::StudyBuilder_var studyBuilder = aStudy->NewBuilder();
+ SALOMEDS::UseCaseBuilder_var useCaseBuilder = aStudy->GetUseCaseBuilder();
// find MED component; create it if not found
- SALOMEDS::SComponent_var father = study->FindComponent("MED");
+ SALOMEDS::SComponent_var father = aStudy->FindComponent("MED");
if (CORBA::is_nil(father)) {
// create component
father = studyBuilder->NewComponent("MED");
}
MED_ORB::status
-MED::registerPresentationField(SALOMEDS::Study_ptr study,
- CORBA::Long fieldId,
- const char* name,
- const char* type,
- const char* ico,
- CORBA::Long presentationId)
+MED::registerPresentationField(CORBA::Long fieldId,
+ const char* name,
+ const char* type,
+ const char* ico,
+ CORBA::Long presentationId)
{
// set exception handler to catch unexpected CORBA exceptions
Unexpect aCatch(SALOME_SalomeException);
return MED_ORB::OP_ERROR ;
}
std::string entry = _fieldSeriesEntries[fieldSeriesId];
- SALOMEDS::SObject_var sobject = study->FindObjectID(entry.c_str());
+ SALOMEDS::Study_var aStudy = KERNEL::getStudyServant();
+ SALOMEDS::SObject_var sobject = aStudy->FindObjectID(entry.c_str());
SALOMEDS::SObject_ptr soFieldseries = sobject._retn();
if (soFieldseries->IsNull()) {
return MED_ORB::OP_ERROR;
}
- SALOMEDS::StudyBuilder_var studyBuilder = study->NewBuilder();
- SALOMEDS::UseCaseBuilder_var useCaseBuilder = study->GetUseCaseBuilder();
+ SALOMEDS::StudyBuilder_var studyBuilder = aStudy->NewBuilder();
+ SALOMEDS::UseCaseBuilder_var useCaseBuilder = aStudy->GetUseCaseBuilder();
SALOMEDS::SObject_var soPresentation = studyBuilder->NewObject(soFieldseries);
useCaseBuilder->AppendTo(soPresentation->GetFather(), soPresentation);
}
MED_ORB::status
-MED::registerPresentationMesh(SALOMEDS::Study_ptr study,
- CORBA::Long meshId,
- const char* name,
- const char* type,
- const char* ico,
- CORBA::Long presentationId)
+MED::registerPresentationMesh(CORBA::Long meshId,
+ const char* name,
+ const char* type,
+ const char* ico,
+ CORBA::Long presentationId)
{
// set exception handler to catch unexpected CORBA exceptions
Unexpect aCatch(SALOME_SalomeException);
return MED_ORB::OP_ERROR ;
}
std::string entry = _meshEntries[meshHandler->id];
- SALOMEDS::SObject_var sobject = study->FindObjectID(entry.c_str());
+ SALOMEDS::Study_var aStudy = KERNEL::getStudyServant();
+ SALOMEDS::SObject_var sobject = aStudy->FindObjectID(entry.c_str());
SALOMEDS::SObject_ptr soMesh = sobject._retn();
if (soMesh->IsNull()) {
return MED_ORB::OP_ERROR;
}
- SALOMEDS::StudyBuilder_var studyBuilder = study->NewBuilder();
- SALOMEDS::UseCaseBuilder_var useCaseBuilder = study->GetUseCaseBuilder();
+ SALOMEDS::StudyBuilder_var studyBuilder = aStudy->NewBuilder();
+ SALOMEDS::UseCaseBuilder_var useCaseBuilder = aStudy->GetUseCaseBuilder();
SALOMEDS::SObject_var soPresentation = studyBuilder->NewObject(soMesh);
useCaseBuilder->AppendTo(soPresentation->GetFather(), soPresentation);
MED_ORB::status
-MED::unregisterPresentation(SALOMEDS::Study_ptr study,
- CORBA::Long presentationId)
+MED::unregisterPresentation(CORBA::Long presentationId)
{
// set exception handler to catch unexpected CORBA exceptions
Unexpect aCatch(SALOME_SalomeException);
- SALOMEDS::StudyBuilder_var studyBuilder = study->NewBuilder();
- SALOMEDS::UseCaseBuilder_var useCaseBuilder = study->GetUseCaseBuilder();
+ SALOMEDS::Study_var aStudy = KERNEL::getStudyServant();
+ SALOMEDS::StudyBuilder_var studyBuilder = aStudy->NewBuilder();
+ SALOMEDS::UseCaseBuilder_var useCaseBuilder = aStudy->GetUseCaseBuilder();
SALOMEDS::GenericAttribute_var anAttribute;
- SALOMEDS::SComponent_var father = study->FindComponent("MED");
- SALOMEDS::ChildIterator_var it = study->NewChildIterator(father);
+ SALOMEDS::SComponent_var father = aStudy->FindComponent("MED");
+ SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(father);
for (it->InitEx(true); it->More(); it->Next()) {
SALOMEDS::SObject_var child(it->Value());
}
MED_ORB::PresentationsList*
-MED::getStudyPresentations(SALOMEDS::Study_ptr study)
+MED::getStudyPresentations()
{
// set exception handler to catch unexpected CORBA exceptions
Unexpect aCatch(SALOME_SalomeException);
MED_ORB::PresentationsList* presList = new MED_ORB::PresentationsList;
- SALOMEDS::StudyBuilder_var studyBuilder = study->NewBuilder();
- SALOMEDS::UseCaseBuilder_var useCaseBuilder = study->GetUseCaseBuilder();
+ SALOMEDS::Study_var aStudy = KERNEL::getStudyServant();
+ SALOMEDS::StudyBuilder_var studyBuilder = aStudy->NewBuilder();
+ SALOMEDS::UseCaseBuilder_var useCaseBuilder = aStudy->GetUseCaseBuilder();
SALOMEDS::GenericAttribute_var anAttribute;
- SALOMEDS::SComponent_var father = study->FindComponent("MED");
- SALOMEDS::ChildIterator_var it = study->NewChildIterator(father);
+ SALOMEDS::SComponent_var father = aStudy->FindComponent("MED");
+ SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(father);
for (it->InitEx(true); it->More(); it->Next())
{
SALOMEDS::SObject_var child(it->Value());
}
char*
-MED::getStudyPresentationEntry(SALOMEDS::Study_ptr study, CORBA::Long presentationId)
+MED::getStudyPresentationEntry(CORBA::Long presentationId)
{
// set exception handler to catch unexpected CORBA exceptions
Unexpect aCatch(SALOME_SalomeException);
MED_ORB::PresentationsList* presList = new MED_ORB::PresentationsList;
- SALOMEDS::StudyBuilder_var studyBuilder = study->NewBuilder();
- SALOMEDS::UseCaseBuilder_var useCaseBuilder = study->GetUseCaseBuilder();
+ SALOMEDS::Study_var aStudy = KERNEL::getStudyServant();
+ SALOMEDS::StudyBuilder_var studyBuilder = aStudy->NewBuilder();
+ SALOMEDS::UseCaseBuilder_var useCaseBuilder = aStudy->GetUseCaseBuilder();
SALOMEDS::GenericAttribute_var anAttribute;
- SALOMEDS::SComponent_var father = study->FindComponent("MED");
- SALOMEDS::ChildIterator_var it = study->NewChildIterator(father);
+ SALOMEDS::SComponent_var father = aStudy->FindComponent("MED");
+ SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(father);
for (it->InitEx(true); it->More(); it->Next())
{
SALOMEDS::SObject_var child(it->Value());
CORBA::Boolean isMultiFile,
CORBA::Boolean& isValidScript)
{
- SALOME_LifeCycleCORBA lcc;
- CORBA::Object_var theStudy = lcc.namingService()->Resolve("/Study");
- SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow(theStudy);
- if(CORBA::is_nil(aStudy)) {
- std::cerr << "Error: Cannot find the study\n";
- return new Engines::TMPFile(0);
- }
-
- SALOMEDS::SObject_var aSO = aStudy->FindComponent("MED");
+ SALOMEDS::SObject_var aSO = KERNEL::getStudyServant()->FindComponent("MED");
if(CORBA::is_nil(aSO)) {
std::cerr << "Error: Cannot find component MED\n";
return new Engines::TMPFile(0);
char*
MED::getObjectInfo(const char* entry)
{
- SALOME_LifeCycleCORBA lcc;
- CORBA::Object_var aStudyObject = lcc.namingService()->Resolve("/Study");
- SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow( aStudyObject );
- SALOMEDS::SObject_var aSObj = aStudy->FindObjectID( entry );
+ SALOMEDS::SObject_var aSObj = KERNEL::getStudyServant()->FindObjectID( entry );
SALOMEDS::SObject_var aResultSObj;
if (aSObj->ReferencedObject(aResultSObj))
aSObj = aResultSObj;
#include CORBA_SERVER_HEADER(MEDDataManager)
#include CORBA_CLIENT_HEADER(SALOMEDS)
#include <SALOME_Component_i.hxx>
-#include <SALOMEDS_Study.hxx>
#include <map>
#include <string>
const char* interfaceName);
virtual ~MED();
- MED_ORB::status addDatasourceToStudy(SALOMEDS::Study_ptr study,
- const MEDCALC::DatasourceHandler& datasourceHandler);
+ MED_ORB::status addDatasourceToStudy(const MEDCALC::DatasourceHandler& datasourceHandler);
- MED_ORB::status registerPresentationField(SALOMEDS::Study_ptr study,
- CORBA::Long fieldId,
- const char* name,
- const char* type,
- const char* ico,
- CORBA::Long presentationId);
+ MED_ORB::status registerPresentationField(CORBA::Long fieldId,
+ const char* name,
+ const char* type,
+ const char* ico,
+ CORBA::Long presentationId);
- MED_ORB::status registerPresentationMesh(SALOMEDS::Study_ptr study,
- CORBA::Long meshId,
- const char* name,
- const char* type,
- const char* ico,
- CORBA::Long presentationId);
+ MED_ORB::status registerPresentationMesh(CORBA::Long meshId,
+ const char* name,
+ const char* type,
+ const char* ico,
+ CORBA::Long presentationId);
- MED_ORB::status unregisterPresentation(SALOMEDS::Study_ptr study,
- CORBA::Long presentationId);
+ MED_ORB::status unregisterPresentation(CORBA::Long presentationId);
// // Caller owns the returned list, and is responsible for the list deletion.
-// MED_ORB::PresentationsList* getSiblingPresentations(SALOMEDS::Study_ptr study,
-// CORBA::Long presentationId);
+// MED_ORB::PresentationsList* getSiblingPresentations(CORBA::Long presentationId);
// Get all presentations registered in the study
- MED_ORB::PresentationsList* getStudyPresentations(SALOMEDS::Study_ptr study);
+ MED_ORB::PresentationsList* getStudyPresentations();
- char* getStudyPresentationEntry(SALOMEDS::Study_ptr study, CORBA::Long presentationId);
+ char* getStudyPresentationEntry(CORBA::Long presentationId);
void cleanUp();
name = tr(name.c_str()).toStdString();
oss << name << " (" << presentationId << ")";
- SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>(_salomeModule->application()->activeStudy());
- _PTR(Study) studyDS = study->studyDS();
-
// Mesh views are always registered at the mesh level:
if (type == MEDPresentationMeshView::TYPE_NAME)
{
- _salomeModule->engine()->registerPresentationMesh(_CAST(Study, studyDS)->GetStudy(), dataId,
- oss.str().c_str(), type.c_str(),ico.c_str(), presentationId);
+ _salomeModule->engine()->registerPresentationMesh(dataId, oss.str().c_str(), type.c_str(),ico.c_str(), presentationId);
}
else
- _salomeModule->engine()->registerPresentationField(_CAST(Study, studyDS)->GetStudy(), dataId,
- oss.str().c_str(), type.c_str(),ico.c_str(), presentationId);
+ _salomeModule->engine()->registerPresentationField(dataId, oss.str().c_str(), type.c_str(),ico.c_str(), presentationId);
// update Object browser
_salomeModule->getApp()->updateObjectBrowser(true);
// auto-select new presentation
- std::string entry = _salomeModule->engine()->getStudyPresentationEntry(_CAST(Study, studyDS)->GetStudy(), presentationId);
+ std::string entry = _salomeModule->engine()->getStudyPresentationEntry(presentationId);
SALOME_ListIO selectedObjects;
LightApp_Study* lightStudy = dynamic_cast<LightApp_Study*>( _salomeModule->application()->activeStudy() );
QString component = lightStudy->componentDataType( entry.c_str() );
return;
}
- SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>(_salomeModule->application()->activeStudy());
- _PTR(Study) studyDS = study->studyDS();
-
- _salomeModule->engine()->unregisterPresentation(_CAST(Study, studyDS)->GetStudy(), presentationId);
+ _salomeModule->engine()->unregisterPresentation(presentationId);
// update Object browser
_salomeModule->getApp()->updateObjectBrowser(true);
PresentationController::_dealWithReplaceMode()
{
// Deal with replace mode: presentations with invalid IDs have to be removed:
- SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>(_salomeModule->application()->activeStudy());
- _PTR(Study) studyDS = study->studyDS();
MEDCALC::PresentationsList * lstManager = _presManager->getAllPresentations();
- MED_ORB::PresentationsList * lstModule = _salomeModule->engine()->getStudyPresentations(_CAST(Study, studyDS)->GetStudy());
+ MED_ORB::PresentationsList * lstModule = _salomeModule->engine()->getStudyPresentations();
// The IDs not in the intersection needs deletion:
CORBA::Long * last = lstManager->get_buffer() + lstManager->length();
for (unsigned i = 0; i < lstModule->length(); i++) {