1 // Copyright (C) 2007-2015 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // Author : Guillaume Boulant (EDF)
22 #include "DatasourceController.hxx"
23 #include "DatasourceConstants.hxx"
25 #include "MEDFactoryClient.hxx"
26 #include "QtHelper.hxx"
28 #include CORBA_CLIENT_HEADER(SALOMEDS)
29 #include <SUIT_FileDlg.h>
30 #include <SUIT_Desktop.h>
32 #include <QStringList>
34 #include <QMessageBox>
36 #include "DlgAlias.hxx"
39 // ==============================================================
40 // Datasource controller
41 // ==============================================================
43 DatasourceController::DatasourceController(StandardApp_Module * salomeModule) {
44 STDLOG("Creating a DatasourceController");
45 _salomeModule = salomeModule;
46 _studyEditor = new SALOME_AppStudyEditor(_salomeModule->getApp());
48 _dlgChangeUnderlyingMesh = new DlgChangeUnderlyingMesh(_studyEditor);
49 connect(_dlgChangeUnderlyingMesh,SIGNAL(inputValidated()),
50 this, SLOT(OnChangeUnderlyingMeshInputValidated()));
52 _dlgInterpolateField = new DlgInterpolateField(_studyEditor);
53 connect(_dlgInterpolateField,SIGNAL(inputValidated()),
54 this, SLOT(OnInterpolateFieldInputValidated()));
58 DatasourceController::~DatasourceController() {
59 STDLOG("Deleting the DatasourceController");
63 void DatasourceController::createActions() {
65 // Main actions (toolbar and menubar)
67 QString label = tr("LAB_ADD_DATA_SOURCE");
68 QString tooltip = tr("TIP_ADD_DATA_SOURCE");
69 QString icon = tr("ICO_DATASOURCE_ADD");
71 actionId = _salomeModule->createStandardAction(label,this, SLOT(OnAddDatasource()),icon,tooltip);
72 _salomeModule->addActionInToolbar(actionId);
74 // This action has to be placed in the general file menu with the label "Import MED file"
75 int menuId = _salomeModule->createMenu( tr( "MEN_FILE" ), -1, 1 );
76 _salomeModule->addActionInMenubar(actionId, menuId);
78 label = tr("LAB_ADD_IMAGE_SOURCE");
79 tooltip = tr("TIP_ADD_IMAGE_SOURCE");
80 icon = tr("ICO_IMAGE_ADD");
81 actionId = _salomeModule->createStandardAction(label,this, SLOT(OnAddImagesource()),icon,tooltip);
82 _salomeModule->addActionInToolbar(actionId);
85 // Actions for popup menu only
87 // Expand field timeseries
88 label = tr("LAB_EXPAND_FIELD");
89 icon = tr("ICO_DATASOURCE_EXPAND_FIELD");
90 actionId = _salomeModule->createStandardAction(label,this,SLOT(OnExpandField()),icon);
91 _salomeModule->addActionInPopupMenu(actionId);
93 // Create a view submenu with usual visualization functions
94 label = tr("LAB_VISUALIZE_SCALARMAP");
95 icon = tr("ICO_DATASOURCE_VIEW");
96 actionId = _salomeModule->createStandardAction(label,this,SLOT(OnVisualizeScalarMap()),icon);
97 _salomeModule->addActionInPopupMenu(actionId, tr("LAB_VISUALIZE"));
100 label = tr("LAB_USE_IN_WORKSPACE");
101 icon = tr("ICO_DATASOURCE_USE");
102 actionId = _salomeModule->createStandardAction(label,this,SLOT(OnUseInWorkspace()),icon);
103 _salomeModule->addActionInPopupMenu(actionId);
105 // Change underlying mesh (note that this action creates a new field in
106 // the workspace that corresponds to a copy of the selected field
107 // modified by the change of the underlying mesh.
108 label = tr("LAB_CHANGE_MESH");
109 icon = tr("ICO_DATASOURCE_CHANGE_MESH");
110 actionId = _salomeModule->createStandardAction(label,this,SLOT(OnChangeUnderlyingMesh()),icon);
111 _salomeModule->addActionInPopupMenu(actionId);
113 label = tr("LAB_INTERPOLATE_FIELD");
114 icon = tr("ICO_DATASOURCE_INTERPOLATE_FIELD");
115 actionId = _salomeModule->createStandardAction(label,this,SLOT(OnInterpolateField()),icon);
116 _salomeModule->addActionInPopupMenu(actionId);
120 * This function adds the specified MED file as a datasource in the
121 * dataspace. Technically speaking, the engine loads the
122 * meta-information concerning med data from the file, gives this
123 * informations to the GUI, and the GUI creates a tree view of these
124 * data in the study object browser.
126 // This function emits a signal that will be caught by workspace to delegate command (datasource creation) to python console.
128 DatasourceController::addDatasource(const char* filename)
130 DatasourceEvent* event = new DatasourceEvent();
131 event->eventtype = DatasourceEvent::EVENT_ADD_DATASOURCE;
132 event->objectalias = filename;
133 emit datasourceSignal(event);
135 // After above data source creation, python console emits a signal, forwarded by workspace, to update the GUI
137 DatasourceController::updateTreeViewWithNewDatasource(const MEDCALC::DatasourceHandler* datasourceHandler)
139 if (!datasourceHandler) {
143 // We need a studyEditor updated on the active study
144 _studyEditor->updateActiveStudy();
146 // Create a datasource SObject as a father of the module root
147 SALOMEDS::SComponent_var root = _studyEditor->findRoot(QCHARSTAR(_salomeModule->moduleName()));
148 SALOMEDS::SObject_var soDatasource = _studyEditor->newObject(root);
149 _studyEditor->setName(soDatasource,datasourceHandler->name);
150 _studyEditor->setIcon(soDatasource,tr("ICO_DATASOURCE").toStdString().c_str());
151 _studyEditor->setParameterInt(soDatasource,OBJECT_ID,datasourceHandler->id);
154 // We can add the meshes as children of the datasource
155 MEDCALC::MeshHandlerList * meshHandlerList =
156 MEDFactoryClient::getDataManager()->getMeshList(datasourceHandler->id);
158 for(CORBA::ULong iMesh=0; iMesh<meshHandlerList->length(); iMesh++) {
159 MEDCALC::MeshHandler meshHandler = (*meshHandlerList)[iMesh];
160 SALOMEDS::SObject_var soMesh = _studyEditor->newObject(soDatasource);
161 _studyEditor->setName(soMesh,meshHandler.name);
162 _studyEditor->setIcon(soMesh,tr("ICO_DATASOURCE_MESH").toStdString().c_str());
163 _studyEditor->setParameterInt(soMesh,OBJECT_ID,meshHandler.id);
164 _studyEditor->setParameterBool(soMesh,OBJECT_IS_IN_WORKSPACE,false);
166 // We add the field timeseries defined on this mesh, as children
167 // of the mesh SObject
168 MEDCALC::FieldseriesHandlerList * fieldseriesHandlerList =
169 MEDFactoryClient::getDataManager()->getFieldseriesListOnMesh(meshHandler.id);
171 for(CORBA::ULong iFieldseries=0; iFieldseries<fieldseriesHandlerList->length(); iFieldseries++) {
172 MEDCALC::FieldseriesHandler fieldseriesHandler = (*fieldseriesHandlerList)[iFieldseries];
173 SALOMEDS::SObject_var soFieldseries = _studyEditor->newObject(soMesh);
175 std::string label(fieldseriesHandler.name);
176 label +=" ("+std::string(XmedDataObject::mapTypeOfFieldLabel[fieldseriesHandler.type])+")";
177 _studyEditor->setName(soFieldseries,label.c_str());
179 _studyEditor->setIcon(soFieldseries,tr("ICO_DATASOURCE_FIELD").toStdString().c_str());
180 _studyEditor->setParameterInt(soFieldseries,OBJECT_ID,fieldseriesHandler.id);
181 _studyEditor->setParameterBool(soFieldseries,OBJECT_IS_IN_WORKSPACE,false);
182 //std::cout << "soFieldseries.GetIOR(): " << soFieldseries._retn()->GetIOR() << std::endl;
183 //std::cout << _studyEditor->findObject(soFieldseries._retn()->GetIOR())->GetIOR() << std::endl;
184 std::cout << "soFieldseries.GetName(): " << soFieldseries._retn()->GetName() << std::endl;
191 DatasourceController::updateTreeViewWithNewPresentation(long presentationId)
193 if (presentationId < 0) {
197 std::string name = MEDFactoryClient::getPresentationManager()->getPresentationProperty(presentationId, "name");
201 void DatasourceController::OnAddDatasource()
203 // Dialog to get the filename where the input data are read from
205 filter.append(tr("FILE_FILTER_MED"));
207 QString anInitialPath = "";
208 if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
209 anInitialPath = QDir::currentPath();
211 QStringList filenames = SUIT_FileDlg::getOpenFileNames( _salomeModule->getApp()->desktop(),
214 tr("IMPORT_MED_FIELDS") );
216 if ( filenames.count() <= 0 ) return;
217 for ( QStringList::ConstIterator itFile = filenames.begin();
218 itFile != filenames.end(); ++itFile ) {
219 QString filename = *itFile;
220 this->addDatasource(QCHARSTAR(filename));
221 _salomeModule->updateObjBrowser(true);
225 #include "DlgImageToMed.hxx"
227 //#include <stdlib.h>
228 void DatasourceController::OnAddImagesource()
231 DlgImageToMed dialog;
232 dialog.setAutoLoaded(true);
233 int choice = dialog.exec();
234 if ( choice == QDialog::Rejected ) {
235 // The user decides to cancel the operation
239 QString imageFilename = dialog.getImageFilepath();
241 QString medFilename = dialog.getMedFilepath();
242 bool autoLoad = dialog.isAutoLoaded();
244 std::string ROOT_DIR(getenv("MED_ROOT_DIR"));
245 std::string command(ROOT_DIR+"/bin/salome/med/image2med.py");
246 command += " -i "+QS2S(imageFilename);
247 command += " -m "+QS2S(medFilename);
248 int error = system(command.c_str());
250 QMessageBox::critical(_salomeModule->getApp()->desktop(),
251 tr("Operation failed"),
252 tr("The creation of med data from the image file failed"));
257 this->addDatasource(QCHARSTAR(medFilename));
258 _salomeModule->updateObjBrowser(true);
262 DatasourceEvent* event = new DatasourceEvent();
263 event->eventtype = DatasourceEvent::EVENT_ADD_IMAGE_AS_DATASOURCE;
264 event->objectalias = imageFilename;
265 emit datasourceSignal(event);
268 void DatasourceController::OnExpandField()
270 // We need a studyEditor updated on the active study
271 _studyEditor->updateActiveStudy();
273 // Get the selected objects in the study (SObject)
274 SALOME_StudyEditor::SObjectList * listOfSObject = _studyEditor->getSelectedObjects();
275 for (int i=0; i<listOfSObject->size(); i++) {
276 SALOMEDS::SObject_var soFieldseries = listOfSObject->at(i);
278 // First retrieve the fieldseries id associated to this study object
279 long fieldseriesId = _studyEditor->getParameterInt(soFieldseries,OBJECT_ID);
280 STDLOG("Expand the field timeseries "<<fieldseriesId);
282 // If fieldseriesId equals -1, then it means that it is not a
283 // fieldseries managed by the MED module, and we stop this
285 if ( fieldseriesId < 0 )
287 // _GBO_ A better correction should be to no display the
288 // contextual menu if the selected object is not conform
290 // Then retrieve the list of fields in this timeseries
291 MEDCALC::FieldHandlerList * fieldHandlerList =
292 MEDFactoryClient::getDataManager()->getFieldListInFieldseries(fieldseriesId);
294 // Finally, create an entry for each of the field
295 for(CORBA::ULong iField=0; iField<fieldHandlerList->length(); iField++) {
296 MEDCALC::FieldHandler fieldHandler = (*fieldHandlerList)[iField];
297 SALOMEDS::SObject_var soField = _studyEditor->newObject(soFieldseries);
298 std::string label("it="); label += ToString(fieldHandler.iteration);
299 _studyEditor->setName(soField,label.c_str());
300 _studyEditor->setParameterInt(soField, OBJECT_ID, fieldHandler.id);
301 _studyEditor->setParameterBool(soField,OBJECT_IS_IN_WORKSPACE,false);
304 _salomeModule->updateObjBrowser(true);
307 void DatasourceController::visualize(DatasourceEvent::EventType eventType) {
308 // We need a _studyEditor updated on the active study
309 _studyEditor->updateActiveStudy();
311 // Get the selected objects in the study (SObject)
312 SALOME_StudyEditor::SObjectList * listOfSObject = _studyEditor->getSelectedObjects();
314 // For each object, emit a signal to the workspace to request a
315 // visualisation using the tui command (so that the user can see how
316 // to make a view of an object from the tui console).
317 for (int i=0; i<listOfSObject->size(); i++) {
318 SALOMEDS::SObject_var soField = listOfSObject->at(i);
319 int fieldId = _studyEditor->getParameterInt(soField,OBJECT_ID);
320 // If fieldId equals -1, then it means that it is not a field
321 // managed by the MED module, and we stop this function process.
325 MEDCALC::FieldHandler * fieldHandler = MEDFactoryClient::getDataManager()->getFieldHandler(fieldId);
326 if (! fieldHandler) {
327 QMessageBox::warning(_salomeModule->getApp()->desktop(),
328 tr("Operation not allowed"),
329 tr("No field is defined"));
333 DatasourceEvent * event = new DatasourceEvent();
334 event->eventtype = eventType;
335 XmedDataObject * dataObject = new XmedDataObject();
336 dataObject->setFieldHandler(*fieldHandler);
337 event->objectdata = dataObject;
338 emit datasourceSignal(event);
342 void DatasourceController::OnVisualizeScalarMap() {
343 this->visualize(DatasourceEvent::EVENT_VIEW_OBJECT_SCALAR_MAP);
346 void DatasourceController::OnUseInWorkspace() {
347 // We need a studyEditor updated on the active study
348 _studyEditor->updateActiveStudy();
350 // Get the selected objects in the study (SObject)
351 SALOME_StudyEditor::SObjectList * listOfSObject = _studyEditor->getSelectedObjects();
352 if ( listOfSObject->size() == 1 ) {
353 // In this case we ask the name of the variable for the python
357 // _GBO_ Note that it works only for a single field but the
358 // XmedDataObject will be improved to deal with mesh, timeseries
359 // and single field in a futur version. We suppose here that a
360 // single field has been selected.
363 SALOMEDS::SObject_var soField = listOfSObject->at(0);
365 bool isInWorkspace = _studyEditor->getParameterBool(soField,OBJECT_IS_IN_WORKSPACE);
366 if ( isInWorkspace ) {
367 QMessageBox::warning(_salomeModule->getApp()->desktop(),
368 tr("Operation not allowed"),
369 tr("This field is already defined in the workspace"));
373 int fieldId = _studyEditor->getParameterInt(soField,OBJECT_ID);
375 // If fieldId equals -1, then it means that it is not a field
376 // managed by the MED module, and we stop this function process.
378 QMessageBox::warning(_salomeModule->getApp()->desktop(),
379 tr("Operation not allowed"),
380 tr("This element is not a field object"));
384 MEDCALC::FieldHandler * fieldHandler =
385 MEDFactoryClient::getDataManager()->getFieldHandler(fieldId);
387 if (! fieldHandler) {
388 QMessageBox::warning(_salomeModule->getApp()->desktop(),
389 tr("Operation not allowed"),
390 tr("No field is defined"));
394 QString alias(fieldHandler->fieldname);
396 dialog.setAlias(alias);
397 int choice = dialog.exec();
398 if ( choice == QDialog::Rejected ) {
399 // The user decides to cancel the operation
402 alias = dialog.getAlias();
404 DatasourceEvent * event = new DatasourceEvent();
405 event->eventtype = DatasourceEvent::EVENT_USE_OBJECT;
406 XmedDataObject * dataObject = new XmedDataObject();
407 dataObject->setFieldHandler(*fieldHandler);
408 event->objectdata = dataObject;
409 event->objectalias = alias;
410 emit datasourceSignal(event);
411 // Tag the item to prevent double import
412 // _studyEditor->setParameterBool(soField,OBJECT_IS_IN_WORKSPACE,true);
413 // Tag the field as persistent on the server. It means that a
414 // saving of the workspace will save at least this field (maybe it
415 // should be an option?)
416 MEDFactoryClient::getDataManager()->markAsPersistent(fieldId, true);
419 // In this case, we don't ask the user to specify an alias for
420 // each item, we just import the whole set of items.
421 for (int i=0; i<listOfSObject->size(); i++) {
422 SALOMEDS::SObject_var soField = listOfSObject->at(i);
424 bool isInWorkspace = _studyEditor->getParameterBool(soField,OBJECT_IS_IN_WORKSPACE);
425 if ( !isInWorkspace ) {
426 int fieldId = _studyEditor->getParameterInt(soField,OBJECT_ID);
427 MEDCALC::FieldHandler * fieldHandler =
428 MEDFactoryClient::getDataManager()->getFieldHandler(fieldId);
429 DatasourceEvent * event = new DatasourceEvent();
430 event->eventtype = DatasourceEvent::EVENT_IMPORT_OBJECT;
431 XmedDataObject * dataObject = new XmedDataObject();
432 dataObject->setFieldHandler(*fieldHandler);
433 event->objectdata = dataObject;
434 emit datasourceSignal(event);
435 // Note that this signal is processed by the WorkspaceController
437 // Tag the item to prevent double import
438 // _studyEditor->setParameterBool(soField,OBJECT_IS_IN_WORKSPACE,true);
439 // Tag the field as persistent on the server. It means that a
440 // saving of the workspace will save at least this field (maybe it
441 // should be an option?)
442 MEDFactoryClient::getDataManager()->markAsPersistent(fieldId, true);
445 STDLOG("The field "<<_studyEditor->getName(soField)<<
446 " is already defined in the workspace");
452 void DatasourceController::OnChangeUnderlyingMesh() {
453 // We need a studyEditor updated on the active study
454 _studyEditor->updateActiveStudy();
456 // Get the selected objects in the study (SObject). In cas of a
457 // multiple selection, we consider only the first item. At least one
458 // item must be selected.
459 SALOME_StudyEditor::SObjectList * listOfSObject = _studyEditor->getSelectedObjects();
460 if ( listOfSObject->size() > 0 ) {
461 SALOMEDS::SObject_var soField = listOfSObject->at(0);
462 int fieldId = _studyEditor->getParameterInt(soField,OBJECT_ID);
463 // _GBO_ : the dialog should not be modal, so that we can choose a
464 // mesh in the browser. Then we have to emit a signal from the
465 // dialog.accept, connected to a slot of the DatasourceControler
466 _dlgChangeUnderlyingMesh->setFieldId(fieldId);
467 Qt::WindowFlags flags = _dlgChangeUnderlyingMesh->windowFlags();
468 _dlgChangeUnderlyingMesh->setWindowFlags(flags | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint);
469 _dlgChangeUnderlyingMesh->open();
473 void DatasourceController::OnChangeUnderlyingMeshInputValidated() {
474 int meshId = _dlgChangeUnderlyingMesh->getMeshId();
475 STDLOG("meshId = " << ToString(meshId));
476 int fieldId = _dlgChangeUnderlyingMesh->getFieldId();
477 MEDCALC::FieldHandler * fieldHandler =
478 MEDFactoryClient::getDataManager()->getFieldHandler(fieldId);
480 // We don't modify the original field but create first a duplicate
481 MEDCALC::FieldHandler * duplicate = MEDFactoryClient::getCalculator()->dup(*fieldHandler);
482 MEDFactoryClient::getDataManager()->changeUnderlyingMesh(duplicate->id, meshId);
484 // Request once more the duplicate to update the meta-data on this
486 duplicate = MEDFactoryClient::getDataManager()->getFieldHandler(duplicate->id);
489 // WARN: the following is a temporary code for test purpose
490 // Automatically add in ws
491 DatasourceEvent * event = new DatasourceEvent();
492 event->eventtype = DatasourceEvent::EVENT_IMPORT_OBJECT;
493 XmedDataObject * dataObject = new XmedDataObject();
494 dataObject->setFieldHandler(*duplicate);
495 event->objectdata = dataObject;
496 emit datasourceSignal(event);
497 // Note that this signal is processed by the WorkspaceController
499 // Tag the item to prevent double import
500 //_studyEditor->setParameterBool(soField,OBJECT_IS_IN_WORKSPACE,true);
503 void DatasourceController::OnInterpolateField() {
504 // We need a studyEditor updated on the active study
505 _studyEditor->updateActiveStudy();
507 // Get the selected objects in the study (SObject). In case of a
508 // multiple selection, we consider only the first item. At least one
509 // item must be selected.
510 SALOME_StudyEditor::SObjectList * listOfSObject = _studyEditor->getSelectedObjects();
511 if ( listOfSObject->size() > 0 ) {
512 SALOMEDS::SObject_var soField = listOfSObject->at(0);
513 int fieldId = _studyEditor->getParameterInt(soField,OBJECT_ID);
514 // _GBO_ : the dialog should not be modal, so that we can choose a
515 // mesh in the browser. Then we have to emit a signal from the
516 // dialog.accept, connected to a slot of the DatasourceControler
517 _dlgInterpolateField->setFieldId(fieldId);
518 Qt::WindowFlags flags = _dlgInterpolateField->windowFlags();
519 _dlgInterpolateField->setWindowFlags(flags | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint);
520 _dlgInterpolateField->open();
524 void DatasourceController::OnInterpolateFieldInputValidated() {
525 MEDCALC::InterpolationParameters params;
526 params.precision = _dlgInterpolateField->getPrecision();
527 STDLOG("precision = " << params.precision);
528 params.defaultValue = _dlgInterpolateField->getDefaultValue();
529 STDLOG("defaultValue = " << params.defaultValue);
530 params.reverse = _dlgInterpolateField->getReverse();
531 STDLOG("reverse = " << params.reverse);
532 params.intersectionType = _dlgInterpolateField->getIntersectionType().c_str();
533 STDLOG("intersectionType = " << params.intersectionType);
534 params.method = _dlgInterpolateField->getMethod().c_str();
535 STDLOG("method = " << params.method);
536 params.nature = _dlgInterpolateField->getFieldNature().c_str();
537 STDLOG("nature = " << params.nature);
539 int meshId = _dlgInterpolateField->getMeshId();
540 STDLOG("meshId = " << ToString(meshId));
541 int fieldId = _dlgInterpolateField->getFieldId();
542 MEDCALC::FieldHandler* fieldHandler = MEDFactoryClient::getDataManager()->getFieldHandler(fieldId);
544 // We don't modify the original field but create first a duplicate
545 // MEDCALC::FieldHandler* duplicate = MEDFactoryClient::getCalculator()->dup(*fieldHandler);
546 //MEDFactoryClient::getDataManager()->changeUnderlyingMesh(duplicate->id, meshId);
547 MEDCALC::FieldHandler* result = NULL;
549 result = MEDFactoryClient::getDataManager()->interpolateField(fieldId, meshId, params);
552 STDLOG("Unable to process field interpolation; please check interpolation parameters");
553 QMessageBox::critical(_salomeModule->getApp()->desktop(),
554 tr("Operation failed"),
555 tr("Unable to process field interpolation; please check interpolation parameters"));
559 // Request once more the duplicate to update the meta-data on this
561 // duplicate = MEDFactoryClient::getDataManager()->getFieldHandler(duplicate->id);
564 // WARN: the following is a temporary code for test purpose
565 // Automatically add in ws
566 DatasourceEvent * event = new DatasourceEvent();
567 event->eventtype = DatasourceEvent::EVENT_IMPORT_OBJECT;
568 XmedDataObject * dataObject = new XmedDataObject();
569 dataObject->setFieldHandler(*result);
570 event->objectdata = dataObject;
571 emit datasourceSignal(event);
572 // Note that this signal is processed by the WorkspaceController
574 // // Tag the item to prevent double import
575 // //_studyEditor->setParameterBool(soField,OBJECT_IS_IN_WORKSPACE,true);
579 DatasourceController::processWorkspaceEvent(const MEDCALC::MedEvent* event)
581 if ( event->type == MEDCALC::EVENT_ADD_DATASOURCE ) {
582 MEDCALC::DatasourceHandler* datasourceHandler = MEDFactoryClient::getDataManager()->getDatasourceHandler(event->filename);
583 this->updateTreeViewWithNewDatasource(datasourceHandler);
584 _salomeModule->updateObjBrowser(true);
586 else if ( event->type == MEDCALC::EVENT_ADD_PRESENTATION ) {
587 this->updateTreeViewWithNewPresentation(event->dataId);
588 _salomeModule->updateObjBrowser(true);