// Datasource controller
// ==============================================================
//
-//DatasourceController::DatasourceController(StandardApp_Module * salomeModule)
-DatasourceController::DatasourceController(MEDModule * salomeModule)
+//DatasourceController::DatasourceController(StandardApp_Module* salomeModule)
+DatasourceController::DatasourceController(MEDModule* salomeModule)
{
STDLOG("Creating a DatasourceController");
_salomeModule = salomeModule;
- _studyEditor = new SALOME_AppStudyEditor(_salomeModule->getApp());
+ _studyEditor = _salomeModule->getStudyEditor();
_dlgChangeUnderlyingMesh = new DlgChangeUnderlyingMesh(_studyEditor);
connect(_dlgChangeUnderlyingMesh,SIGNAL(inputValidated()),
DatasourceController::~DatasourceController() {
STDLOG("Deleting the DatasourceController");
- delete _studyEditor;
}
void DatasourceController::createActions() {
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
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");
_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<SalomeApp_Study*>(_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);
-}
-
void DatasourceController::OnAddDatasource()
{
// Dialog to get the filename where the input data are read from
_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; i<listOfSObject->size(); i++) {
SALOMEDS::SObject_var soFieldseries = listOfSObject->at(i);
// contextual menu if the selected object is not conform
// Then retrieve the list of fields in this timeseries
- MEDCALC::FieldHandlerList * fieldHandlerList =
+ MEDCALC::FieldHandlerList* fieldHandlerList =
MEDFactoryClient::getDataManager()->getFieldListInFieldseries(fieldseriesId);
// Finally, create an entry for each of the field
_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; i<listOfSObject->size(); 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
return;
}
- MEDCALC::FieldHandler * fieldHandler =
+ MEDCALC::FieldHandler* fieldHandler =
MEDFactoryClient::getDataManager()->getFieldHandler(fieldId);
if (! fieldHandler) {
}
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;
bool isInWorkspace = _studyEditor->getParameterBool(soField,OBJECT_IS_IN_WORKSPACE);
if ( !isInWorkspace ) {
int fieldId = _studyEditor->getParameterInt(soField,OBJECT_ID);
- MEDCALC::FieldHandler * fieldHandler =
+ 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);
// 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();
+ SALOME_StudyEditor::SObjectList* listOfSObject = _studyEditor->getSelectedObjects();
if ( listOfSObject->size() > 0 ) {
SALOMEDS::SObject_var soField = listOfSObject->at(0);
int fieldId = _studyEditor->getParameterInt(soField,OBJECT_ID);
int meshId = _dlgChangeUnderlyingMesh->getMeshId();
STDLOG("meshId = " << ToString(meshId));
int fieldId = _dlgChangeUnderlyingMesh->getFieldId();
- MEDCALC::FieldHandler * fieldHandler =
+ 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);
+ 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
// >>>
// WARN: the following is a temporary code for test purpose
// Automatically add in ws
- DatasourceEvent * event = new DatasourceEvent();
+ DatasourceEvent* event = new DatasourceEvent();
event->eventtype = DatasourceEvent::EVENT_IMPORT_OBJECT;
- XmedDataObject * dataObject = new XmedDataObject();
+ XmedDataObject* dataObject = new XmedDataObject();
dataObject->setFieldHandler(*duplicate);
event->objectdata = dataObject;
emit datasourceSignal(event);
// 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();
+ SALOME_StudyEditor::SObjectList* listOfSObject = _studyEditor->getSelectedObjects();
if ( listOfSObject->size() > 0 ) {
SALOMEDS::SObject_var soField = listOfSObject->at(0);
int fieldId = _studyEditor->getParameterInt(soField,OBJECT_ID);
// >>>
// WARN: the following is a temporary code for test purpose
// Automatically add in ws
- DatasourceEvent * event = new DatasourceEvent();
+ DatasourceEvent* event = new DatasourceEvent();
event->eventtype = DatasourceEvent::EVENT_IMPORT_OBJECT;
- XmedDataObject * dataObject = new XmedDataObject();
+ XmedDataObject* dataObject = new XmedDataObject();
dataObject->setFieldHandler(*result);
event->objectdata = dataObject;
emit datasourceSignal(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);
- }
}
EVENT_ADD_PRESENTATION
};
int eventtype;
- XmedDataObject * objectdata;
+ XmedDataObject* objectdata;
QString objectalias;
} DatasourceEvent;
Q_OBJECT
public:
- DatasourceController(MEDModule * salomeModule);
+ DatasourceController(MEDModule* salomeModule);
~DatasourceController();
void createActions();
// Callback connected to dialog box validation signals
void OnChangeUnderlyingMeshInputValidated();
void OnInterpolateFieldInputValidated();
- void processWorkspaceEvent(const MEDCALC::MedEvent * event);
+ void processWorkspaceEvent(const MEDCALC::MedEvent* event);
signals:
- void datasourceSignal(const DatasourceEvent * event);
+ void datasourceSignal(const DatasourceEvent* event);
protected slots:
void OnAddDatasource();
void OnAddImagesource();
void OnExpandField();
- void OnVisualizeScalarMap();
- void OnVisualizeContour();
- void OnVisualizeVectorField();
- void OnVisualizeSlices();
- void OnVisualizeDeflectionShape();
- void OnVisualizePointSprite();
void OnUseInWorkspace();
void OnChangeUnderlyingMesh();
void OnInterpolateField();
private:
- void visualize(DatasourceEvent::EventType);
void addDatasource(const char* filename);
void updateTreeViewWithNewDatasource(const MEDCALC::DatasourceHandler*);
- void updateTreeViewWithNewPresentation(long fieldId, long presentationId);
private:
MEDModule* _salomeModule;
- SALOME_AppStudyEditor * _studyEditor;
+ SALOME_AppStudyEditor* _studyEditor; // borrowed to MEDModule
- DlgChangeUnderlyingMesh * _dlgChangeUnderlyingMesh;
- DlgInterpolateField * _dlgInterpolateField;
+ DlgChangeUnderlyingMesh* _dlgChangeUnderlyingMesh;
+ DlgInterpolateField* _dlgInterpolateField;
};
MED_ORB::MED_Gen_var MEDModule::myEngine;
MEDModule::MEDModule() :
- SalomeApp_Module("MED")
+ SalomeApp_Module("MED"), _studyEditor(0), _datasourceController(0), _workspaceController(0), _presentationController(0)
{
// Note also that we can't use the getApp() function here because
// the initialize(...) function has not been called yet.
MEDModule::~MEDModule()
{
- // nothing to do
+ if (_studyEditor)
+ delete _studyEditor;
+ if (_datasourceController)
+ delete _datasourceController;
+ //if (_workspaceController)
+ // delete _workspaceController;
+ if (_presentationController)
+ delete _presentationController;
}
MED_ORB::MED_Gen_var
*/
void
MEDModule::createModuleWidgets() {
+ _studyEditor = new SALOME_AppStudyEditor(getApp());
_datasourceController = new DatasourceController(this);
_workspaceController = new WorkspaceController(this);
_xmedDataModel = new XmedDataModel();
_workspaceController->setDataModel(_xmedDataModel);
_presentationController = new PresentationController(this);
- connect(_datasourceController, SIGNAL(datasourceSignal(const DatasourceEvent *)),
- _workspaceController, SLOT(processDatasourceEvent(const DatasourceEvent *)));
+ connect(_datasourceController, SIGNAL(datasourceSignal(const DatasourceEvent*)),
+ _workspaceController, SLOT(processDatasourceEvent(const DatasourceEvent*)));
- connect(_workspaceController, SIGNAL(workspaceSignal(const MEDCALC::MedEvent *)),
- _datasourceController, SLOT(processWorkspaceEvent(const MEDCALC::MedEvent *)));
+ connect(_presentationController, SIGNAL(presentationSignal(const PresentationEvent*)),
+ _workspaceController, SLOT(processPresentationEvent(const PresentationEvent*)));
+
+ connect(_workspaceController, SIGNAL(workspaceSignal(const MEDCALC::MedEvent*)),
+ _datasourceController, SLOT(processWorkspaceEvent(const MEDCALC::MedEvent*)));
+
+ connect(_workspaceController, SIGNAL(workspaceSignal(const MEDCALC::MedEvent*)),
+ _presentationController, SLOT(processWorkspaceEvent(const MEDCALC::MedEvent*)));
}
void
int
MEDModule::createStandardAction(const QString& label,
- QObject * slotobject,
+ QObject* slotobject,
const char* slotmember,
const QString& iconName,
const QString& tooltip)
#include "MEDCALCGUI.hxx"
#include <SalomeApp_Module.h>
+#include <SALOME_AppStudyEditor.hxx>
#include "WorkspaceController.hxx"
#include "XmedDataModel.hxx"
static MED_ORB::MED_Gen_var engine();
- virtual void initialize( CAM_Application* app );
- virtual QString engineIOR() const;
+ virtual void initialize(CAM_Application* app);
+ virtual QString engineIOR() const;
- virtual QString iconName() const;
+ virtual QString iconName() const;
- virtual void windows( QMap<int, int>& theMap ) const;
- virtual void viewManagers( QStringList& theList ) const;
+ virtual void windows(QMap<int, int>& theMap) const;
+ virtual void viewManagers(QStringList& theList) const;
int createStandardAction(const QString& label,
- QObject * slotobject,
+ QObject* slotobject,
const char* slotmember,
const QString& iconName,
const QString& tooltip=QString());
- void addActionInPopupMenu(int actionId,const QString& menus="",const QString& rule="client='ObjectBrowser'");
+ void addActionInPopupMenu(int actionId,
+ const QString& menus="",
+ const QString& rule="client='ObjectBrowser'");
MEDCALC::MEDPresentationViewMode getSelectedViewMode();
+ inline SALOME_AppStudyEditor* getStudyEditor() { return _studyEditor; }
+
public slots:
- virtual bool activateModule( SUIT_Study* theStudy );
- virtual bool deactivateModule( SUIT_Study* theStudy );
+ virtual bool activateModule(SUIT_Study* theStudy);
+ virtual bool deactivateModule(SUIT_Study* theStudy);
private:
void createModuleWidgets();
static void init();
private:
- DatasourceController * _datasourceController;
- WorkspaceController * _workspaceController;
- XmedDataModel * _xmedDataModel;
- PresentationController * _presentationController;
+ SALOME_AppStudyEditor* _studyEditor;
+ DatasourceController* _datasourceController;
+ WorkspaceController* _workspaceController;
+ XmedDataModel* _xmedDataModel;
+ PresentationController* _presentationController;
static MED_ORB::MED_Gen_var myEngine;
};
<TS version="2.0" language="en_US">
<context>
<name>@default</name>
- <message>
- <source>ICO_MED_PRESENTATION</source>
- <translation>pqAppIcon16.png</translation>
- </message>
<message>
<source>ICO_IMPORT_MED</source>
<translation>datasource_add.png</translation>
<source>ICO_DATASOURCE_USE</source>
<translation>datasource_use.png</translation>
</message>
- <message>
- <source>ICO_DATASOURCE_VIEW</source>
- <translation>datasource_view.png</translation>
- </message>
<message>
<source>ICO_FOLDER</source>
<translation>folder.png</translation>
<source>ICO_WORKSPACE_SAVE</source>
<translation>workspace_save.png</translation>
</message>
+ <message>
+ <source>ICO_PRESENTATION_SCALAR_MAP</source>
+ <translation>scalarmap24.png</translation>
+ </message>
+ <message>
+ <source>ICO_PRESENTATION_CONTOUR</source>
+ <translation>pqIsosurface24.png</translation>
+ </message>
+ <message>
+ <source>ICO_PRESENTATION_VECTOR_FIELD</source>
+ <translation>pqGlyph24.png</translation>
+ </message>
+ <message>
+ <source>ICO_PRESENTATION_SLICES</source>
+ <translation>pqSlice24.png</translation>
+ </message>
+ <message>
+ <source>ICO_PRESENTATION_DEFLECTION_SHAPE</source>
+ <translation>pqWarp24.png</translation>
+ </message>
+ <message>
+ <source>ICO_PRESENTATION_POINT_SPRITE</source>
+ <translation>pqNodeMapData24.png</translation>
+ </message>
+ <message>
+ <source>ICO_MEDPresentationScalarMap</source>
+ <translation>scalarmap16.png</translation>
+ </message>
+ <message>
+ <source>ICO_MEDPresentationContour</source>
+ <translation>pqIsosurface16.png</translation>
+ </message>
+ <message>
+ <source>ICO_MEDPresentationVectorField</source>
+ <translation>pqGlyph16.png</translation>
+ </message>
+ <message>
+ <source>ICO_MEDPresentationSlices</source>
+ <translation>pqSlice16.png</translation>
+ </message>
+ <message>
+ <source>ICO_MEDPresentationDeflectionShape</source>
+ <translation>pqWarp16.png</translation>
+ </message>
+ <message>
+ <source>ICO_MEDPresentationPointSprite</source>
+ <translation>pqNodeMapData16.png</translation>
+ </message>
</context>
</TS>
<source>TIP_VIEW_MODE_SPLIT_VIEW</source>
<translation>Split</translation>
</message>
- </context>
- <context>
- <name>DatasourceController</name>
<message>
- <location filename="MEDCALC/gui/DatasourceController.cxx" line="45"/>
- <source>LAB_ADD_DATA_SOURCE</source>
- <translation>Add Data Source</translation>
+ <source>LAB_PRESENTATION_SCALAR_MAP</source>
+ <translation>Scalar map</translation>
</message>
<message>
- <location filename="MEDCALC/gui/DatasourceController.cxx" line="46"/>
- <source>TIP_ADD_DATA_SOURCE</source>
- <translation>Add a file data source (file providing med data)</translation>
+ <source>TIP_PRESENTATION_SCALAR_MAP</source>
+ <translation>Scalar map</translation>
</message>
<message>
- <location filename="MEDCALC/gui/DatasourceController.cxx" line="52"/>
- <source>LAB_ADD_IMAGE_SOURCE</source>
- <translation>Add Image Source</translation>
+ <source>LAB_PRESENTATION_CONTOUR</source>
+ <translation>Contour</translation>
</message>
<message>
- <location filename="MEDCALC/gui/DatasourceController.cxx" line="53"/>
- <source>TIP_ADD_IMAGE_SOURCE</source>
- <translation>Create a Data Source from an image file</translation>
+ <source>TIP_PRESENTATION_CONTOUR</source>
+ <translation>Contour</translation>
</message>
<message>
- <location filename="MEDCALC/gui/DatasourceController.cxx" line="62"/>
- <source>LAB_EXPAND_FIELD</source>
- <translation>Expand field timeseries</translation>
+ <source>LAB_PRESENTATION_VECTOR_FIELD</source>
+ <translation>Vector field</translation>
+ </message>
+ <message>
+ <source>TIP_PRESENTATION_VECTOR_FIELD</source>
+ <translation>Vector field</translation>
+ </message>
+ <message>
+ <source>LAB_PRESENTATION_SLICES</source>
+ <translation>Slices</translation>
+ </message>
+ <message>
+ <source>TIP_PRESENTATION_SLICES</source>
+ <translation>Slices</translation>
+ </message>
+ <message>
+ <source>LAB_PRESENTATION_DEFLECTION_SHAPE</source>
+ <translation>Deflection shape</translation>
+ </message>
+ <message>
+ <source>TIP_PRESENTATION_DEFLECTION_SHAPE</source>
+ <translation>Deflection shape</translation>
+ </message>
+ <message>
+ <source>LAB_PRESENTATION_POINT_SPRITE</source>
+ <translation>Point sprite</translation>
+ </message>
+ <message>
+ <source>TIP_PRESENTATION_POINT_SPRITE</source>
+ <translation>Point sprite</translation>
+ </message>
+ <message>
+ <source>MENU_PRESENTATIONS</source>
+ <translation>Presentations</translation>
</message>
<message>
- <source>LAB_VISUALIZE_SCALARMAP</source>
+ <source>MEDPresentationScalarMap</source>
<translation>Scalar map</translation>
</message>
<message>
- <source>LAB_VISUALIZE_CONTOUR</source>
+ <source>MEDPresentationContour</source>
<translation>Contour</translation>
</message>
<message>
- <source>LAB_VISUALIZE_VECTORFIELD</source>
+ <source>MEDPresentationVectorField</source>
<translation>Vector field</translation>
</message>
<message>
- <source>LAB_VISUALIZE_SLICES</source>
+ <source>MEDPresentationSlices</source>
<translation>Slices</translation>
</message>
<message>
- <source>LAB_VISUALIZE_DEFLECTIONSHAPE</source>
+ <source>MEDPresentationDeflectionShape</source>
<translation>Deflection shape</translation>
</message>
<message>
- <source>LAB_VISUALIZE_POINTSPRITE</source>
+ <source>MEDPresentationPointSprite</source>
<translation>Point sprite</translation>
</message>
+ </context>
+ <context>
+ <name>DatasourceController</name>
+ <message>
+ <location filename="MEDCALC/gui/DatasourceController.cxx" line="45"/>
+ <source>LAB_ADD_DATA_SOURCE</source>
+ <translation>Add Data Source</translation>
+ </message>
<message>
- <location filename="MEDCALC/gui/DatasourceController.cxx" line="69"/>
- <source>LAB_VISUALIZE</source>
- <translation>Visualize</translation>
+ <location filename="MEDCALC/gui/DatasourceController.cxx" line="46"/>
+ <source>TIP_ADD_DATA_SOURCE</source>
+ <translation>Add a file data source (file providing med data)</translation>
+ </message>
+ <message>
+ <location filename="MEDCALC/gui/DatasourceController.cxx" line="52"/>
+ <source>LAB_ADD_IMAGE_SOURCE</source>
+ <translation>Add Image Source</translation>
+ </message>
+ <message>
+ <location filename="MEDCALC/gui/DatasourceController.cxx" line="53"/>
+ <source>TIP_ADD_IMAGE_SOURCE</source>
+ <translation>Create a Data Source from an image file</translation>
+ </message>
+ <message>
+ <location filename="MEDCALC/gui/DatasourceController.cxx" line="62"/>
+ <source>LAB_EXPAND_FIELD</source>
+ <translation>Expand field timeseries</translation>
</message>
<message>
<location filename="MEDCALC/gui/DatasourceController.cxx" line="75"/>
<source>TIP_VIEW_MODE_SPLIT_VIEW</source>
<translation>Scinder</translation>
</message>
- </context>
- <context>
- <name>DatasourceController</name>
<message>
- <source>MEDPresentationScalarMap</source>
+ <source>LAB_PRESENTATION_SCALAR_MAP</source>
<translation>Carte scalaire</translation>
</message>
<message>
- <location filename="MEDCALC/gui/DatasourceController.cxx" line="45"/>
- <source>LAB_ADD_DATA_SOURCE</source>
- <translation>Importer des données MED</translation>
+ <source>TIP_PRESENTATION_SCALAR_MAP</source>
+ <translation>Carte scalaire</translation>
</message>
<message>
- <location filename="MEDCALC/gui/DatasourceController.cxx" line="46"/>
- <source>TIP_ADD_DATA_SOURCE</source>
- <translation>Ajouter des données par import de fichiers MED</translation>
+ <source>LAB_PRESENTATION_CONTOUR</source>
+ <translation>Contour</translation>
</message>
<message>
- <location filename="MEDCALC/gui/DatasourceController.cxx" line="52"/>
- <source>LAB_ADD_IMAGE_SOURCE</source>
- <translation>Ajouter une image</translation>
+ <source>TIP_PRESENTATION_CONTOUR</source>
+ <translation>Contour</translation>
</message>
<message>
- <location filename="MEDCALC/gui/DatasourceController.cxx" line="53"/>
- <source>TIP_ADD_IMAGE_SOURCE</source>
- <translation>Ajouter des données par import d'un fichier image</translation>
+ <source>LAB_PRESENTATION_VECTOR_FIELD</source>
+ <translation>Champ de vecteurs</translation>
</message>
<message>
- <location filename="MEDCALC/gui/DatasourceController.cxx" line="62"/>
- <source>LAB_EXPAND_FIELD</source>
- <translation>Étendre les series temporelles du champ</translation>
+ <source>TIP_PRESENTATION_VECTOR_FIELD</source>
+ <translation>Champ de vecteurs</translation>
</message>
<message>
- <source>LAB_VISUALIZE_SCALARMAP</source>
+ <source>LAB_PRESENTATION_SLICES</source>
+ <translation>Coupes</translation>
+ </message>
+ <message>
+ <source>TIP_PRESENTATION_SLICES</source>
+ <translation>Coupes</translation>
+ </message>
+ <message>
+ <source>LAB_PRESENTATION_DEFLECTION_SHAPE</source>
+ <translation>Déformée</translation>
+ </message>
+ <message>
+ <source>TIP_PRESENTATION_DEFLECTION_SHAPE</source>
+ <translation>Déformée</translation>
+ </message>
+ <message>
+ <source>LAB_PRESENTATION_POINT_SPRITE</source>
+ <translation>Point sprite</translation>
+ </message>
+ <message>
+ <source>TIP_PRESENTATION_POINT_SPRITE</source>
+ <translation>Point sprite</translation>
+ </message>
+ <message>
+ <source>MENU_PRESENTATIONS</source>
+ <translation>Présentations</translation>
+ </message>
+ <message>
+ <source>MEDPresentationScalarMap</source>
<translation>Carte scalaire</translation>
</message>
<message>
- <source>LAB_VISUALIZE_CONTOUR</source>
+ <source>MEDPresentationContour</source>
<translation>Contour</translation>
</message>
<message>
- <source>LAB_VISUALIZE_VECTORFIELD</source>
+ <source>MEDPresentationVectorField</source>
<translation>Champ de vecteurs</translation>
</message>
<message>
- <source>LAB_VISUALIZE_SLICES</source>
+ <source>MEDPresentationSlices</source>
<translation>Coupes</translation>
</message>
<message>
- <source>LAB_VISUALIZE_DEFLECTIONSHAPE</source>
+ <source>MEDPresentationDeflectionShape</source>
<translation>Déformée</translation>
</message>
<message>
- <source>LAB_VISUALIZE_POINTSPRITE</source>
+ <source>MEDPresentationPointSprite</source>
<translation>Point sprite</translation>
</message>
+ </context>
+ <context>
+ <name>DatasourceController</name>
+ <message>
+ <source>MEDPresentationScalarMap</source>
+ <translation>Carte scalaire</translation>
+ </message>
+ <message>
+ <location filename="MEDCALC/gui/DatasourceController.cxx" line="45"/>
+ <source>LAB_ADD_DATA_SOURCE</source>
+ <translation>Importer des données MED</translation>
+ </message>
<message>
- <location filename="MEDCALC/gui/DatasourceController.cxx" line="69"/>
- <source>LAB_VISUALIZE</source>
- <translation>Visualiser</translation>
+ <location filename="MEDCALC/gui/DatasourceController.cxx" line="46"/>
+ <source>TIP_ADD_DATA_SOURCE</source>
+ <translation>Ajouter des données par import de fichiers MED</translation>
+ </message>
+ <message>
+ <location filename="MEDCALC/gui/DatasourceController.cxx" line="52"/>
+ <source>LAB_ADD_IMAGE_SOURCE</source>
+ <translation>Ajouter une image</translation>
+ </message>
+ <message>
+ <location filename="MEDCALC/gui/DatasourceController.cxx" line="53"/>
+ <source>TIP_ADD_IMAGE_SOURCE</source>
+ <translation>Ajouter des données par import d'un fichier image</translation>
+ </message>
+ <message>
+ <location filename="MEDCALC/gui/DatasourceController.cxx" line="62"/>
+ <source>LAB_EXPAND_FIELD</source>
+ <translation>Étendre les series temporelles du champ</translation>
</message>
<message>
<location filename="MEDCALC/gui/DatasourceController.cxx" line="75"/>
//
#include "PresentationController.hxx"
+#include "DatasourceConstants.hxx"
#include "MEDModule.hxx"
#include "Basics_Utils.hxx"
#include "QtxActionGroup.h"
+#include "MEDFactoryClient.hxx"
+
+#include <SalomeApp_Application.h>
+#include <SalomeApp_Study.h>
+#include <SalomeApp_DataObject.h>
+
+#include <SALOMEDS_SObject.hxx>
+#include <SALOMEDS_Study.hxx>
+
+#include <SUIT_Desktop.h>
+#include <QMessageBox>
static const int OPTIONS_VIEW_MODE_ID = 943;
static const int OPTIONS_VIEW_MODE_REPLACE_ID = 944;
{
STDLOG("Creating a PresentationController");
_salomeModule = salomeModule;
+ _studyEditor = _salomeModule->getStudyEditor();
}
PresentationController::~PresentationController()
STDLOG("Creating PresentationController actions");
int toolbarId = _salomeModule->createTool("View Mode", "PresentationToolbar");
+ int presentationMenuId = _salomeModule->createMenu(tr("MENU_PRESENTATIONS"), -1, 1);
+
+ // View Mode
QtxActionGroup* ag = _salomeModule->createActionGroup(OPTIONS_VIEW_MODE_ID, true);
ag->setText("View mode");
ag->setUsesDropDown(true);
_salomeModule->createTool(OPTIONS_VIEW_MODE_ID, toolbarId);
+ // Presentations
+ label = tr("LAB_PRESENTATION_SCALAR_MAP");
+ tooltip = tr("TIP_PRESENTATION_SCALAR_MAP");
+ QString icon = tr("ICO_PRESENTATION_SCALAR_MAP");
+ int actionId;
+ actionId = _salomeModule->createStandardAction(label,this, SLOT(OnVisualizeScalarMap()),icon,tooltip);
+ _salomeModule->createTool(actionId, toolbarId);
+ _salomeModule->action(actionId)->setIconVisibleInMenu(true);
+ _salomeModule->createMenu(actionId, presentationMenuId);
+
+ label = tr("LAB_PRESENTATION_CONTOUR");
+ tooltip = tr("TIP_PRESENTATION_CONTOUR");
+ icon = tr("ICO_PRESENTATION_CONTOUR");
+ actionId = _salomeModule->createStandardAction(label,this, SLOT(OnVisualizeContour()),icon,tooltip);
+ _salomeModule->createTool(actionId, toolbarId);
+ _salomeModule->action(actionId)->setIconVisibleInMenu(true);
+ _salomeModule->createMenu(actionId, presentationMenuId);
+
+ label = tr("LAB_PRESENTATION_VECTOR_FIELD");
+ tooltip = tr("TIP_PRESENTATION_VECTOR_FIELD");
+ icon = tr("ICO_PRESENTATION_VECTOR_FIELD");
+ actionId = _salomeModule->createStandardAction(label,this, SLOT(OnVisualizeVectorField()),icon,tooltip);
+ _salomeModule->createTool(actionId, toolbarId);
+ _salomeModule->action(actionId)->setIconVisibleInMenu(true);
+ _salomeModule->createMenu(actionId, presentationMenuId);
+
+ label = tr("LAB_PRESENTATION_SLICES");
+ tooltip = tr("TIP_PRESENTATION_SLICES");
+ icon = tr("ICO_PRESENTATION_SLICES");
+ actionId = _salomeModule->createStandardAction(label,this, SLOT(OnVisualizeSlices()),icon,tooltip);
+ _salomeModule->createTool(actionId, toolbarId);
+ _salomeModule->action(actionId)->setIconVisibleInMenu(true);
+ _salomeModule->createMenu(actionId, presentationMenuId);
+ label = tr("LAB_PRESENTATION_DEFLECTION_SHAPE");
+ tooltip = tr("TIP_PRESENTATION_DEFLECTION_SHAPE");
+ icon = tr("ICO_PRESENTATION_DEFLECTION_SHAPE");
+ actionId = _salomeModule->createStandardAction(label,this, SLOT(OnVisualizeDeflectionShape()),icon,tooltip);
+ _salomeModule->createTool(actionId, toolbarId);
+ _salomeModule->action(actionId)->setIconVisibleInMenu(true);
+ _salomeModule->createMenu(actionId, presentationMenuId);
+
+ label = tr("LAB_PRESENTATION_POINT_SPRITE");
+ tooltip = tr("TIP_PRESENTATION_POINT_SPRITE");
+ icon = tr("ICO_PRESENTATION_POINT_SPRITE");
+ actionId = _salomeModule->createStandardAction(label,this, SLOT(OnVisualizePointSprite()),icon,tooltip);
+ _salomeModule->createTool(actionId, toolbarId);
+ _salomeModule->action(actionId)->setIconVisibleInMenu(true);
+ _salomeModule->createMenu(actionId, presentationMenuId);
}
MEDCALC::MEDPresentationViewMode
return MEDCALC::VIEW_MODE_SPLIT_VIEW;
}
}
+
+void
+PresentationController::visualize(PresentationEvent::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; i<listOfSObject->size(); 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;
+ }
+
+ PresentationEvent* event = new PresentationEvent();
+ event->eventtype = eventType;
+ XmedDataObject* dataObject = new XmedDataObject();
+ dataObject->setFieldHandler(*fieldHandler);
+ event->objectdata = dataObject;
+ emit presentationSignal(event);
+ }
+}
+
+void
+PresentationController::OnVisualizeScalarMap()
+{
+ this->visualize(PresentationEvent::EVENT_VIEW_OBJECT_SCALAR_MAP);
+}
+
+void
+PresentationController::OnVisualizeContour()
+{
+ this->visualize(PresentationEvent::EVENT_VIEW_OBJECT_CONTOUR);
+}
+
+void
+PresentationController::OnVisualizeVectorField()
+{
+ this->visualize(PresentationEvent::EVENT_VIEW_OBJECT_VECTOR_FIELD);
+}
+
+void
+PresentationController::OnVisualizeSlices()
+{
+ this->visualize(PresentationEvent::EVENT_VIEW_OBJECT_SLICES);
+}
+
+void
+PresentationController::OnVisualizeDeflectionShape()
+{
+ this->visualize(PresentationEvent::EVENT_VIEW_OBJECT_DEFLECTION_SHAPE);
+}
+
+void
+PresentationController::OnVisualizePointSprite()
+{
+ this->visualize(PresentationEvent::EVENT_VIEW_OBJECT_POINT_SPRITE);
+}
+
+void
+PresentationController::updateTreeViewWithNewPresentation(long fieldId, long presentationId)
+{
+ if (presentationId < 0) {
+ std::cerr << "Unknown presentation\n";
+ return;
+ }
+
+ std::string name = MEDFactoryClient::getPresentationManager()->getPresentationProperty(presentationId, "name");
+ std::string icon = std::string("ICO_") + name;
+ name = tr(name.c_str()).toStdString();
+ std::string label = tr(icon.c_str()).toStdString();
+
+ SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>(_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);
+}
+
+void
+PresentationController::processWorkspaceEvent(const MEDCALC::MedEvent* event)
+{
+ if ( event->type == MEDCALC::EVENT_ADD_PRESENTATION ) {
+ this->updateTreeViewWithNewPresentation(event->dataId, event->presentationId);
+ }
+}
#include <QtGui>
#include "MEDCALCGUI.hxx"
+#include "MEDEventListener_i.hxx"
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(MEDPresentationManager)
+#include CORBA_CLIENT_HEADER(MEDDataManager)
+
+#include "XmedDataModel.hxx"
+#include <SALOME_AppStudyEditor.hxx>
+
+typedef struct {
+ enum EventType {
+ EVENT_VIEW_OBJECT_CONTOUR,
+ EVENT_VIEW_OBJECT_DEFLECTION_SHAPE,
+ EVENT_VIEW_OBJECT_POINT_SPRITE,
+ EVENT_VIEW_OBJECT_SCALAR_MAP,
+ EVENT_VIEW_OBJECT_SLICES,
+ EVENT_VIEW_OBJECT_VECTOR_FIELD
+ };
+ int eventtype;
+ XmedDataObject* objectdata;
+ QString objectalias;
+} PresentationEvent;
class MEDModule;
MEDCALC::MEDPresentationViewMode getSelectedViewMode();
+signals:
+ void presentationSignal(const PresentationEvent* event);
+
+protected slots:
+ void OnVisualizeScalarMap();
+ void OnVisualizeContour();
+ void OnVisualizeVectorField();
+ void OnVisualizeSlices();
+ void OnVisualizeDeflectionShape();
+ void OnVisualizePointSprite();
+ void processWorkspaceEvent(const MEDCALC::MedEvent* event);
+
+private:
+ void visualize(PresentationEvent::EventType);
+ void updateTreeViewWithNewPresentation(long fieldId, long presentationId);
+
private:
MEDModule* _salomeModule;
+ SALOME_AppStudyEditor* _studyEditor; // borrowed to MEDModule
};
* and containing a tree view for rendering a hierarchical data
* model. This datamodel contains the objects used in the workspace.
*/
-//WorkspaceController::WorkspaceController(StandardApp_Module * salomeModule)
-WorkspaceController::WorkspaceController(MEDModule * salomeModule)
+//WorkspaceController::WorkspaceController(StandardApp_Module* salomeModule)
+WorkspaceController::WorkspaceController(MEDModule* salomeModule)
: TreeGuiManager(salomeModule->getApp(), "Workspace")
{
_salomeModule = salomeModule;
// with other parts of the application, in particular the python
// console that could retrieve this IOR using the
// getEventListenerIOR() function of the MEDDataManager.
- SalomeApp_Application * salomeApp = salomeModule->getApp();
- const char * medEventListenerIOR =
+ SalomeApp_Application* salomeApp = salomeModule->getApp();
+ const char* medEventListenerIOR =
salomeApp->orb()->object_to_string(medEventListenerServant);
MEDFactoryClient::getDataManager()->setEventListenerIOR(medEventListenerIOR);
* console (see _importItemList).
*/
void WorkspaceController::_importItem(QString itemNameId) {
- XmedDataModel * dataModel = (XmedDataModel *)this->getDataModel();
+ XmedDataModel* dataModel = (XmedDataModel*)this->getDataModel();
if ( dataModel == NULL ) {
LOG("No data model associated to this tree view");
return;
// We can request the dataModel to obtain the dataObject associated
// to this item (iteNameId is a TreeView id, Qt stuff only).
- XmedDataObject * dataObject =
- (XmedDataObject *)dataModel->getDataObject(QS2S(itemNameId));
+ XmedDataObject* dataObject =
+ (XmedDataObject*)dataModel->getDataObject(QS2S(itemNameId));
if ( dataObject == NULL ) {
LOG("WorkspaceController: WARN! No data object associated to the item "<<itemNameId);
// Then, we can request this data object to obtain the associated
// FieldHandler.
- MEDCALC::FieldHandler * fieldHandler = dataObject->getFieldHandler();
+ MEDCALC::FieldHandler* fieldHandler = dataObject->getFieldHandler();
STDLOG("Field: mesh="<<fieldHandler->meshname<<" name="<<fieldHandler->fieldname);
// Finally, we can import the field
* options or simply specify the alias (i.e. the name of the python
* variable).
*/
-void WorkspaceController::_importFieldIntoConsole(MEDCALC::FieldHandler * fieldHandler,
+void WorkspaceController::_importFieldIntoConsole(MEDCALC::FieldHandler* fieldHandler,
bool askForOptions,
- const char * alias)
+ const char* alias)
{
STDLOG("alias="<<alias);
// By default, the alias is the name of the field
- QString *effectiveAlias;
+ QString*effectiveAlias;
if ( alias == NULL ) {
effectiveAlias = new QString(fieldHandler->fieldname);
}
* emitted from the MEDEventListener. It processes events coming from
* the python console.
*/
-void WorkspaceController::processMedEvent(const MEDCALC::MedEvent * event) {
+void WorkspaceController::processMedEvent(const MEDCALC::MedEvent* event) {
STDLOG("WorkspaceController::processMedEvent");
STDLOG("dataId :"<<event->dataId);
- XmedDataModel * dataModel = (XmedDataModel *)this->getDataModel();
+ XmedDataModel* dataModel = (XmedDataModel*)this->getDataModel();
if ( dataModel == NULL ) {
STDLOG("No data model associated to this tree view");
return;
}
else if ( event->type == MEDCALC::EVENT_PUT_IN_WORKSPACE ) {
STDLOG("add new field");
- MEDCALC::FieldHandler * fieldHandler =
+ MEDCALC::FieldHandler* fieldHandler =
MEDFactoryClient::getDataManager()->getFieldHandler(event->dataId);
- XmedDataObject * dataObject = (XmedDataObject *)dataModel->newDataObject();
+ XmedDataObject* dataObject = (XmedDataObject*)dataModel->newDataObject();
dataObject->setFieldHandler(*fieldHandler);
this->getDataTreeModel()->addData(dataObject);
}
else if ( event->type == MEDCALC::EVENT_REMOVE_FROM_WORKSPACE ) {
STDLOG("remove field");
- std::map<string, DataObject *>::iterator itr = dataModel->begin();
+ std::map<string, DataObject*>::iterator itr = dataModel->begin();
for ( ; itr != dataModel->end(); ++itr) {
XmedDataObject* obj = dynamic_cast<XmedDataObject*>(itr->second);
if (obj->getFieldHandler()->id == event->dataId) {
}
else if ( event->type == MEDCALC::EVENT_CLEAN_WORKSPACE ) {
STDLOG("clean workspace");
- std::map<string, DataObject *>::iterator itr = dataModel->begin();
+ std::map<string, DataObject*>::iterator itr = dataModel->begin();
for ( ; itr != dataModel->end(); ++itr) {
XmedDataObject* obj = dynamic_cast<XmedDataObject*>(itr->second);
std::string itemNameId = obj->getNameId();
* name is requested to the user using a file chooser dialog box
*/
void WorkspaceController::_saveItemList(QStringList itemNameIdList) {
- XmedDataProcessor * dataProcessor = new XmedDataProcessor(this->getDataModel());
+ XmedDataProcessor* dataProcessor = new XmedDataProcessor(this->getDataModel());
dataProcessor->process(itemNameIdList);
MEDCALC::FieldIdList_var fieldIdList = dataProcessor->getResultingFieldIdList();
delete dataProcessor;
* This function remove the selected item from workspace.
*/
void WorkspaceController::_removeItemList(QStringList itemNameIdList) {
- XmedDataModel * dataModel = (XmedDataModel *)this->getDataModel();
+ XmedDataModel* dataModel = (XmedDataModel*)this->getDataModel();
if ( dataModel == NULL ) {
LOG("No data model associated to this tree view");
return;
// We can request the dataModel to obtain the dataObject associated
// to this item (iteNameId is a TreeView id, Qt stuff only).
- XmedDataObject * dataObject =
- (XmedDataObject *)dataModel->getDataObject(QS2S(itemNameId));
+ XmedDataObject* dataObject =
+ (XmedDataObject*)dataModel->getDataObject(QS2S(itemNameId));
if ( dataObject == NULL ) {
LOG("WorkspaceController: WARN! No data object associated to the item "<<itemNameId);
// Then, we can request this data object to obtain the associated
// FieldHandler.
- MEDCALC::FieldHandler * fieldHandler = dataObject->getFieldHandler();
+ MEDCALC::FieldHandler* fieldHandler = dataObject->getFieldHandler();
STDLOG("Field: mesh="<<fieldHandler->meshname<<" name="<<fieldHandler->fieldname);
// Remove the field variable from console
* scalar map of the first item to start the job.
*/
void WorkspaceController::_exportItemList(QStringList itemNameIdList) {
- XmedDataProcessor * dataProcessor = new XmedDataProcessor(this->getDataModel());
+ XmedDataProcessor* dataProcessor = new XmedDataProcessor(this->getDataModel());
dataProcessor->process(itemNameIdList);
MEDCALC::FieldIdList_var fieldIdList = dataProcessor->getResultingFieldIdList();
delete dataProcessor;
// _GBO_ We use a temporary file to proceed with this export to
// paravis. I'm sure it could be better in a futur version or when I
// will get a better understanding of paravis API.
- const char * tmpfilename = "/tmp/medcalc_export2paravis.med";
+ const char* tmpfilename = "/tmp/medcalc_export2paravis.med";
MEDFactoryClient::getDataManager()->saveFields(tmpfilename, fieldIdList);
// We import the whole file but create a scalar map for the first
// selected field only (it's just an export to continue the job in
// paravis)
- XmedDataModel * dataModel = (XmedDataModel *)this->getDataModel();
+ XmedDataModel* dataModel = (XmedDataModel*)this->getDataModel();
if ( dataModel == NULL ) {
STDLOG("No data model associated to this tree view");
return;
}
QString itemNameId = itemNameIdList[0];
- XmedDataObject * dataObject = (XmedDataObject *)dataModel->getDataObject(QS2S(itemNameId));
+ XmedDataObject* dataObject = (XmedDataObject*)dataModel->getDataObject(QS2S(itemNameId));
if ( dataObject == NULL ) {
LOG("WorkspaceController: WARN! No data object associated to the item "<<itemNameId);
return;
}
- MEDCALC::FieldHandler * fieldHandler = dataObject->getFieldHandler();
+ MEDCALC::FieldHandler* fieldHandler = dataObject->getFieldHandler();
QStringList commands;
/*
commands+=QString("from xmed.driver_pvis import pvis_scalarmap");
// __GBO__: In this version, we consider only the first field in the selection
QString itemNameId = itemNameIdList[0];
- XmedDataModel * dataModel = (XmedDataModel *)this->getDataModel();
+ XmedDataModel* dataModel = (XmedDataModel*)this->getDataModel();
if ( dataModel == NULL ) {
LOG("No data model associated to this tree view");
return;
// We can request the dataModel to obtain the dataObject associated
// to this item (iteNameId is a TreeView id, Qt stuff only).
- XmedDataObject * dataObject =
- (XmedDataObject *)dataModel->getDataObject(QS2S(itemNameId));
+ XmedDataObject* dataObject =
+ (XmedDataObject*)dataModel->getDataObject(QS2S(itemNameId));
if ( dataObject == NULL ) {
LOG("WorkspaceController: WARN! No data object associated to the item "<<itemNameId);
return;
// Then, we can request this data object to obtain the associated
// FieldHandler.
- MEDCALC::FieldHandler * fieldHandler = dataObject->getFieldHandler();
+ MEDCALC::FieldHandler* fieldHandler = dataObject->getFieldHandler();
// And finally, we can create the set of medcalc instructions to
// generate the scalar map on this field.
* DatasourceController. The connection between the datasource signal
* and this slot is realized by the main class MEDModule.
*/
-void WorkspaceController::processDatasourceEvent(const DatasourceEvent * event) {
- XmedDataModel * dataModel = (XmedDataModel *)this->getDataModel();
+void WorkspaceController::processDatasourceEvent(const DatasourceEvent* event) {
+ XmedDataModel* dataModel = (XmedDataModel*)this->getDataModel();
if ( dataModel == NULL ) {
STDLOG("No data model associated to this tree view");
return;
// options such that "change the underlying mesh".
// <<<
- XmedDataObject * dataObject = event->objectdata;
+ XmedDataObject* dataObject = event->objectdata;
if ( event->eventtype == DatasourceEvent::EVENT_IMPORT_OBJECT ) {
std::cout << "IMPORT object in workspace: " << dataObject->toString() << std::endl;
askForOptions,
QCHARSTAR(event->objectalias));
}
- else if ( event->eventtype == DatasourceEvent::EVENT_VIEW_OBJECT_SCALAR_MAP ) {
+ else if ( event->eventtype == DatasourceEvent::EVENT_ADD_DATASOURCE ) {
+ QStringList commands;
+ commands += QString("medcalc.LoadDataSource('%1')").arg(event->objectalias);
+ _consoleDriver->exec(commands);
+ }
+ else if ( event->eventtype == DatasourceEvent::EVENT_ADD_IMAGE_AS_DATASOURCE ) {
+ QStringList commands;
+ commands += QString("medcalc.LoadImageAsDataSource('%1')").arg(event->objectalias);
+ _consoleDriver->exec(commands);
+ }
+ else {
+ STDLOG("The event "<<event->eventtype<<" is not implemented yet");
+ }
+}
+/**
+ * This slot can process the event coming from the
+ * DatasourceController. The connection between the datasource signal
+ * and this slot is realized by the main class MEDModule.
+ */
+void WorkspaceController::processPresentationEvent(const PresentationEvent* 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 == PresentationEvent::EVENT_VIEW_OBJECT_SCALAR_MAP ) {
QString viewMode = _getViewMode();
MEDCALC::FieldHandler* fieldHandler = dataObject->getFieldHandler();
QStringList commands;
commands += QString("medcalc.MakeScalarMap(accessField(%1), %2)").arg(fieldHandler->id).arg(viewMode);
_consoleDriver->exec(commands);
}
- else if ( event->eventtype == DatasourceEvent::EVENT_VIEW_OBJECT_CONTOUR ) {
+ else if ( event->eventtype == PresentationEvent::EVENT_VIEW_OBJECT_CONTOUR ) {
QString viewMode = _getViewMode();
MEDCALC::FieldHandler* fieldHandler = dataObject->getFieldHandler();
QStringList commands;
commands += QString("medcalc.MakeContour(accessField(%1), %2)").arg(fieldHandler->id).arg(viewMode);
_consoleDriver->exec(commands);
}
- else if ( event->eventtype == DatasourceEvent::EVENT_VIEW_OBJECT_VECTOR_FIELD ) {
+ else if ( event->eventtype == PresentationEvent::EVENT_VIEW_OBJECT_VECTOR_FIELD ) {
QString viewMode = _getViewMode();
MEDCALC::FieldHandler* fieldHandler = dataObject->getFieldHandler();
QStringList commands;
commands += QString("medcalc.MakeVectorField(accessField(%1), %2)").arg(fieldHandler->id).arg(viewMode);
_consoleDriver->exec(commands);
}
- else if ( event->eventtype == DatasourceEvent::EVENT_VIEW_OBJECT_SLICES ) {
+ else if ( event->eventtype == PresentationEvent::EVENT_VIEW_OBJECT_SLICES ) {
QString viewMode = _getViewMode();
MEDCALC::FieldHandler* fieldHandler = dataObject->getFieldHandler();
QStringList commands;
commands += QString("medcalc.MakeSlices(accessField(%1), %2)").arg(fieldHandler->id).arg(viewMode);
_consoleDriver->exec(commands);
}
- else if ( event->eventtype == DatasourceEvent::EVENT_VIEW_OBJECT_DEFLECTION_SHAPE ) {
+ else if ( event->eventtype == PresentationEvent::EVENT_VIEW_OBJECT_DEFLECTION_SHAPE ) {
QString viewMode = _getViewMode();
MEDCALC::FieldHandler* fieldHandler = dataObject->getFieldHandler();
QStringList commands;
commands += QString("medcalc.MakeDeflectionShape(accessField(%1), %2)").arg(fieldHandler->id).arg(viewMode);
_consoleDriver->exec(commands);
}
- else if ( event->eventtype == DatasourceEvent::EVENT_VIEW_OBJECT_POINT_SPRITE ) {
+ else if ( event->eventtype == PresentationEvent::EVENT_VIEW_OBJECT_POINT_SPRITE ) {
QString viewMode = _getViewMode();
MEDCALC::FieldHandler* fieldHandler = dataObject->getFieldHandler();
QStringList commands;
commands += QString("medcalc.MakePointSprite(accessField(%1), %2)").arg(fieldHandler->id).arg(viewMode);
_consoleDriver->exec(commands);
}
- else if ( event->eventtype == DatasourceEvent::EVENT_ADD_DATASOURCE ) {
- QStringList commands;
- commands += QString("medcalc.LoadDataSource('%1')").arg(event->objectalias);
- _consoleDriver->exec(commands);
- }
- else if ( event->eventtype == DatasourceEvent::EVENT_ADD_IMAGE_AS_DATASOURCE ) {
- QStringList commands;
- commands += QString("medcalc.LoadImageAsDataSource('%1')").arg(event->objectalias);
- _consoleDriver->exec(commands);
- }
else {
STDLOG("The event "<<event->eventtype<<" is not implemented yet");
}
-
}
void WorkspaceController::OnSaveWorkspace() {
#include "MEDEventListener_i.hxx"
#include "XmedConsoleDriver.hxx"
#include "DatasourceController.hxx"
+#include "PresentationController.hxx"
#include "MEDCALCGUI.hxx"
#include <SALOMEconfig.h>
Q_OBJECT
public:
- WorkspaceController(MEDModule * salomeModule);
+ WorkspaceController(MEDModule* salomeModule);
~WorkspaceController();
void createActions();
void processItemList(QStringList itemNameIdList, int actionId);
// Internal slots
- void processMedEvent(const MEDCALC::MedEvent * event);
- void processDatasourceEvent(const DatasourceEvent * event);
+ void processMedEvent(const MEDCALC::MedEvent* event);
+ void processDatasourceEvent(const DatasourceEvent* event);
+ void processPresentationEvent(const PresentationEvent* event);
void OnSaveWorkspace();
void OnCleanWorkspace();
signals:
- void workspaceSignal(const MEDCALC::MedEvent * event);
+ void workspaceSignal(const MEDCALC::MedEvent* event);
private:
void _importItem(QString itemNameId);
void _importItemList(QStringList itemNameIdList);
- void _importFieldIntoConsole(MEDCALC::FieldHandler * fieldHandler,
+ void _importFieldIntoConsole(MEDCALC::FieldHandler* fieldHandler,
bool askForOptions,
- const char * alias=NULL);
+ const char* alias=NULL);
void _exportItemList(QStringList itemNameIdList);
void _saveItemList(QStringList itemNameIdList);
QString _getViewMode();
private:
- XmedConsoleDriver * _consoleDriver;
- MEDModule * _salomeModule;
- MEDEventListener_i * _medEventListener;
+ XmedConsoleDriver* _consoleDriver;
+ MEDModule* _salomeModule;
+ MEDEventListener_i* _medEventListener;
// This structure is intended to memorized in a bundle the whole set
// of integers identifying the actions of the popup menu associated
-# Copyright (C) 2007-2015 CEA/DEN, EDF R&D
+# Copyright (C) 2007-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
#
ADD_SUBDIRECTORY(testfiles)
+ADD_SUBDIRECTORY(presentations)
SET(MED_RESOURCES_FILES
datasource_add.png
--- /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
+#
+
+SET(MED_RESOURCES_FILES
+ pqGlyph16.png
+ pqGlyph24.png
+ pqIsosurface16.png
+ pqIsosurface24.png
+ pqNodeMapData16.png
+ pqNodeMapData24.png
+ pqSlice16.png
+ pqSlice24.png
+ pqWarp16.png
+ pqWarp24.png
+ scalarmap16.png
+ scalarmap24.png
+ )
+INSTALL(FILES ${MED_RESOURCES_FILES} DESTINATION ${SALOME_MED_INSTALL_RES_DATA})