return "";
}
}
+
+std::string
+MEDPresentation::getRenderViewCommand(MEDCALC::MEDPresentationViewMode viewMode)
+{
+ std::string cmd = std::string("pvs._DisableFirstRenderCameraReset();");
+ if (viewMode == MEDCALC::VIEW_MODE_OVERLAP) {
+ cmd += std::string("__view1 = pvs.GetActiveViewOrCreate('RenderView');");
+ } else if (viewMode == MEDCALC::VIEW_MODE_REPLACE) {
+ cmd += std::string("__view1 = pvs.GetActiveViewOrCreate('RenderView');");
+ cmd += std::string("pvs.active_objects.source and pvs.Hide(view=__view1);");
+ cmd += std::string("pvs.Render();");
+ } else if (viewMode == MEDCALC::VIEW_MODE_NEW_LAYOUT) {
+ cmd += std::string("__layout1 = pvs.servermanager.misc.ViewLayout(registrationGroup='layouts');");
+ cmd += std::string("__view1 = pvs.CreateView('RenderView');");
+ } else if (viewMode == MEDCALC::VIEW_MODE_SPLIT_VIEW) {
+ cmd += std::string("__view1 = pvs.CreateView('RenderView');");
+ }
+ cmd += std::string("__view1.ResetCamera();");
+ return cmd;
+}
protected:
MEDPresentation(MEDPresentation::TypeID fieldHandlerId, std::string name);
+ std::string getRenderViewCommand(MEDCALC::MEDPresentationViewMode viewMode);
virtual void internalGeneratePipeline() = 0;
PyObject * getPythonObjectFromMain(const char * var);
#include "MEDPresentationContour.hxx"
-#include "MEDFactoryClient.hxx"
void
MEDPresentationContour::internalGeneratePipeline()
{
+ PyGILState_STATE _gil_state = PyGILState_Ensure();
+
+ std::string cmd = std::string("import pvsimple as pvs;");
+ cmd += getRenderViewCommand(_params.viewMode); // define __view1
+
+ cmd += std::string("__obj1 = pvs.MEDReader(FileName='") + _fileName + std::string("');");
+ cmd += std::string("__isovolume1 = pvs.IsoVolume(Input=__obj1);");
+ cmd += std::string("__disp1 = pvs.Show(__isovolume1, __view1);");
+ cmd += std::string("pvs.ColorBy(__disp1, ('") + _fieldType + std::string("', '") + _fieldName + std::string("'));");
+ cmd += std::string("__disp1.SetScalarBarVisibility(__view1, True);");
+ cmd += std::string("__disp1.RescaleTransferFunctionToDataRangeOverTime();");
+ cmd += std::string("pvs.Render();");
+
+ //std::cerr << "Python command:" << std::endl;
+ //std::cerr << cmd << std::endl;
+ PyRun_SimpleString(cmd.c_str());
+ // Retrieve Python object for internal storage:
+ PyObject* obj = getPythonObjectFromMain("__isovolume1");
+ PyObject* disp = getPythonObjectFromMain("__disp1");
+ pushInternal(obj, disp);
+
+ PyGILState_Release(_gil_state);
}
{
public:
MEDPresentationContour(const MEDCALC::ContourParameters& params) :
- MEDPresentation(params.fieldHandlerId, "MEDPresentationContour")
+ MEDPresentation(params.fieldHandlerId, "MEDPresentationContour"), _params(params)
{}
virtual ~MEDPresentationContour() {}
PyGILState_STATE _gil_state = PyGILState_Ensure();
std::string cmd = std::string("import pvsimple as pvs;");
+ cmd += getRenderViewCommand(_params.viewMode); // define __view1
+
cmd += std::string("__obj1 = pvs.MEDReader(FileName='") + _fileName + std::string("');");
cmd += std::string("__warpByVector1 = pvs.WarpByVector(Input=__obj1);");
- cmd += std::string("__disp1 = pvs.Show(__warpByVector1);");
+ cmd += std::string("__disp1 = pvs.Show(__warpByVector1, __view1);");
cmd += std::string("pvs.ColorBy(__disp1, ('") + _fieldType + std::string("', '") + _fieldName + std::string("'));");
- cmd += std::string("pvs.GetActiveViewOrCreate('RenderView').ResetCamera();");
+ cmd += std::string("__disp1.SetScalarBarVisibility(__view1, True);");
cmd += std::string("__disp1.RescaleTransferFunctionToDataRangeOverTime();");
+ cmd += std::string("pvs.Render();");
//std::cerr << "Python command:" << std::endl;
//std::cerr << cmd << std::endl;
PyRun_SimpleString(cmd.c_str());
// Retrieve Python object for internal storage:
- PyObject * obj = getPythonObjectFromMain("__warpByVector1");
- PyObject * disp = getPythonObjectFromMain("__disp1");
+ PyObject* obj = getPythonObjectFromMain("__warpByVector1");
+ PyObject* disp = getPythonObjectFromMain("__disp1");
pushInternal(obj, disp);
PyGILState_Release(_gil_state);
{
public:
MEDPresentationDeflectionShape(const MEDCALC::DeflectionShapeParameters& params) :
- MEDPresentation(params.fieldHandlerId, "MEDPresentationDeflectionShape")
+ MEDPresentation(params.fieldHandlerId, "MEDPresentationDeflectionShape"), _params(params)
{}
virtual ~MEDPresentationDeflectionShape() {}
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#ifndef _MED_PRESENTATION_MANAGER_I_TPP_
-#define _MED_PRESENTATION_MANAGER_I_TPP_
+#ifndef _MED_PRESENTATION_MANAGER_I_TXX_
+#define _MED_PRESENTATION_MANAGER_I_TXX_
template<typename PresentationType, typename PresentationParameters>
MEDPresentation::TypeID
return newID;
}
-#endif // _MED_PRESENTATION_MANAGER_I_TPP_
+#endif // _MED_PRESENTATION_MANAGER_I_TXX_
PyGILState_STATE _gil_state = PyGILState_Ensure();
std::string cmd = std::string("import pvsimple as pvs;");
+ cmd += getRenderViewCommand(_params.viewMode); // define __view1
+
cmd += std::string("__obj1 = pvs.MEDReader(FileName='") + _fileName + std::string("');");
- cmd += std::string("__disp1 = pvs.Show(__obj1);");
+ cmd += std::string("__disp1 = pvs.Show(__obj1, __view1);");
cmd += std::string("pvs.ColorBy(__disp1, ('") + _fieldType + std::string("', '") + _fieldName + std::string("'));");
- cmd += std::string("pvs.GetActiveViewOrCreate('RenderView').ResetCamera();");
+ cmd += std::string("__disp1.SetScalarBarVisibility(__view1, True);");
cmd += std::string("__disp1.RescaleTransferFunctionToDataRangeOverTime();");
cmd += std::string("__disp1.SetRepresentationType('Point Sprite');");
+ cmd += std::string("pvs.Render();");
//std::cerr << "Python command:" << std::endl;
//std::cerr << cmd << std::endl;
PyRun_SimpleString(cmd.c_str());
// Retrieve Python object for internal storage:
- PyObject * obj = getPythonObjectFromMain("__obj1");
- PyObject * disp = getPythonObjectFromMain("__disp1");
+ PyObject* obj = getPythonObjectFromMain("__obj1");
+ PyObject* disp = getPythonObjectFromMain("__disp1");
pushInternal(obj, disp);
PyGILState_Release(_gil_state);
{
public:
MEDPresentationPointSprite(const MEDCALC::PointSpriteParameters& params) :
- MEDPresentation(params.fieldHandlerId, "MEDPresentationPointSprite")
+ MEDPresentation(params.fieldHandlerId, "MEDPresentationPointSprite"), _params(params)
{}
virtual ~MEDPresentationPointSprite() {}
void
MEDPresentationScalarMap::internalGeneratePipeline()
{
- //MEDPresentation::TypeID fieldHandlerId = params.fieldHandlerId;
- //MEDCALC::MEDPresentationViewMode viewMode = params.viewMode;
-
- // :TODO: consider viewMode
-
- /*
- MEDCALC::MEDDataManager_ptr dataManager(MEDFactoryClient::getDataManager());
- MEDCALC::FieldHandler* fieldHandler = dataManager->getFieldHandler(fieldHandlerId);
-
- std::cout << "\tfieldHandlerId: " << fieldHandlerId << std::endl;
- std::cout << "\tviewMode: " << viewMode << std::endl;
-
- MEDCALC::MeshHandler* meshHandler = dataManager->getMesh(fieldHandler->meshid);
- MEDCALC::DatasourceHandler* dataSHandler = dataManager->getDatasourceHandlerFromID(meshHandler->sourceid);
- std::cout << "\tfileName: " << dataSHandler->uri << std::endl;
- std::cout << "\tfiedName: " << fieldHandler->fieldname << std::endl;
- */
-
PyGILState_STATE _gil_state = PyGILState_Ensure();
std::string cmd = std::string("import pvsimple as pvs;");
+ cmd += getRenderViewCommand(_params.viewMode); // define __view1
+
cmd += std::string("__obj1 = pvs.MEDReader(FileName='") + _fileName + std::string("');");
- cmd += std::string("__disp1 = pvs.Show(__obj1);");
+ cmd += std::string("__disp1 = pvs.Show(__obj1, __view1);");
cmd += std::string("pvs.ColorBy(__disp1, ('") + _fieldType + std::string("', '") + _fieldName + std::string("'));");
- cmd += std::string("pvs.GetActiveViewOrCreate('RenderView').ResetCamera();");
+ cmd += std::string("__disp1.SetScalarBarVisibility(__view1, True);");
cmd += std::string("__disp1.RescaleTransferFunctionToDataRangeOverTime();");
+ cmd += std::string("pvs.Render();");
//std::cerr << "Python command:" << std::endl;
//std::cerr << cmd << std::endl;
PyRun_SimpleString(cmd.c_str());
// Retrieve Python object for internal storage:
- PyObject * obj = getPythonObjectFromMain("__obj1");
- PyObject * disp = getPythonObjectFromMain("__disp1");
+ PyObject* obj = getPythonObjectFromMain("__obj1");
+ PyObject* disp = getPythonObjectFromMain("__disp1");
pushInternal(obj, disp);
PyGILState_Release(_gil_state);
{
public:
MEDPresentationScalarMap(const MEDCALC::ScalarMapParameters& params) :
- MEDPresentation(params.fieldHandlerId, "MEDPresentationScalarMap")
+ MEDPresentation(params.fieldHandlerId, "MEDPresentationScalarMap"), _params(params)
{}
virtual ~MEDPresentationScalarMap() {}
#include "MEDPresentationSlices.hxx"
-#include "MEDFactoryClient.hxx"
void
MEDPresentationSlices::internalGeneratePipeline()
{
+ PyGILState_STATE _gil_state = PyGILState_Ensure();
+
+ std::string cmd = std::string("import pvsimple as pvs;");
+ cmd += getRenderViewCommand(_params.viewMode); // define __view1
+
+ cmd += std::string("__obj1 = pvs.MEDReader(FileName='") + _fileName + std::string("');");
+ cmd += std::string("__slice1 = pvs.Slice(Input=__obj1);");
+ cmd += std::string("__disp1 = pvs.Show(__slice1, __view1);");
+ cmd += std::string("pvs.ColorBy(__disp1, ('") + _fieldType + std::string("', '") + _fieldName + std::string("'));");
+ cmd += std::string("__disp1.SetScalarBarVisibility(__view1, True);");
+ cmd += std::string("__disp1.RescaleTransferFunctionToDataRangeOverTime();");
+ cmd += std::string("pvs.Render();");
+
+ //std::cerr << "Python command:" << std::endl;
+ //std::cerr << cmd << std::endl;
+ PyRun_SimpleString(cmd.c_str());
+ // Retrieve Python object for internal storage:
+ PyObject* obj = getPythonObjectFromMain("__slice1");
+ PyObject* disp = getPythonObjectFromMain("__disp1");
+ pushInternal(obj, disp);
+
+ PyGILState_Release(_gil_state);
}
{
public:
MEDPresentationSlices(const MEDCALC::SlicesParameters& params) :
- MEDPresentation(params.fieldHandlerId, "MEDPresentationSlices")
+ MEDPresentation(params.fieldHandlerId, "MEDPresentationSlices"), _params(params)
{}
virtual ~MEDPresentationSlices() {}
PyGILState_STATE _gil_state = PyGILState_Ensure();
std::string cmd = std::string("import pvsimple as pvs;");
+ cmd += getRenderViewCommand(_params.viewMode); // define __view1
+
cmd += std::string("__obj1 = pvs.MEDReader(FileName='") + _fileName + std::string("');");
- cmd += std::string("__disp1 = pvs.Show(__obj1);");
+ cmd += std::string("__disp1 = pvs.Show(__obj1, __view1);");
cmd += std::string("pvs.ColorBy(__disp1, ('") + _fieldType + std::string("', '") + _fieldName + std::string("'));");
- cmd += std::string("pvs.GetActiveViewOrCreate('RenderView').ResetCamera();");
+ cmd += std::string("__disp1.SetScalarBarVisibility(__view1, True);");
cmd += std::string("__disp1.RescaleTransferFunctionToDataRangeOverTime();");
cmd += std::string("__disp1.SetRepresentationType('3D Glyphs');");
+ cmd += std::string("pvs.Render();");
//std::cerr << "Python command:" << std::endl;
//std::cerr << cmd << std::endl;
PyRun_SimpleString(cmd.c_str());
// Retrieve Python object for internal storage:
- PyObject * obj = getPythonObjectFromMain("__obj1");
- PyObject * disp = getPythonObjectFromMain("__disp1");
+ PyObject* obj = getPythonObjectFromMain("__obj1");
+ PyObject* disp = getPythonObjectFromMain("__disp1");
pushInternal(obj, disp);
PyGILState_Release(_gil_state);
{
public:
MEDPresentationVectorField(const MEDCALC::VectorFieldParameters& params) :
- MEDPresentation(params.fieldHandlerId, "MEDPresentationVectorField")
+ MEDPresentation(params.fieldHandlerId, "MEDPresentationVectorField"), _params(params)
{}
virtual ~MEDPresentationVectorField() {}
MEDEventListener_i.cxx
MEDModule.cxx
DatasourceController.cxx
+ PresentationController.cxx
factory.cxx
)
-SET(MEDCALCGUI_HEADERS MEDModule.hxx MEDEventListener_i.hxx WorkspaceController.hxx DatasourceController.hxx)
+SET(MEDCALCGUI_HEADERS MEDModule.hxx MEDEventListener_i.hxx WorkspaceController.hxx DatasourceController.hxx PresentationController.hxx)
QT_WRAP_MOC(MEDCALCGUI_HEADERS_MOC ${MEDCALCGUI_HEADERS})
-// 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
_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 *)));
void
MEDModule::createModuleActions() {
- // Creating actions concerning the dataspace
_datasourceController->createActions();
- // Creating actions concerning the workspace
_workspaceController->createActions();
+ _presentationController->createActions();
}
int
mgr->insert ( this->action( actionId ), parentId, 0 );
mgr->setRule( this->action( actionId ), rule, QtxPopupMgr::VisibleRule );
}
+
+MEDCALC::MEDPresentationViewMode
+MEDModule::getSelectedViewMode()
+{
+ return _presentationController->getSelectedViewMode();
+}
-// 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
#include "WorkspaceController.hxx"
#include "XmedDataModel.hxx"
#include "DatasourceController.hxx"
+#include "PresentationController.hxx"
#include <SALOMEconfig.h>
#include CORBA_CLIENT_HEADER(MED_Gen)
+#include CORBA_SERVER_HEADER(MEDPresentationManager)
class SalomeApp_Application;
const QString& tooltip=QString());
void addActionInPopupMenu(int actionId,const QString& menus="",const QString& rule="client='ObjectBrowser'");
+ MEDCALC::MEDPresentationViewMode getSelectedViewMode();
+
public slots:
virtual bool activateModule( SUIT_Study* theStudy );
virtual bool deactivateModule( SUIT_Study* theStudy );
DatasourceController * _datasourceController;
WorkspaceController * _workspaceController;
XmedDataModel * _xmedDataModel;
+ PresentationController * _presentationController;
static MED_ORB::MED_Gen_var myEngine;
};
<!DOCTYPE TS>
<TS version="2.0">
<context>
- <name>DatasourceController</name>
+ <name>PresentationController</name>
<message>
- <source>MEDPresentationScalarMap</source>
- <translation>Scalar map</translation>
+ <source>LAB_VIEW_MODE_REPLACE</source>
+ <translation>Replace</translation>
</message>
<message>
- <source>MEDPresentationContour</source>
- <translation>Contour</translation>
+ <source>TIP_VIEW_MODE_REPLACE</source>
+ <translation>Replace</translation>
</message>
<message>
- <source>MEDPresentationVectorField</source>
- <translation>Vector field</translation>
+ <source>LAB_VIEW_MODE_OVERLAP</source>
+ <translation>Overlap</translation>
</message>
<message>
- <source>MEDPresentationSlices</source>
- <translation>Slices</translation>
+ <source>TIP_VIEW_MODE_OVERLAP</source>
+ <translation>Overlap</translation>
</message>
<message>
- <source>MEDPresentationDeflectionShape</source>
- <translation>Deflection shape</translation>
+ <source>LAB_VIEW_MODE_NEW_LAYOUT</source>
+ <translation>New layout</translation>
</message>
<message>
- <source>MEDPresentationPointSprite</source>
- <translation>Point sprite</translation>
+ <source>TIP_VIEW_MODE_NEW_LAYOUT</source>
+ <translation>New layout</translation>
</message>
+ <message>
+ <source>LAB_VIEW_MODE_SPLIT_VIEW</source>
+ <translation>Split</translation>
+ </message>
+ <message>
+ <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>
<!DOCTYPE TS>
<TS version="2.0">
<context>
- <name>DatasourceController</name>
+ <name>PresentationController</name>
<message>
- <source>MEDPresentationScalarMap</source>
- <translation>Carte scalaire</translation>
+ <source>LAB_VIEW_MODE_REPLACE</source>
+ <translation>Remplacer</translation>
</message>
<message>
- <source>MEDPresentationContour</source>
- <translation>Contour</translation>
+ <source>TIP_VIEW_MODE_REPLACE</source>
+ <translation>Remplacer</translation>
</message>
<message>
- <source>MEDPresentationVectorField</source>
- <translation>Champ de vecteurs</translation>
+ <source>LAB_VIEW_MODE_OVERLAP</source>
+ <translation>Superposer</translation>
</message>
<message>
- <source>MEDPresentationSlices</source>
- <translation>Coupes</translation>
+ <source>TIP_VIEW_MODE_OVERLAP</source>
+ <translation>Superposer</translation>
</message>
<message>
- <source>MEDPresentationDeflectionShape</source>
- <translation>Déformée</translation>
+ <source>LAB_VIEW_MODE_NEW_LAYOUT</source>
+ <translation>Nouvel onglet</translation>
+ </message>
+ <message>
+ <source>TIP_VIEW_MODE_NEW_LAYOUT</source>
+ <translation>Nouvel onglet</translation>
</message>
<message>
- <source>MEDPresentationPointSprite</source>
- <translation>Point Sprite</translation>
+ <source>LAB_VIEW_MODE_SPLIT_VIEW</source>
+ <translation>Scinder</translation>
+ </message>
+ <message>
+ <source>TIP_VIEW_MODE_SPLIT_VIEW</source>
+ <translation>Scinder</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"/>
--- /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 "PresentationController.hxx"
+#include "MEDModule.hxx"
+#include "Basics_Utils.hxx"
+#include "QtxActionGroup.h"
+
+static const int OPTIONS_VIEW_MODE_ID = 943;
+static const int OPTIONS_VIEW_MODE_REPLACE_ID = 944;
+static const int OPTIONS_VIEW_MODE_OVERLAP_ID = 945;
+static const int OPTIONS_VIEW_MODE_NEW_LAYOUT_ID = 946;
+static const int OPTIONS_VIEW_MODE_SPLIT_VIEW_ID = 947;
+
+PresentationController::PresentationController(MEDModule* salomeModule)
+{
+ STDLOG("Creating a PresentationController");
+ _salomeModule = salomeModule;
+}
+
+PresentationController::~PresentationController()
+{
+ STDLOG("Deleting the PresentationController");
+}
+
+void
+PresentationController::createActions()
+{
+ STDLOG("Creating PresentationController actions");
+ int toolbarId = _salomeModule->createTool("View Mode", "PresentationToolbar");
+
+ QtxActionGroup* ag = _salomeModule->createActionGroup(OPTIONS_VIEW_MODE_ID, true);
+ ag->setText("View mode");
+ ag->setUsesDropDown(true);
+
+ QString label = tr("LAB_VIEW_MODE_REPLACE");
+ QString tooltip = tr("TIP_VIEW_MODE_REPLACE");
+ QAction* a = _salomeModule->createAction(OPTIONS_VIEW_MODE_REPLACE_ID,label,QIcon(),label,tooltip,0);
+ a->setCheckable(true);
+ a->setChecked(true);
+ ag->add(a);
+
+ label = tr("LAB_VIEW_MODE_OVERLAP");
+ tooltip = tr("TIP_VIEW_MODE_OVERLAP");
+ a = _salomeModule->createAction(OPTIONS_VIEW_MODE_OVERLAP_ID,label,QIcon(),label,tooltip,0);
+ a->setCheckable(true);
+ ag->add(a);
+
+ label = tr("LAB_VIEW_MODE_NEW_LAYOUT");
+ tooltip = tr("TIP_VIEW_MODE_NEW_LAYOUT");
+ a = _salomeModule->createAction(OPTIONS_VIEW_MODE_NEW_LAYOUT_ID,label,QIcon(),label,tooltip,0);
+ a->setCheckable(true);
+ ag->add(a);
+
+ label = tr("LAB_VIEW_MODE_SPLIT_VIEW");
+ tooltip = tr("TIP_VIEW_MODE_SPLIT_VIEW");
+ a = _salomeModule->createAction(OPTIONS_VIEW_MODE_SPLIT_VIEW_ID,label,QIcon(),label,tooltip,0);
+ a->setCheckable(true);
+ ag->add(a);
+
+ _salomeModule->createTool(OPTIONS_VIEW_MODE_ID, toolbarId);
+
+
+}
+
+MEDCALC::MEDPresentationViewMode
+PresentationController::getSelectedViewMode()
+{
+ if (_salomeModule->action(OPTIONS_VIEW_MODE_REPLACE_ID)->isChecked()) {
+ return MEDCALC::VIEW_MODE_REPLACE;
+ }
+ else if (_salomeModule->action(OPTIONS_VIEW_MODE_OVERLAP_ID)->isChecked()) {
+ return MEDCALC::VIEW_MODE_OVERLAP;
+ }
+ else if (_salomeModule->action(OPTIONS_VIEW_MODE_NEW_LAYOUT_ID)->isChecked()) {
+ return MEDCALC::VIEW_MODE_NEW_LAYOUT;
+ }
+ else if (_salomeModule->action(OPTIONS_VIEW_MODE_SPLIT_VIEW_ID)->isChecked()) {
+ return MEDCALC::VIEW_MODE_SPLIT_VIEW;
+ }
+}
--- /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 PRESENTATION_CONTROLLER_HXX
+#define PRESENTATION_CONTROLLER_HXX
+
+#include <QtGui>
+#include "MEDCALCGUI.hxx"
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(MEDPresentationManager)
+
+class MEDModule;
+
+class MEDCALCGUI_EXPORT PresentationController : public QObject {
+ Q_OBJECT
+
+public:
+ PresentationController(MEDModule* salomeModule);
+ ~PresentationController();
+
+ void createActions();
+
+ MEDCALC::MEDPresentationViewMode getSelectedViewMode();
+
+private:
+ MEDModule* _salomeModule;
+
+};
+
+#endif /* PRESENTATION_CONTROLLER_HXX */
QString
WorkspaceController::_getViewMode() {
-#define stringify( name ) # name
-
- QString viewMode = stringify(MEDCALC::VIEW_MODE_NEW_LAYOUT); // :TODO: change this (get value from dedicated dialog)
- viewMode.replace("::", ".");
-
- return viewMode;
+ 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";
+ }
}
/**
def MakeScalarMap(proxy, viewMode=MEDCALC.VIEW_MODE_REPLACE):
# Create the presentation instance in CORBA engine
# The engine in turn creates the ParaView pipeline elements
-
- print "In MakeScalarMap (Python)"
-
- print "viewMode:", viewMode, " [", type(viewMode), "]"
-
params = MEDCALC.ScalarMapParameters(proxy.id, viewMode)
presentation_id = __manager.makeScalarMap(params)
notifyGui_addPresentation(proxy.id, presentation_id)
#
def MakeContour(proxy, viewMode=MEDCALC.VIEW_MODE_REPLACE):
- print "Not implemented yet"
- #params = MEDCALC.ContourParameters(proxy.id, viewMode)
- #presentation_id = __manager.makeContour(params)
- #notifyGui_addPresentation(proxy.id, presentation_id)
+ params = MEDCALC.ContourParameters(proxy.id, viewMode)
+ presentation_id = __manager.makeContour(params)
+ notifyGui_addPresentation(proxy.id, presentation_id)
#
def MakeVectorField(proxy, viewMode=MEDCALC.VIEW_MODE_REPLACE):
#
def MakeSlices(proxy, viewMode=MEDCALC.VIEW_MODE_REPLACE):
- print "Not implemented yet"
- #params = MEDCALC.SlicesParameters(proxy.id, viewMode)
- #presentation_id = __manager.makeSlices(params)
- #notifyGui_addPresentation(proxy.id, presentation_id)
+ params = MEDCALC.SlicesParameters(proxy.id, viewMode)
+ presentation_id = __manager.makeSlices(params)
+ notifyGui_addPresentation(proxy.id, presentation_id)
#
def MakeDeflectionShape(proxy, viewMode=MEDCALC.VIEW_MODE_REPLACE):