MEDEventListener_i.hxx
WorkspaceController.hxx
DatasourceController.hxx
- PresentationController.hxx)
+ PresentationController.hxx
+ ProcessingController.hxx
+ )
QT_WRAP_MOC(MEDCALCGUI_HEADERS_MOC ${MEDCALCGUI_HEADERS})
// Datasource controller
// ==============================================================
//
-//DatasourceController::DatasourceController(StandardApp_Module* salomeModule)
DatasourceController::DatasourceController(MEDModule* salomeModule)
{
STDLOG("Creating a DatasourceController");
_salomeModule = salomeModule;
_studyEditor = _salomeModule->getStudyEditor();
-
- _dlgChangeUnderlyingMesh = new DlgChangeUnderlyingMesh(_studyEditor);
- connect(_dlgChangeUnderlyingMesh,SIGNAL(inputValidated()),
- this, SLOT(OnChangeUnderlyingMeshInputValidated()));
-
- _dlgInterpolateField = new DlgInterpolateField(_studyEditor);
- connect(_dlgInterpolateField,SIGNAL(inputValidated()),
- this, SLOT(OnInterpolateFieldInputValidated()));
}
DatasourceController::~DatasourceController() {
}
void DatasourceController::createActions() {
- //QWidget* dsk = _salomeModule->getApp()->desktop();
- //SUIT_ResourceMgr* resMgr = _salomeModule->getApp()->resourceMgr();
int toolbarId = _salomeModule->createTool("Datasource", "DatasourceToolbar");
//
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);
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);
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);
}
/**
}
#include "DlgImageToMed.hxx"
-//#include <stdio.h>
-//#include <stdlib.h>
void DatasourceController::OnAddImagesource()
{
}
}
-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)
{
#include <MEDPresentation.hxx>
#include "XmedDataModel.hxx"
-#include "DlgChangeUnderlyingMesh.hxx"
-#include "DlgInterpolateField.hxx"
#include "MEDCALCGUI.hxx"
//
// The DatasourceController defines data structures and classes to
void createActions();
public slots:
- // Callback connected to dialog box validation signals
- void OnChangeUnderlyingMeshInputValidated();
- void OnInterpolateFieldInputValidated();
void processWorkspaceEvent(const MEDCALC::MedEvent* event);
signals:
void OnAddImagesource();
void OnExpandField();
void OnUseInWorkspace();
- void OnChangeUnderlyingMesh();
- void OnInterpolateField();
private:
void addDatasource(const char* filename);
private:
MEDModule* _salomeModule;
SALOME_AppStudyEditor* _studyEditor; // borrowed to MEDModule
-
- DlgChangeUnderlyingMesh* _dlgChangeUnderlyingMesh;
- DlgInterpolateField* _dlgInterpolateField;
-
};
#endif
MED_ORB::MED_Gen_var MEDModule::myEngine;
MEDModule::MEDModule() :
- SalomeApp_Module("MED"), _studyEditor(0), _datasourceController(0), _workspaceController(0), _presentationController(0)
+ SalomeApp_Module("MED"), _studyEditor(0), _datasourceController(0), _workspaceController(0), _presentationController(0), _processingController(0)
{
// Note also that we can't use the getApp() function here because
// the initialize(...) function has not been called yet.
// delete _workspaceController;
if (_presentationController)
delete _presentationController;
+ if (_processingController)
+ delete _processingController;
}
MED_ORB::MED_Gen_var
_xmedDataModel = new XmedDataModel();
_workspaceController->setDataModel(_xmedDataModel);
_presentationController = new PresentationController(this);
+ _processingController = new ProcessingController(this);
connect(_datasourceController, SIGNAL(datasourceSignal(const DatasourceEvent*)),
_workspaceController, SLOT(processDatasourceEvent(const DatasourceEvent*)));
connect(_presentationController, SIGNAL(presentationSignal(const PresentationEvent*)),
_workspaceController, SLOT(processPresentationEvent(const PresentationEvent*)));
+ connect(_processingController, SIGNAL(processingSignal(const ProcessingEvent*)),
+ _workspaceController, SLOT(processProcessingEvent(const ProcessingEvent*)));
+
connect(_workspaceController, SIGNAL(workspaceSignal(const MEDCALC::MedEvent*)),
_datasourceController, SLOT(processWorkspaceEvent(const MEDCALC::MedEvent*)));
_datasourceController->createActions();
_workspaceController->createActions();
_presentationController->createActions();
+ _processingController->createActions();
}
int
#include "XmedDataModel.hxx"
#include "DatasourceController.hxx"
#include "PresentationController.hxx"
+#include "ProcessingController.hxx"
#include <SALOMEconfig.h>
#include CORBA_CLIENT_HEADER(MED_Gen)
WorkspaceController* _workspaceController;
XmedDataModel* _xmedDataModel;
PresentationController* _presentationController;
+ ProcessingController* _processingController;
static MED_ORB::MED_Gen_var myEngine;
};
<translation>datasource_add.png</translation>
</message>
<message>
- <source>ICO_DATASOURCE_CHANGE_MESH</source>
- <translation>datasource_changeUnderlyingMesh.png</translation>
+ <source>ICO_PROCESSING_CHANGE_MESH</source>
+ <translation>processing_changeUnderlyingMesh.png</translation>
</message>
<message>
- <source>ICO_DATASOURCE_INTERPOLATE_FIELD</source>
- <translation>datasource_interpolateField.png</translation>
+ <source>ICO_PROCESSING_INTERPOLATE_FIELD</source>
+ <translation>processing_interpolateField.png</translation>
</message>
<message>
<source>ICO_DATASOURCE_EXPAND_FIELD</source>
<translation>Point sprite</translation>
</message>
</context>
+ <context>
+ <name>ProcessingController</name>
+ <message>
+ <source>MENU_PROCESSING</source>
+ <translation>Processing</translation>
+ </message>
+ <message>
+ <source>LAB_PROCESSING_CHANGE_MESH</source>
+ <translation>Change underlying mesh</translation>
+ </message>
+ <message>
+ <source>LAB_PROCESSING_INTERPOLATE_FIELD</source>
+ <translation>Interpolate field</translation>
+ </message>
+ </context>
<context>
<name>DatasourceController</name>
<message>
<source>LAB_USE_IN_WORKSPACE</source>
<translation>Use in workspace</translation>
</message>
- <message>
- <location filename="MEDCALC/gui/DatasourceController.cxx" line="83"/>
- <source>LAB_CHANGE_MESH</source>
- <translation>Change underlying mesh</translation>
- </message>
- <message>
- <location filename="MEDCALC/gui/DatasourceController.cxx" line="113"/>
- <source>LAB_INTERPOLATE_FIELD</source>
- <translation>Interpolate field</translation>
- </message>
<message>
<location filename="MEDCALC/gui/DatasourceController.cxx" line="157"/>
<source>IMPORT_MED_FIELDS</source>
<translation>Point sprite</translation>
</message>
</context>
+ <context>
+ <name>ProcessingController</name>
+ <message>
+ <source>MENU_PROCESSING</source>
+ <translation>Traitement</translation>
+ </message>
+ <message>
+ <source>LAB_PROCESSING_CHANGE_MESH</source>
+ <translation>Changer le maillage sous-jacent</translation>
+ </message>
+ <message>
+ <source>LAB_PROCESSING_INTERPOLATE_FIELD</source>
+ <translation>Interpoler le champ</translation>
+ </message>
+ </context>
<context>
<name>DatasourceController</name>
<message>
<source>LAB_USE_IN_WORKSPACE</source>
<translation>Utiliser dans l'espace de travail</translation>
</message>
- <message>
- <location filename="MEDCALC/gui/DatasourceController.cxx" line="83"/>
- <source>LAB_CHANGE_MESH</source>
- <translation>Changer le maillage sous-jacent</translation>
- </message>
- <message>
- <location filename="MEDCALC/gui/DatasourceController.cxx" line="113"/>
- <source>LAB_INTERPOLATE_FIELD</source>
- <translation>Interpoler le champ</translation>
- </message>
<message>
<location filename="MEDCALC/gui/DatasourceController.cxx" line="157"/>
<source>IMPORT_MED_FIELDS</source>
{
STDLOG("Creating PresentationController actions");
- int presentationToolbarId = _salomeModule->createTool("View Mode", "PresentationToolbar");
+ int presentationToolbarId = _salomeModule->createTool("Presentations", "PresentationToolbar");
int presentationMenuId = _salomeModule->createMenu(tr("MENU_PRESENTATIONS"), -1, 1);
// Presentations
};
int eventtype;
XmedDataObject* objectdata;
- QString objectalias;
} PresentationEvent;
class MEDModule;
--- /dev/null
+// Copyright (C) 2016 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "ProcessingController.hxx"
+#include "DatasourceConstants.hxx"
+
+#include "MEDFactoryClient.hxx"
+#include "MEDModule.hxx"
+#include "Basics_Utils.hxx"
+
+#include <SUIT_Desktop.h>
+
+ProcessingController::ProcessingController(MEDModule* salomeModule)
+{
+ STDLOG("Creating a ProcessingController");
+ _salomeModule = salomeModule;
+ _studyEditor = _salomeModule->getStudyEditor();
+
+ _dlgChangeUnderlyingMesh = new DlgChangeUnderlyingMesh(_studyEditor);
+ connect(_dlgChangeUnderlyingMesh,SIGNAL(inputValidated()),
+ this, SLOT(OnChangeUnderlyingMeshInputValidated()));
+
+ _dlgInterpolateField = new DlgInterpolateField(_studyEditor);
+ connect(_dlgInterpolateField,SIGNAL(inputValidated()),
+ this, SLOT(OnInterpolateFieldInputValidated()));
+}
+
+ProcessingController::~ProcessingController()
+{
+ STDLOG("Deleting the ProcessingController");
+}
+
+void
+ProcessingController::createActions()
+{
+ STDLOG("Creating ProcessingController actions");
+
+ int processingToolbarId = _salomeModule->createTool("Processing", "ProcessingToolbar");
+ int processingMenuId = _salomeModule->createMenu(tr("MENU_PROCESSING"), -1, 1);
+
+ // 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.
+ QString label = tr("LAB_PROCESSING_CHANGE_MESH");
+ QString icon = tr("ICO_PROCESSING_CHANGE_MESH");
+ int actionId;
+ actionId = _salomeModule->createStandardAction(label,this, SLOT(OnChangeUnderlyingMesh()),icon,label);
+ _salomeModule->createTool(actionId, processingToolbarId);
+ _salomeModule->action(actionId)->setIconVisibleInMenu(true);
+ _salomeModule->createMenu(actionId, processingMenuId);
+
+ label = tr("LAB_PROCESSING_INTERPOLATE_FIELD");
+ icon = tr("ICO_PROCESSING_INTERPOLATE_FIELD");
+ actionId = _salomeModule->createStandardAction(label,this, SLOT(OnInterpolateField()),icon,label);
+ _salomeModule->createTool(actionId, processingToolbarId);
+ _salomeModule->action(actionId)->setIconVisibleInMenu(true);
+ _salomeModule->createMenu(actionId, processingMenuId);
+}
+
+void
+ProcessingController::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
+ProcessingController::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
+ ProcessingEvent* event = new ProcessingEvent();
+ event->eventtype = ProcessingEvent::EVENT_IMPORT_OBJECT;
+ XmedDataObject* dataObject = new XmedDataObject();
+ dataObject->setFieldHandler(*duplicate);
+ event->objectdata = dataObject;
+ emit processingSignal(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
+ProcessingController::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
+ProcessingController::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
+ ProcessingEvent* event = new ProcessingEvent();
+ event->eventtype = ProcessingEvent::EVENT_IMPORT_OBJECT;
+ XmedDataObject* dataObject = new XmedDataObject();
+ dataObject->setFieldHandler(*result);
+ event->objectdata = dataObject;
+ emit processingSignal(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);
+}
--- /dev/null
+// Copyright (C) 2016 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef PROCESSING_CONTROLLER_HXX
+#define PROCESSING_CONTROLLER_HXX
+
+#include "MEDCALCGUI.hxx"
+
+#include "MEDEventListener_i.hxx"
+#include <SALOMEconfig.h>
+#include CORBA_CLIENT_HEADER(MEDDataManager)
+
+#include <QtGui>
+#include <SalomeApp_Module.h>
+#include <SALOME_AppStudyEditor.hxx>
+
+#include "XmedDataModel.hxx"
+#include "DlgChangeUnderlyingMesh.hxx"
+#include "DlgInterpolateField.hxx"
+
+typedef struct {
+ enum EventType {
+ EVENT_IMPORT_OBJECT,
+ EVENT_PROCESS_INTERPOLATE_FIELD,
+ EVENT_PROCESS_CHANGE_UNDERLYING_MESH
+ };
+ int eventtype;
+ XmedDataObject* objectdata;
+} ProcessingEvent;
+
+class MEDModule;
+
+class MEDCALCGUI_EXPORT ProcessingController : public QObject {
+ Q_OBJECT
+
+public:
+ ProcessingController(MEDModule* salomeModule);
+ ~ProcessingController();
+
+ void createActions();
+
+public slots:
+ // Callback connected to dialog box validation signals
+ void OnChangeUnderlyingMeshInputValidated();
+ void OnInterpolateFieldInputValidated();
+
+protected slots:
+ void OnChangeUnderlyingMesh();
+ void OnInterpolateField();
+
+signals:
+ void processingSignal(const ProcessingEvent*);
+
+private:
+ MEDModule* _salomeModule;
+ SALOME_AppStudyEditor* _studyEditor; // borrowed to MEDModule
+ DlgChangeUnderlyingMesh* _dlgChangeUnderlyingMesh;
+ DlgInterpolateField* _dlgInterpolateField;
+};
+
+#endif /* PROCESSING_CONTROLLER_HXX */
}
}
+void
+WorkspaceController::processProcessingEvent(const ProcessingEvent* event)
+{
+ XmedDataModel* dataModel = (XmedDataModel*)this->getDataModel();
+ if ( dataModel == NULL ) {
+ STDLOG("No data model associated to this tree view");
+ return;
+ }
+
+ // >>>
+ // __GBO__ To know what to do we should test the type, because the
+ // object could be a mesh, a timeseries or a single field. We test
+ // here the case of a single field. Moreover, there could have
+ // options such that "change the underlying mesh".
+ // <<<
+
+ XmedDataObject* dataObject = event->objectdata;
+
+ if ( event->eventtype == ProcessingEvent::EVENT_IMPORT_OBJECT ) {
+ std::cout << "IMPORT object in workspace: " << dataObject->toString() << std::endl;
+ STDLOG("IMPORT object in workspace:\n"<<dataObject->toString());
+ // _GBO_ QUESTION: tag automatically the object as a peristant object ??
+ // We first add the data object to the internal data model
+ dataModel->addDataObject(dataObject);
+ // Then we request the tree view to consider this new object
+ this->getDataTreeModel()->addData(dataObject);
+ }
+}
+
void WorkspaceController::OnSaveWorkspace() {
// Dialog to get the filename where the workspace must be saved into
#include "XmedConsoleDriver.hxx"
#include "DatasourceController.hxx"
#include "PresentationController.hxx"
+#include "ProcessingController.hxx"
#include "MEDCALCGUI.hxx"
#include <SALOMEconfig.h>
void processMedEvent(const MEDCALC::MedEvent* event);
void processDatasourceEvent(const DatasourceEvent* event);
void processPresentationEvent(const PresentationEvent* event);
+ void processProcessingEvent(const ProcessingEvent* event);
void OnSaveWorkspace();
void OnCleanWorkspace();