X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDCalc%2Fgui%2FDatasourceController.cxx;h=dda57da3db4d9206c9725a240d2f4b2ef1445932;hb=00da15b7d297827f6c0f4b2797ac8c79f20d9d0b;hp=636c4d95b036282d71a57d3ec52f52632b662d33;hpb=f5f3b19aa06206bc38e8a26e8e3b740794c15955;p=modules%2Fmed.git diff --git a/src/MEDCalc/gui/DatasourceController.cxx b/src/MEDCalc/gui/DatasourceController.cxx index 636c4d95b..dda57da3d 100644 --- a/src/MEDCalc/gui/DatasourceController.cxx +++ b/src/MEDCalc/gui/DatasourceController.cxx @@ -20,7 +20,7 @@ // Author : Guillaume Boulant (EDF) #include "DatasourceController.hxx" -#include "DatasourceConstants.hxx" +#include #include #include @@ -45,6 +45,7 @@ #include #include #include +#include #include "DlgAlias.hxx" @@ -53,31 +54,18 @@ // Datasource controller // ============================================================== // -//DatasourceController::DatasourceController(StandardApp_Module * salomeModule) -DatasourceController::DatasourceController(MEDModule * salomeModule) +DatasourceController::DatasourceController(MEDModule* salomeModule) { STDLOG("Creating a DatasourceController"); _salomeModule = salomeModule; - _studyEditor = new SALOME_AppStudyEditor(_salomeModule->getApp()); - - _dlgChangeUnderlyingMesh = new DlgChangeUnderlyingMesh(_studyEditor); - connect(_dlgChangeUnderlyingMesh,SIGNAL(inputValidated()), - this, SLOT(OnChangeUnderlyingMeshInputValidated())); - - _dlgInterpolateField = new DlgInterpolateField(_studyEditor); - connect(_dlgInterpolateField,SIGNAL(inputValidated()), - this, SLOT(OnInterpolateFieldInputValidated())); - + _studyEditor = _salomeModule->getStudyEditor(); } DatasourceController::~DatasourceController() { STDLOG("Deleting the DatasourceController"); - delete _studyEditor; } void DatasourceController::createActions() { - //QWidget* dsk = _salomeModule->getApp()->desktop(); - //SUIT_ResourceMgr* resMgr = _salomeModule->getApp()->resourceMgr(); int toolbarId = _salomeModule->createTool("Datasource", "DatasourceToolbar"); // @@ -88,12 +76,10 @@ void DatasourceController::createActions() { QString icon = tr("ICO_DATASOURCE_ADD"); int actionId; actionId = _salomeModule->createStandardAction(label,this, SLOT(OnAddDatasource()),icon,tooltip); - //_salomeModule->addActionInToolbar(actionId); _salomeModule->createTool(actionId, toolbarId); // This action has to be placed in the general file menu with the label "Import MED file" int menuId = _salomeModule->createMenu( tr( "MEN_FILE" ), -1, 1 ); - //_salomeModule->addActionInMenubar(actionId, menuId); _salomeModule->action(actionId)->setIconVisibleInMenu(true); _salomeModule->createMenu(actionId, menuId, 10); @@ -101,8 +87,9 @@ void DatasourceController::createActions() { tooltip = tr("TIP_ADD_IMAGE_SOURCE"); icon = tr("ICO_IMAGE_ADD"); actionId = _salomeModule->createStandardAction(label,this, SLOT(OnAddImagesource()),icon,tooltip); - // _salomeModule->addActionInToolbar(actionId); _salomeModule->createTool(actionId, toolbarId); + _salomeModule->action(actionId)->setIconVisibleInMenu(true); + _salomeModule->createMenu(actionId, menuId, 20); // // Actions for popup menu only @@ -113,55 +100,12 @@ void DatasourceController::createActions() { actionId = _salomeModule->createStandardAction(label,this,SLOT(OnExpandField()),icon); _salomeModule->addActionInPopupMenu(actionId); - // Create a view submenu with usual visualization functions - label = tr("LAB_VISUALIZE_SCALARMAP"); - icon = tr("ICO_DATASOURCE_VIEW"); - actionId = _salomeModule->createStandardAction(label,this,SLOT(OnVisualizeScalarMap()),icon); - _salomeModule->addActionInPopupMenu(actionId, tr("LAB_VISUALIZE")); - - label = tr("LAB_VISUALIZE_CONTOUR"); - icon = tr("ICO_DATASOURCE_VIEW"); - actionId = _salomeModule->createStandardAction(label,this,SLOT(OnVisualizeContour()),icon); - _salomeModule->addActionInPopupMenu(actionId, tr("LAB_VISUALIZE")); - - label = tr("LAB_VISUALIZE_VECTORFIELD"); - icon = tr("ICO_DATASOURCE_VIEW"); - actionId = _salomeModule->createStandardAction(label,this,SLOT(OnVisualizeVectorField()),icon); - _salomeModule->addActionInPopupMenu(actionId, tr("LAB_VISUALIZE")); - - label = tr("LAB_VISUALIZE_SLICES"); - icon = tr("ICO_DATASOURCE_VIEW"); - actionId = _salomeModule->createStandardAction(label,this,SLOT(OnVisualizeSlices()),icon); - _salomeModule->addActionInPopupMenu(actionId, tr("LAB_VISUALIZE")); - - label = tr("LAB_VISUALIZE_DEFLECTIONSHAPE"); - icon = tr("ICO_DATASOURCE_VIEW"); - actionId = _salomeModule->createStandardAction(label,this,SLOT(OnVisualizeDeflectionShape()),icon); - _salomeModule->addActionInPopupMenu(actionId, tr("LAB_VISUALIZE")); - - label = tr("LAB_VISUALIZE_POINTSPRITE"); - icon = tr("ICO_DATASOURCE_VIEW"); - actionId = _salomeModule->createStandardAction(label,this,SLOT(OnVisualizePointSprite()),icon); - _salomeModule->addActionInPopupMenu(actionId, tr("LAB_VISUALIZE")); - // Use in workspace label = tr("LAB_USE_IN_WORKSPACE"); icon = tr("ICO_DATASOURCE_USE"); actionId = _salomeModule->createStandardAction(label,this,SLOT(OnUseInWorkspace()),icon); _salomeModule->addActionInPopupMenu(actionId); - // Change underlying mesh (note that this action creates a new field in - // the workspace that corresponds to a copy of the selected field - // modified by the change of the underlying mesh. - label = tr("LAB_CHANGE_MESH"); - icon = tr("ICO_DATASOURCE_CHANGE_MESH"); - actionId = _salomeModule->createStandardAction(label,this,SLOT(OnChangeUnderlyingMesh()),icon); - _salomeModule->addActionInPopupMenu(actionId); - - label = tr("LAB_INTERPOLATE_FIELD"); - icon = tr("ICO_DATASOURCE_INTERPOLATE_FIELD"); - actionId = _salomeModule->createStandardAction(label,this,SLOT(OnInterpolateField()),icon); - _salomeModule->addActionInPopupMenu(actionId); } /** @@ -178,8 +122,14 @@ DatasourceController::addDatasource(const char* filename) DatasourceEvent* event = new DatasourceEvent(); event->eventtype = DatasourceEvent::EVENT_ADD_DATASOURCE; event->objectalias = filename; - emit datasourceSignal(event); + emit datasourceSignal(event); // --> WorkspaceController::processDatasourceEvent() +//#ifdef MED_WITH_QTTESTING +// _dirtyAddDataSource = true; +// while(_dirtyAddDataSource) +// QApplication::processEvents(); +//#endif } + // After above data source creation, python console emits a signal, forwarded by workspace, to update the GUI void DatasourceController::updateTreeViewWithNewDatasource(const MEDCALC::DatasourceHandler* datasourceHandler) @@ -195,27 +145,10 @@ DatasourceController::updateTreeViewWithNewDatasource(const MEDCALC::DatasourceH // update Object browser _salomeModule->getApp()->updateObjectBrowser(true); -} - -void -DatasourceController::updateTreeViewWithNewPresentation(long fieldId, long presentationId) -{ - if (presentationId < 0) { - std::cerr << "Unknown presentation\n"; - return; - } - - std::string name = MEDFactoryClient::getPresentationManager()->getPresentationProperty(presentationId, "name"); - name = tr(name.c_str()).toStdString(); - std::string label = tr("ICO_MED_PRESENTATION").toStdString(); - SalomeApp_Study* study = dynamic_cast(_salomeModule->application()->activeStudy()); - _PTR(Study) studyDS = study->studyDS(); - - _salomeModule->engine()->registerPresentation(_CAST(Study, studyDS)->GetStudy(), fieldId, name.c_str(), label.c_str()); - - // update Object browser - _salomeModule->getApp()->updateObjectBrowser(true); +//#ifdef MED_WITH_QTTESTING +// _dirtyAddDataSource = false; +//#endif } void DatasourceController::OnAddDatasource() @@ -228,10 +161,15 @@ void DatasourceController::OnAddDatasource() if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() ) anInitialPath = QDir::currentPath(); - QStringList filenames = SUIT_FileDlg::getOpenFileNames( _salomeModule->getApp()->desktop(), +// QStringList filenames = SUIT_FileDlg::getOpenFileNames( _salomeModule->getApp()->desktop(), +// anInitialPath, +// filter, +// tr("IMPORT_MED_FIELDS") ); + // [ABN] the below to be compatible with QtTesting: + QStringList filenames = QFileDialog::getOpenFileNames( _salomeModule->getApp()->desktop(), + tr("IMPORT_MED_FIELDS"), anInitialPath, - filter, - tr("IMPORT_MED_FIELDS") ); + tr("FILE_FILTER_MED") ); if ( filenames.count() <= 0 ) return; for ( QStringList::ConstIterator itFile = filenames.begin(); @@ -243,8 +181,6 @@ void DatasourceController::OnAddDatasource() } #include "DlgImageToMed.hxx" -//#include -//#include void DatasourceController::OnAddImagesource() { @@ -282,7 +218,7 @@ void DatasourceController::OnAddImagesource() DatasourceEvent* event = new DatasourceEvent(); event->eventtype = DatasourceEvent::EVENT_ADD_IMAGE_AS_DATASOURCE; event->objectalias = imageFilename; - emit datasourceSignal(event); + emit datasourceSignal(event); // --> WorkspaceController::processDatasourceEvent() } void DatasourceController::OnExpandField() @@ -291,12 +227,22 @@ void DatasourceController::OnExpandField() _studyEditor->updateActiveStudy(); // Get the selected objects in the study (SObject) - SALOME_StudyEditor::SObjectList * listOfSObject = _studyEditor->getSelectedObjects(); + SALOME_StudyEditor::SObjectList* listOfSObject = _studyEditor->getSelectedObjects(); for (int i=0; isize(); i++) { SALOMEDS::SObject_var soFieldseries = listOfSObject->at(i); + std::string name(_studyEditor->getName(soFieldseries)); + if (soFieldseries->_is_nil() || name == "MEDCalc") + return; // First retrieve the fieldseries id associated to this study object - long fieldseriesId = _studyEditor->getParameterInt(soFieldseries,OBJECT_ID); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeParameter_var aParam; + if ( soFieldseries->FindAttribute(anAttr,"AttributeParameter") ) { + aParam = SALOMEDS::AttributeParameter::_narrow(anAttr); + if (! aParam->IsSet(FIELD_SERIES_ID, PT_INTEGER)) + return; + } + long fieldseriesId = aParam->GetInt(FIELD_SERIES_ID); STDLOG("Expand the field timeseries "<getFieldListInFieldseries(fieldseriesId); // Finally, create an entry for each of the field @@ -317,78 +263,19 @@ void DatasourceController::OnExpandField() SALOMEDS::SObject_var soField = _studyEditor->newObject(soFieldseries); std::string label("it="); label += ToString(fieldHandler.iteration); _studyEditor->setName(soField,label.c_str()); - _studyEditor->setParameterInt(soField, OBJECT_ID, fieldHandler.id); - _studyEditor->setParameterBool(soField,OBJECT_IS_IN_WORKSPACE,false); + _studyEditor->setParameterInt(soField, FIELD_ID, fieldHandler.id); + _studyEditor->setParameterBool(soField,IS_IN_WORKSPACE,false); } } _salomeModule->updateObjBrowser(true); } -void DatasourceController::visualize(DatasourceEvent::EventType eventType) { - // We need a _studyEditor updated on the active study - _studyEditor->updateActiveStudy(); - - // Get the selected objects in the study (SObject) - SALOME_StudyEditor::SObjectList * listOfSObject = _studyEditor->getSelectedObjects(); - - // For each object, emit a signal to the workspace to request a - // visualisation using the tui command (so that the user can see how - // to make a view of an object from the tui console). - for (int i=0; isize(); i++) { - SALOMEDS::SObject_var soField = listOfSObject->at(i); - int fieldId = _studyEditor->getParameterInt(soField,OBJECT_ID); - // If fieldId equals -1, then it means that it is not a field - // managed by the MED module, and we stop this function process. - if ( fieldId < 0 ) - continue; - - MEDCALC::FieldHandler * fieldHandler = MEDFactoryClient::getDataManager()->getFieldHandler(fieldId); - if (! fieldHandler) { - QMessageBox::warning(_salomeModule->getApp()->desktop(), - tr("Operation not allowed"), - tr("No field is defined")); - return; - } - - DatasourceEvent * event = new DatasourceEvent(); - event->eventtype = eventType; - XmedDataObject * dataObject = new XmedDataObject(); - dataObject->setFieldHandler(*fieldHandler); - event->objectdata = dataObject; - emit datasourceSignal(event); - } -} - -void DatasourceController::OnVisualizeScalarMap() { - this->visualize(DatasourceEvent::EVENT_VIEW_OBJECT_SCALAR_MAP); -} - -void DatasourceController::OnVisualizeContour() { - this->visualize(DatasourceEvent::EVENT_VIEW_OBJECT_CONTOUR); -} - -void DatasourceController::OnVisualizeVectorField() { - this->visualize(DatasourceEvent::EVENT_VIEW_OBJECT_VECTOR_FIELD); -} - -void DatasourceController::OnVisualizeSlices() { - this->visualize(DatasourceEvent::EVENT_VIEW_OBJECT_SLICES); -} - -void DatasourceController::OnVisualizeDeflectionShape() { - this->visualize(DatasourceEvent::EVENT_VIEW_OBJECT_DEFLECTION_SHAPE); -} - -void DatasourceController::OnVisualizePointSprite() { - this->visualize(DatasourceEvent::EVENT_VIEW_OBJECT_POINT_SPRITE); -} - void DatasourceController::OnUseInWorkspace() { // We need a studyEditor updated on the active study _studyEditor->updateActiveStudy(); // Get the selected objects in the study (SObject) - SALOME_StudyEditor::SObjectList * listOfSObject = _studyEditor->getSelectedObjects(); + SALOME_StudyEditor::SObjectList* listOfSObject = _studyEditor->getSelectedObjects(); if ( listOfSObject->size() == 1 ) { // In this case we ask the name of the variable for the python // console @@ -401,8 +288,17 @@ void DatasourceController::OnUseInWorkspace() { // <<< SALOMEDS::SObject_var soField = listOfSObject->at(0); - - bool isInWorkspace = _studyEditor->getParameterBool(soField,OBJECT_IS_IN_WORKSPACE); + std::string name(_studyEditor->getName(soField)); + if (soField->_is_nil() || name == "MEDCalc") + return; + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeParameter_var aParam; + if ( soField->FindAttribute(anAttr,"AttributeParameter") ) { + aParam = SALOMEDS::AttributeParameter::_narrow(anAttr); + if (! aParam->IsSet(IS_IN_WORKSPACE, PT_BOOLEAN)) + return; + } + bool isInWorkspace = aParam->GetBool(IS_IN_WORKSPACE); if ( isInWorkspace ) { QMessageBox::warning(_salomeModule->getApp()->desktop(), tr("Operation not allowed"), @@ -410,7 +306,9 @@ void DatasourceController::OnUseInWorkspace() { return; } - int fieldId = _studyEditor->getParameterInt(soField,OBJECT_ID); + if (! aParam->IsSet(FIELD_ID, PT_INTEGER)) + return; + int fieldId = aParam->GetInt(FIELD_ID); // If fieldId equals -1, then it means that it is not a field // managed by the MED module, and we stop this function process. @@ -421,7 +319,7 @@ void DatasourceController::OnUseInWorkspace() { return; } - MEDCALC::FieldHandler * fieldHandler = + MEDCALC::FieldHandler* fieldHandler = MEDFactoryClient::getDataManager()->getFieldHandler(fieldId); if (! fieldHandler) { @@ -441,15 +339,15 @@ void DatasourceController::OnUseInWorkspace() { } alias = dialog.getAlias(); - DatasourceEvent * event = new DatasourceEvent(); + DatasourceEvent* event = new DatasourceEvent(); event->eventtype = DatasourceEvent::EVENT_USE_OBJECT; - XmedDataObject * dataObject = new XmedDataObject(); + XmedDataObject* dataObject = new XmedDataObject(); dataObject->setFieldHandler(*fieldHandler); event->objectdata = dataObject; event->objectalias = alias; - emit datasourceSignal(event); + emit datasourceSignal(event); // --> WorkspaceController::processDatasourceEvent() // Tag the item to prevent double import - // _studyEditor->setParameterBool(soField,OBJECT_IS_IN_WORKSPACE,true); + // _studyEditor->setParameterBool(soField,IS_IN_WORKSPACE,true); // Tag the field as persistent on the server. It means that a // saving of the workspace will save at least this field (maybe it // should be an option?) @@ -460,22 +358,32 @@ void DatasourceController::OnUseInWorkspace() { // each item, we just import the whole set of items. for (int i=0; isize(); i++) { SALOMEDS::SObject_var soField = listOfSObject->at(i); - - bool isInWorkspace = _studyEditor->getParameterBool(soField,OBJECT_IS_IN_WORKSPACE); + if (soField->_is_nil()) + continue; + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeParameter_var aParam; + if ( soField->FindAttribute(anAttr,"AttributeParameter") ) { + aParam = SALOMEDS::AttributeParameter::_narrow(anAttr); + if (! aParam->IsSet(IS_IN_WORKSPACE, PT_BOOLEAN)) + return; + } + bool isInWorkspace = aParam->GetBool(IS_IN_WORKSPACE); if ( !isInWorkspace ) { - int fieldId = _studyEditor->getParameterInt(soField,OBJECT_ID); - MEDCALC::FieldHandler * fieldHandler = + if (! aParam->IsSet(FIELD_ID, PT_INTEGER)) + continue; + int fieldId = aParam->GetInt(FIELD_ID); + MEDCALC::FieldHandler* fieldHandler = MEDFactoryClient::getDataManager()->getFieldHandler(fieldId); - DatasourceEvent * event = new DatasourceEvent(); + DatasourceEvent* event = new DatasourceEvent(); event->eventtype = DatasourceEvent::EVENT_IMPORT_OBJECT; - XmedDataObject * dataObject = new XmedDataObject(); + XmedDataObject* dataObject = new XmedDataObject(); dataObject->setFieldHandler(*fieldHandler); event->objectdata = dataObject; - emit datasourceSignal(event); + emit datasourceSignal(event); // --> WorkspaceController::processDatasourceEvent() // Note that this signal is processed by the WorkspaceController // Tag the item to prevent double import - // _studyEditor->setParameterBool(soField,OBJECT_IS_IN_WORKSPACE,true); + // _studyEditor->setParameterBool(soField,IS_IN_WORKSPACE,true); // Tag the field as persistent on the server. It means that a // saving of the workspace will save at least this field (maybe it // should be an option?) @@ -489,132 +397,6 @@ void DatasourceController::OnUseInWorkspace() { } } -void DatasourceController::OnChangeUnderlyingMesh() { - // We need a studyEditor updated on the active study - _studyEditor->updateActiveStudy(); - - // Get the selected objects in the study (SObject). In cas of a - // multiple selection, we consider only the first item. At least one - // item must be selected. - SALOME_StudyEditor::SObjectList * listOfSObject = _studyEditor->getSelectedObjects(); - if ( listOfSObject->size() > 0 ) { - SALOMEDS::SObject_var soField = listOfSObject->at(0); - int fieldId = _studyEditor->getParameterInt(soField,OBJECT_ID); - // _GBO_ : the dialog should not be modal, so that we can choose a - // mesh in the browser. Then we have to emit a signal from the - // dialog.accept, connected to a slot of the DatasourceControler - _dlgChangeUnderlyingMesh->setFieldId(fieldId); - Qt::WindowFlags flags = _dlgChangeUnderlyingMesh->windowFlags(); - _dlgChangeUnderlyingMesh->setWindowFlags(flags | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint); - _dlgChangeUnderlyingMesh->open(); - } -} - -void DatasourceController::OnChangeUnderlyingMeshInputValidated() { - int meshId = _dlgChangeUnderlyingMesh->getMeshId(); - STDLOG("meshId = " << ToString(meshId)); - int fieldId = _dlgChangeUnderlyingMesh->getFieldId(); - MEDCALC::FieldHandler * fieldHandler = - MEDFactoryClient::getDataManager()->getFieldHandler(fieldId); - - // We don't modify the original field but create first a duplicate - MEDCALC::FieldHandler * duplicate = MEDFactoryClient::getCalculator()->dup(*fieldHandler); - MEDFactoryClient::getDataManager()->changeUnderlyingMesh(duplicate->id, meshId); - - // Request once more the duplicate to update the meta-data on this - // client side - duplicate = MEDFactoryClient::getDataManager()->getFieldHandler(duplicate->id); - - // >>> - // WARN: the following is a temporary code for test purpose - // Automatically add in ws - DatasourceEvent * event = new DatasourceEvent(); - event->eventtype = DatasourceEvent::EVENT_IMPORT_OBJECT; - XmedDataObject * dataObject = new XmedDataObject(); - dataObject->setFieldHandler(*duplicate); - event->objectdata = dataObject; - emit datasourceSignal(event); - // Note that this signal is processed by the WorkspaceController - - // Tag the item to prevent double import - //_studyEditor->setParameterBool(soField,OBJECT_IS_IN_WORKSPACE,true); -} - -void DatasourceController::OnInterpolateField() { - // We need a studyEditor updated on the active study - _studyEditor->updateActiveStudy(); - - // Get the selected objects in the study (SObject). In case of a - // multiple selection, we consider only the first item. At least one - // item must be selected. - SALOME_StudyEditor::SObjectList * listOfSObject = _studyEditor->getSelectedObjects(); - if ( listOfSObject->size() > 0 ) { - SALOMEDS::SObject_var soField = listOfSObject->at(0); - int fieldId = _studyEditor->getParameterInt(soField,OBJECT_ID); - // _GBO_ : the dialog should not be modal, so that we can choose a - // mesh in the browser. Then we have to emit a signal from the - // dialog.accept, connected to a slot of the DatasourceControler - _dlgInterpolateField->setFieldId(fieldId); - Qt::WindowFlags flags = _dlgInterpolateField->windowFlags(); - _dlgInterpolateField->setWindowFlags(flags | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint); - _dlgInterpolateField->open(); - } -} - -void DatasourceController::OnInterpolateFieldInputValidated() { - MEDCALC::InterpolationParameters params; - params.precision = _dlgInterpolateField->getPrecision(); - STDLOG("precision = " << params.precision); - params.defaultValue = _dlgInterpolateField->getDefaultValue(); - STDLOG("defaultValue = " << params.defaultValue); - params.reverse = _dlgInterpolateField->getReverse(); - STDLOG("reverse = " << params.reverse); - params.intersectionType = _dlgInterpolateField->getIntersectionType().c_str(); - STDLOG("intersectionType = " << params.intersectionType); - params.method = _dlgInterpolateField->getMethod().c_str(); - STDLOG("method = " << params.method); - params.nature = _dlgInterpolateField->getFieldNature().c_str(); - STDLOG("nature = " << params.nature); - - int meshId = _dlgInterpolateField->getMeshId(); - STDLOG("meshId = " << ToString(meshId)); - int fieldId = _dlgInterpolateField->getFieldId(); - MEDCALC::FieldHandler* fieldHandler = MEDFactoryClient::getDataManager()->getFieldHandler(fieldId); - - // We don't modify the original field but create first a duplicate - // MEDCALC::FieldHandler* duplicate = MEDFactoryClient::getCalculator()->dup(*fieldHandler); - //MEDFactoryClient::getDataManager()->changeUnderlyingMesh(duplicate->id, meshId); - MEDCALC::FieldHandler* result = NULL; - try { - result = MEDFactoryClient::getDataManager()->interpolateField(fieldId, meshId, params); - } - catch(...) { - STDLOG("Unable to process field interpolation; please check interpolation parameters"); - QMessageBox::critical(_salomeModule->getApp()->desktop(), - tr("Operation failed"), - tr("Unable to process field interpolation; please check interpolation parameters")); - return; - } - - // Request once more the duplicate to update the meta-data on this - // client side - // duplicate = MEDFactoryClient::getDataManager()->getFieldHandler(duplicate->id); - - // >>> - // WARN: the following is a temporary code for test purpose - // Automatically add in ws - DatasourceEvent * event = new DatasourceEvent(); - event->eventtype = DatasourceEvent::EVENT_IMPORT_OBJECT; - XmedDataObject * dataObject = new XmedDataObject(); - dataObject->setFieldHandler(*result); - event->objectdata = dataObject; - emit datasourceSignal(event); - // Note that this signal is processed by the WorkspaceController - - // // Tag the item to prevent double import - // //_studyEditor->setParameterBool(soField,OBJECT_IS_IN_WORKSPACE,true); -} - void DatasourceController::processWorkspaceEvent(const MEDCALC::MedEvent* event) { @@ -622,7 +404,4 @@ DatasourceController::processWorkspaceEvent(const MEDCALC::MedEvent* event) MEDCALC::DatasourceHandler* datasourceHandler = MEDFactoryClient::getDataManager()->getDatasourceHandler(event->filename); this->updateTreeViewWithNewDatasource(datasourceHandler); } - else if ( event->type == MEDCALC::EVENT_ADD_PRESENTATION ) { - this->updateTreeViewWithNewPresentation(event->dataId, event->presentationId); - } }