X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDCalc%2Fgui%2FWorkspaceController.cxx;h=dd59a244776e709b9d1a9052e1951f3ac087960f;hb=51ed503edb7d4390ce4078ba445128995d70ed9c;hp=b85ea1f9d5a564dd2a6e1bad5c05d91b9953414c;hpb=b20f7e235416dfe68ef29bc5ea806a776a5bdd73;p=modules%2Fmed.git diff --git a/src/MEDCalc/gui/WorkspaceController.cxx b/src/MEDCalc/gui/WorkspaceController.cxx index b85ea1f9d..dd59a2447 100644 --- a/src/MEDCalc/gui/WorkspaceController.cxx +++ b/src/MEDCalc/gui/WorkspaceController.cxx @@ -35,6 +35,9 @@ #include #include +#include +#include + /*! * This class defines a DockWidget plugged in the SALOME application, * and containing a tree view for rendering a hierarchical data @@ -311,7 +314,21 @@ void WorkspaceController::processMedEvent(const MEDCALC::MedEvent* event) { else if ( event->type == MEDCALC::EVENT_REMOVE_PRESENTATION ) { emit workspaceSignal(event); // forward to PresentationController } - + else if ( event->type == MEDCALC::EVENT_MODIFY_PRESENTATION ) { + emit workspaceSignal(event); // forward to PresentationController + } + else if ( event->type == MEDCALC::EVENT_PLAY_TEST ) { + emit workspaceSignal(event); // forward to TestController + } + else if ( event->type == MEDCALC::EVENT_QUIT_SALOME ) { + emit workspaceSignal(event); // forward to TestController + } + else if ( event->type == MEDCALC::EVENT_ERROR ) { + std::string msg(event->msg); + QMessageBox::warning(_salomeModule->getApp()->desktop(), "Error", QString::fromStdString(msg)); + } + else + STDLOG("WorkspaceController::processMedEvent(): Unhandled event!!!"); } /*! @@ -522,108 +539,6 @@ void WorkspaceController::processDatasourceEvent(const DatasourceEvent* event) { } } -QString -WorkspaceController::_getViewMode() -{ - MEDCALC::MEDPresentationViewMode viewMode = _salomeModule->getSelectedViewMode(); - switch(viewMode) { - case MEDCALC::VIEW_MODE_REPLACE: return "MEDCALC.VIEW_MODE_REPLACE"; - case MEDCALC::VIEW_MODE_OVERLAP: return "MEDCALC.VIEW_MODE_OVERLAP"; - case MEDCALC::VIEW_MODE_NEW_LAYOUT: return "MEDCALC.VIEW_MODE_NEW_LAYOUT"; - case MEDCALC::VIEW_MODE_SPLIT_VIEW: return "MEDCALC.VIEW_MODE_SPLIT_VIEW"; - } - return QString(); -} - -QString -WorkspaceController::_getColorMap() -{ - MEDCALC::MEDPresentationColorMap colorMap = _salomeModule->getSelectedColorMap(); - switch(colorMap) { - case MEDCALC::COLOR_MAP_BLUE_TO_RED_RAINBOW: return "MEDCALC.COLOR_MAP_BLUE_TO_RED_RAINBOW"; - case MEDCALC::COLOR_MAP_COOL_TO_WARM: return "MEDCALC.COLOR_MAP_COOL_TO_WARM"; - } - return QString(); -} - -/** - * 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; - - // --> Send commands to SALOME Python console - if ( event->eventtype == PresentationEvent::EVENT_VIEW_OBJECT_SCALAR_MAP ) { - QString viewMode = _getViewMode(); - //QString displayedInfo = ; // from PresentationController combobox - //QString scalarBarRange = ; // from PresentationController spinbox - QString colorMap = _getColorMap(); - MEDCALC::FieldHandler* fieldHandler = dataObject->getFieldHandler(); - QStringList commands; - commands += QString("presentation_id = medcalc.MakeScalarMap(accessField(%1), %2, colorMap=%3)").arg(fieldHandler->id).arg(viewMode).arg(colorMap); - commands += QString("presentation_id"); - _consoleDriver->exec(commands); - } - else if ( event->eventtype == PresentationEvent::EVENT_VIEW_OBJECT_CONTOUR ) { - QString viewMode = _getViewMode(); - MEDCALC::FieldHandler* fieldHandler = dataObject->getFieldHandler(); - QStringList commands; - commands += QString("presentation_id = medcalc.MakeContour(accessField(%1), %2)").arg(fieldHandler->id).arg(viewMode); - commands += QString("presentation_id"); - _consoleDriver->exec(commands); - } - else if ( event->eventtype == PresentationEvent::EVENT_VIEW_OBJECT_VECTOR_FIELD ) { - QString viewMode = _getViewMode(); - MEDCALC::FieldHandler* fieldHandler = dataObject->getFieldHandler(); - QStringList commands; - commands += QString("presentation_id = medcalc.MakeVectorField(accessField(%1), %2)").arg(fieldHandler->id).arg(viewMode); - commands += QString("presentation_id"); - _consoleDriver->exec(commands); - } - else if ( event->eventtype == PresentationEvent::EVENT_VIEW_OBJECT_SLICES ) { - QString viewMode = _getViewMode(); - MEDCALC::FieldHandler* fieldHandler = dataObject->getFieldHandler(); - QStringList commands; - commands += QString("presentation_id = medcalc.MakeSlices(accessField(%1), %2)").arg(fieldHandler->id).arg(viewMode); - commands += QString("presentation_id"); - _consoleDriver->exec(commands); - } - else if ( event->eventtype == PresentationEvent::EVENT_VIEW_OBJECT_DEFLECTION_SHAPE ) { - QString viewMode = _getViewMode(); - MEDCALC::FieldHandler* fieldHandler = dataObject->getFieldHandler(); - QStringList commands; - commands += QString("presentation_id = medcalc.MakeDeflectionShape(accessField(%1), %2)").arg(fieldHandler->id).arg(viewMode); - commands += QString("presentation_id"); - _consoleDriver->exec(commands); - } - else if ( event->eventtype == PresentationEvent::EVENT_VIEW_OBJECT_POINT_SPRITE ) { - QString viewMode = _getViewMode(); - MEDCALC::FieldHandler* fieldHandler = dataObject->getFieldHandler(); - QStringList commands; - commands += QString("presentation_id = medcalc.MakePointSprite(accessField(%1), %2)").arg(fieldHandler->id).arg(viewMode); - commands += QString("presentation_id"); - _consoleDriver->exec(commands); - } - else { - STDLOG("The event "<eventtype<<" is not implemented yet"); - } -} - void WorkspaceController::processProcessingEvent(const ProcessingEvent* event) {