From c07db8d8a72cfafa00b7c224c2705934d82ca81f Mon Sep 17 00:00:00 2001 From: =?utf8?q?C=C3=A9dric=20Aguerre?= Date: Wed, 22 Jul 2015 11:58:02 +0200 Subject: [PATCH] define parameters for scalar map presentation --- idl/MEDPresentationManager.idl | 14 +++++++++++++- src/MEDOP/cmp/MEDPresentationManager_i.cxx | 6 ++---- src/MEDOP/cmp/MEDPresentationManager_i.hxx | 2 +- src/MEDOP/gui/WorkspaceController.cxx | 9 +++++++-- src/MEDOP/tui/medpresentation/medpresentation.py | 7 +++++-- 5 files changed, 28 insertions(+), 10 deletions(-) diff --git a/idl/MEDPresentationManager.idl b/idl/MEDPresentationManager.idl index 4a426f436..e316b2ec3 100644 --- a/idl/MEDPresentationManager.idl +++ b/idl/MEDPresentationManager.idl @@ -26,10 +26,22 @@ module MEDOP { + enum MEDPresentationViewMode { + VIEW_MODE_OVERLAP, + VIEW_MODE_REPLACE, + VIEW_MODE_NEW_LAYOUT, + VIEW_MODE_SPLIT_VIEW + }; + + struct ScalarMapParameters { + long fieldHandlerId; + MEDPresentationViewMode viewMode; + }; + interface MEDPresentationManager : SALOME::GenericObj { - void MakeScalarMap(in long fieldHandlerId, in string viewMode); + void MakeScalarMap(in ScalarMapParameters params); }; diff --git a/src/MEDOP/cmp/MEDPresentationManager_i.cxx b/src/MEDOP/cmp/MEDPresentationManager_i.cxx index ad94d0c49..b37e616ad 100644 --- a/src/MEDOP/cmp/MEDPresentationManager_i.cxx +++ b/src/MEDOP/cmp/MEDPresentationManager_i.cxx @@ -18,8 +18,6 @@ // #include "MEDPresentationManager_i.hxx" -#include "SALOME_KernelServices.hxx" -#include "Basics_Utils.hxx" MEDPresentationManager_i* MEDPresentationManager_i::_instance = NULL; @@ -41,8 +39,8 @@ MEDPresentationManager_i::~MEDPresentationManager_i() #include void -MEDPresentationManager_i::MakeScalarMap(CORBA::Long fieldHandlerId, const char* viewMode) +MEDPresentationManager_i::MakeScalarMap(const MEDOP::ScalarMapParameters& params) { - //throw KERNEL::createSalomeException("Not implemented yet"); + std::cout << "View mode: " << params.viewMode << std::endl; std::cout << "MEDPresentationManager_i::MakeScalarMap: Not implemented yet\n"; } diff --git a/src/MEDOP/cmp/MEDPresentationManager_i.hxx b/src/MEDOP/cmp/MEDPresentationManager_i.hxx index c6d199808..b52cf558f 100644 --- a/src/MEDOP/cmp/MEDPresentationManager_i.hxx +++ b/src/MEDOP/cmp/MEDPresentationManager_i.hxx @@ -35,7 +35,7 @@ class MEDOP_EXPORT MEDPresentationManager_i: public POA_MEDOP::MEDPresentationMa static MEDPresentationManager_i* getInstance(); - void MakeScalarMap(CORBA::Long fieldHandlerId, const char*); + void MakeScalarMap(const MEDOP::ScalarMapParameters&); private: diff --git a/src/MEDOP/gui/WorkspaceController.cxx b/src/MEDOP/gui/WorkspaceController.cxx index 6b2e5cc3f..e5ef41345 100644 --- a/src/MEDOP/gui/WorkspaceController.cxx +++ b/src/MEDOP/gui/WorkspaceController.cxx @@ -488,9 +488,14 @@ void WorkspaceController::processDatasourceEvent(const DatasourceEvent * event) else if ( event->eventtype == DatasourceEvent::EVENT_VIEW_OBJECT_SCALAR_MAP ) { QStringList commands; commands += QString("from medpresentation import MakeScalarMap"); - QString viewMode = "view mode"; // :TODO: change this (get value from dedicated dialog) + commands += QString("import MEDOP"); + +#define stringify( name ) # name + QString viewMode = stringify(MEDOP::VIEW_MODE_NEW_LAYOUT); // :TODO: change this (get value from dedicated dialog) + viewMode.replace("::", "."); + MEDOP::FieldHandler* fieldHandler = dataObject->getFieldHandler(); - commands += QString("MakeScalarMap(get(%1), '%2')").arg(fieldHandler->id).arg(viewMode); + commands += QString("MakeScalarMap(get(%1), %2)").arg(fieldHandler->id).arg(viewMode); _consoleDriver->exec(commands); } else { diff --git a/src/MEDOP/tui/medpresentation/medpresentation.py b/src/MEDOP/tui/medpresentation/medpresentation.py index dfc977ef5..7e51ad0a0 100644 --- a/src/MEDOP/tui/medpresentation/medpresentation.py +++ b/src/MEDOP/tui/medpresentation/medpresentation.py @@ -28,12 +28,15 @@ def LoadDataSource(filename): notifyGui_addsource(filename) # -def MakeScalarMap(proxy, viewMode): +def MakeScalarMap(proxy, viewMode=MEDOP.VIEW_MODE_REPLACE): # Create the presentation instance in CORBA engine # The engine in turn creates the ParaView pipeline elements print "In MakeScalarMap (Python)" - __manager.MakeScalarMap(proxy.id, viewMode) + print "viewMode:", viewMode, " [", type(viewMode), "]" + + params = MEDOP.ScalarMapParameters(proxy.id, viewMode); + __manager.MakeScalarMap(params) # -- 2.39.2